Documentation
Reference
2.1.50 (current version)
collection
interactivityModel
Interfaces
2.1.52 (release candidate)
collection
interactivityModel
Interfaces

IGeoObjectCollection

Extends ICustomizable, IEventEmitter, IParentOnMap.

Interface of a collection of geo objects.

Constructor | Fields | Events | Methods

Constructor

IGeoObjectCollection()

Fields

NameTypeDescription
eventsIEventManager

Event manager.

Inherited from IEventEmitter.

optionsIOptionManager

Options manager.

Inherited from ICustomizable.

Events

NameDescription
add

A child geo object has been added (inserted). Instance of the Event class. Names of fields that are available via the Event.get method:

  • index: Integer - Index of the added geo object.
  • child: IGeoObject - Reference to the added geo object.

boundschange

Change to coordinates of the geographical area that spans the collection and its child geo objects. Instance of the Event class.

mapchange

Map reference changed. Data fields:

  • oldMap - Old map.
  • newMap - New map.

Inherited from IParentOnMap.

optionschange

Change to the object options.

Inherited from ICustomizable.

pixelboundschange

Change to pixel coordinates of the area that includes the collection and its child geo objects. Instance of the Event class.

remove

A child geo object has been removed. Instance of the Event class. Names of fields that are available via the Event.get method:

  • index: Integer - Index of the deleted geo object.
  • child: IGeoObject - Reference to the deleted geo object.

set

A new child geo object has been added to the collection. Instance of the Event class. Names of fields that are available via the Event.get method:

  • index: Integer - Index of the geo object.
  • child: IGeoObject - Reference to the new geo object.
  • prevChild: IGeoObject - Reference to the previous value for this index.

Methods

NameReturnsDescription
add(child[, index])

IGeoObjectCollection

Adds (inserts) a child geo object to the collection.

each(callback[, context])

Calls a handler function for each child geo object.

get(index)

IGeoObject

Returns a child geo object with the specified index.

getBounds()

Number[][]|null

Returns geographical coordinates of the area that covers the collection and its child geo objects.

getIterator()

IIterator

Returns iterator for the collection.

getLength()

Integer

Returns length of the collection.

getMap()

Map

Returns reference to the map.

Inherited from IParentOnMap.

getPixelBounds()

Number[][]|null

Returns global pixel coordinates of the area that spans the collection and its child geo objects.

indexOf(object)

Integer

Returns index of the child geo object. If the geo object cannot be found in the collection, -1 is returned.

remove(child)

IGeoObjectCollection

Removes a child geo object from the collection.

removeAll()

IGeoObjectCollection

Clears the collection.

set(index, child)

IGeoObjectCollection

Adds a new child geo object to the collection.

splice(index, number)

IGeoObjectCollection

Removes geo objects from the collection. If necessary, puts other objects in their place. Objects that will be added in place of the deleted ones are passed as additional parameters (after the "number" parameter).

Events details

add

A child geo object has been added (inserted). Instance of the Event class. Names of fields that are available via the Event.get method:

  • index: Integer - Index of the added geo object.
  • child: IGeoObject - Reference to the added geo object.

boundschange

Change to coordinates of the geographical area that spans the collection and its child geo objects. Instance of the Event class.

pixelboundschange

Change to pixel coordinates of the area that includes the collection and its child geo objects. Instance of the Event class.

remove

A child geo object has been removed. Instance of the Event class. Names of fields that are available via the Event.get method:

  • index: Integer - Index of the deleted geo object.
  • child: IGeoObject - Reference to the deleted geo object.

set

A new child geo object has been added to the collection. Instance of the Event class. Names of fields that are available via the Event.get method:

  • index: Integer - Index of the geo object.
  • child: IGeoObject - Reference to the new geo object.
  • prevChild: IGeoObject - Reference to the previous value for this index.

Methods details

add

Adds (inserts) a child geo object to the collection.

Returns self-reference.

Parameters:

ParameterDefault valueDescription
child*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: IGeoObject

Child object.

index

Type: Integer

The index where the new object is added. By default, the object is added to the end of the collection.

* Mandatory parameter/option.

each

{} each(callback[, context])

Calls a handler function for each child geo object.

Parameters:

ParameterDefault valueDescription
callback*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Function

Handler function.

context

Type: Object

Context for the handler function.

* Mandatory parameter/option.

get

Returns a child geo object with the specified index.

Parameters:

ParameterDefault valueDescription
index*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Integer

Index.

* Mandatory parameter/option.

getBounds

{Number[][]|null} getBounds()

Returns geographical coordinates of the area that covers the collection and its child geo objects.

getIterator

{IIterator} getIterator()

Returns iterator for the collection.

getLength

{Integer} getLength()

Returns length of the collection.

getPixelBounds

{Number[][]|null} getPixelBounds()

Returns global pixel coordinates of the area that spans the collection and its child geo objects.

indexOf

{Integer} indexOf(object)

Returns index of the child geo object. If the geo object cannot be found in the collection, -1 is returned.

Parameters:

ParameterDefault valueDescription
object*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object

Child object.

* Mandatory parameter/option.

remove

Removes a child geo object from the collection.

Returns self-reference.

Parameters:

ParameterDefault valueDescription
child*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: IGeoObject

Geo object being removed.

* Mandatory parameter/option.

removeAll

{IGeoObjectCollection} removeAll()

Clears the collection.

Returns self-reference.

set

Adds a new child geo object to the collection.

Returns self-reference.

Parameters:

ParameterDefault valueDescription
index*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Integer

Index.

child*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: IGeoObject

Child object.

* Mandatory parameter/option.

splice

Removes geo objects from the collection. If necessary, puts other objects in their place. Objects that will be added in place of the deleted ones are passed as additional parameters (after the "number" parameter).

Returns collection of deleted geo objects.

Parameters:

ParameterDefault valueDescription
index*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Integer

Index of the geo object to start deletion from.

number*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Integer

The number of geo objects to be deleted.

* Mandatory parameter/option.