objectManager.OverlayCollection

Extends ICustomizable, IEventEmitter.

Collection of overlays.

Constructor | Fields | Events | Methods

Constructor

objectManager.OverlayCollection()

Fields

Name Type Description
events IEventManager

Event manager.

Inherited from IEventEmitter.

options IOptionManager

Options manager.

Inherited from ICustomizable.

Events

Name Description
add
Adds an overlay to the collection. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - The added overlay.
click
Single left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
contextmenu
Calls the element's context menu. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
dblclick
Double left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
mousedown
Pressing the mouse button over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
mouseenter
Pointing the cursor at the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
mouseleave
Moving the cursor off of the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
mousemove
Moving the cursor over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
mouseup
Letting go of the mouse button over an object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
multitouchend
End of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
multitouchmove
Repeating event during multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
multitouchstart
Start of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.
optionschange

Change to the object options.

Inherited from ICustomizable.

remove
Removes an overlay from the collection. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - The deleted overlay.
wheel
Mouse wheel scrolling. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

Methods

Name Returns Description
each(callback, context)
getAll()

Object[]

Returns array of objects contained in the collection.

getById(id)

Object|null

Returns overlay, or null if an overlay with the passed ID does not exist.

getId(overlay)

Number|null

Returns the object ID, or null if the overlay is not contained in the collection.

getIterator()

IIterator

Returns iterator for the collection.

getLength()

Number

Returns the number of objects in the collection.

Events details

add

Adds an overlay to the collection. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - The added overlay.

click

Single left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

contextmenu

Calls the element's context menu. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

dblclick

Double left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

mousedown

Pressing the mouse button over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

mouseenter

Pointing the cursor at the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

mouseleave

Moving the cursor off of the object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

mousemove

Moving the cursor over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

mouseup

Letting go of the mouse button over an object. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

multitouchend

End of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

multitouchmove

Repeating event during multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

multitouchstart

Start of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Names of fields that are available via the IMultiTouchEvent#get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

remove

Removes an overlay from the collection. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - The deleted overlay.

wheel

Mouse wheel scrolling. When using, keep in mind that mouse events are emulated when a touch screen is used. More information is available in domEvent.manager. Instance of the Event class. Names of fields that are available via the Event.get method:
  • objectId - The ID of the object the overlay belongs to.
  • overlay - IOverlay - The overlay at which the event occurred.
  • coords - Geographical coordinates of the point at which the event occurred.
  • globalPixels - Coordinates of the event in global pixels from the upper-left corner of the world.
  • pagePixels - Coordinates of the event in pixels from the upper-left corner of the page.
  • clientPixels - Coordinates of the event in pixels from the upper-left corner of the browser window.
  • domEvent - Source DOM event (as a DomEvent object), if there is one.

Methods details

each

{} each(callback, context)

Parameters:

Parameter Default value Description
callback *

Type: Function

Callback function that the collection objects are passed to.

context *

Type: Object

Context for the callback.

* Mandatory parameter/option.

Example:

objectManager.clusters.overlays.each(function (overlay) {
     overlay.options.set('cursor', 'help');
});

getAll

{Object[]} getAll()

Returns array of objects contained in the collection.

Example:

var clusterOverlayArray = objectManager.clusters.overlays.getAll();

getById

{Object|null} getById(id)

Returns overlay, or null if an overlay with the passed ID does not exist.

Parameters:

Parameter Default value Description
id *

Type: Number

ID of the object the overlay belongs to.

* Mandatory parameter/option.

Example:

objectManager.objects.add('mouseenter', function (e) {
    var objectId = e.get('objectId'),
        overlay = objectManager.objects.overlays.getById(objectId);
    overlay.options.set('zIndex', 100);
});

getId

{Number|null} getId(overlay)

Returns the object ID, or null if the overlay is not contained in the collection.

Parameters:

Parameter Default value Description
overlay *

Type: IOverlay

Overlay.

* Mandatory parameter/option.

Example:

objectManager.objects.overlays.each(function (overlay) {
    var objectId = objectManager.objects.overlays.getId(overlay);
    objectManager.objects.setObjectOptions(objectId, {
        preset: 'islands#redIcon'
    });
});

getIterator

{IIterator} getIterator()

Returns iterator for the collection.

Example:

var it = objectManager.objects.overlays.getIterator(),
    overlay;
while ((overlay = it.getNext()) != it.STOP_ITERATION) {
    overlay.options.set('zIndex', 10);
}

getLength

{Number} getLength()

Returns the number of objects in the collection.

Example:

var objectsNumber = objectManager.objects.getLength(),
    overlaysNumber = objectManager.objects.overlays.getNumber();
alert('Now the map shows ' + overlaysNumber + ' of ' + objectsNumber.);