EntityCollection

An observable collection of og.Entity instances where each entity has a unique id. Entity collection provide handlers for each type of entity like billboard, label or 3ds object.

Constructor

new EntityCollection(optionsopt)

Parameters:
NameTypeAttributesDescription
optionsObject<optional>

Entity options:

Properties
NameTypeAttributesDefaultDescription
entitiesArray.<Entity><optional>

Entities array.

visibilityboolean<optional>
true

Entity visibility.

scaleByDistanceArray.<number><optional>

Entity scale by distance parameters. (exactly 3 entries) First index - near distance to the entity, after entity becomes full scale. Second index - far distance to the entity, when entity becomes zero scale. Third index - far distance to the entity, when entity becomes invisible.

opacitynumber<optional>

Entity global opacity.

pickingEnabledboolean<optional>
true

Entity picking enable.

polygonOffsetUnitsNumber<optional>
0.0

The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. The default value is 0. //@fires EntityCollection#entitymove

Methods

(protected) _updateGeodeticCoordinates(ellipsoid)

Updates coordinates all lonLat entities in collection after collection attached to the planet node.

Parameters:
NameTypeDescription
ellipsoidEllipsoid

Globe ellipsoid.

add(entity) → {EntityCollection}

Adds entity to the collection and returns collection.

Parameters:
NameTypeDescription
entityEntity

Entity.

Returns:
Type: 
EntityCollection

addEntities(entities) → {EntityCollection}

Adds entities array to the collection and returns collection.

Parameters:
NameTypeDescription
entitiesArray.<Entity>

Entities array.

Returns:
Type: 
EntityCollection

addTo(renderNode, isHiddenopt) → {EntityCollection}

Adds this collection to render node.

Parameters:
NameTypeAttributesDefaultDescription
renderNodeRenderNode

Render node.

isHiddenboolean<optional>
false

Uses in vector layers that render in planet render specific function.

Returns:
Type: 
EntityCollection

belongs(entity) → {boolean}

Returns true if the entity belongs this collection, otherwise returns false.

Parameters:
NameTypeDescription
entityEntity

Entity.

Returns:
Type: 
boolean

bindRenderNode(renderNode)

This function is called in the RenderNode assign function.

Parameters:
NameTypeDescription
renderNodeRenderNode

clear()

Removes all entities from collection and clear handlers.

createPickingColors()

Creates or refresh collected entities picking color.

each(callback)

Safety entities loop.

Parameters:
NameTypeDescription
callbackfunction

Entity callback.

getEntities() → {Array.<Entity>}

Gets entity array.

Returns:
Type: 
Array.<Entity>

getOpacity() → {number}

Gets collection opacity.

Returns:
Type: 
number

getVisibility() → {boolean}

Returns collection visibility.

Returns:
Type: 
boolean

reindexEntitiesArray(startIndex)

Refresh collected entities indexes from startIndex entities collection array position.

Parameters:
NameTypeDescription
startIndexnumber

Entities collection array index.

remove()

Removes collection from render node.

removeEntity(entity)

Removes entity from this collection.

Parameters:
NameTypeDescription
entityEntity

Entity to remove.

setOpacity(opacity)

Sets collection opacity.

Parameters:
NameTypeDescription
opacitynumber

Opacity.

setPickingEnabled(enable)

Sets collection picking ability.

Parameters:
NameTypeDescription
enableboolean

Picking enable flag.

setScaleByDistance(near, far, farInvisibleopt)

Sets scale by distance parameters.

Parameters:
NameTypeAttributesDescription
nearnumber

Full scale entity distance.

farnumber

Zero scale entity distance.

farInvisiblenumber<optional>

Entity visibility distance.

setVisibility(visibility)

Sets collection visibility.

Parameters:
NameTypeDescription
visibilityboolean

Visibility flag.

updateBillboardsTextureAtlas()

Updates billboard texture atlas.

updateLabelsFontAtlas()

Updates labels font atlas.

Events

add

Triggered when added to the render node.

doubletouch

Triggered entity double touch.

draw

Triggered when collection entities begin draw.

drawend

Triggered after collection has drawn.

entityadd

Triggered when new entity added to the collection.

entityremove

Triggered when entity removes from the collection.

lclick

Mouse left button clicked.

ldblclick

Mouse left button double click.

ldown

Mouse left button is just pressed down(start pressing).

lhold

Mouse left button is pressing.

lup

Mouse left button up(stop pressing).

mclick

Mouse right button clicked.

mdblclick

Mouse middle button double click.

mdown

Mouse middle button is just pressed down(start pressing).

mhold

Mouse middle button is pressing.

mouseenter

Triggered when mouse has entered over the entity.

mouseleave

Triggered when mouse leaves the entity.

mousemove

Triggered when mouse moves over the entity.

mousewheel

Mouse wheel is rotated.

mup

Mouse middle button up(stop pressing).

rclick

Mouse right button clicked.

rdblclick

Mouse right button double click.

rdown

Mouse right button is just pressed down(start pressing).

remove

Triggered when removed from the render node.

rhold

Mouse right button is pressing.

rup

Mouse right button up(stop pressing).

touchend

Triggered when entity ends touching.

touchenter

Triggered when touch enters over the entity.

touchleave

Triggered when touching leaves entity.

touchmove

Triggered when touch moves over the entity.

touchstart

Triggered when entity begins to touch.

visibilitychange

Triggered when visibility changes.