EntityCollection

An observable collection of og.Entity instances where each entity has a unique id. Entity collection provides 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.

labelMaxLettersnumber<optional>

Maximum label letters per line used by the label handler.

pickingEnabledboolean<optional>

Enables/disables picking for all entity handlers.

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.

pickingScalenumber | Array.<number><optional>

Picking scale value or xyz scale array.

opacitynumber<optional>

Entity global opacity.

shadeModenumber | string<optional>
1

Geo object shading mode: 0|none|unlit, 0.5|phong, 1|pbr.

depthOrdernumber<optional>
0

Rendering order for grouped vector layer collections.

depthOffsetNumber<optional>
0.0

Signed world-space depth offset along the camera ray. Negative values move geometry closer to the camera, positive values move it farther.

disableCullFaceboolean<optional>
false

Disables back-face culling for geo object rendering. //@fires entitymove

Fires:
  • event:draw
  • event:drawend
  • event:add
  • event:remove
  • event:entityadd
  • event:entityremove
  • event:visibilitychange
  • event:mousemove
  • event:mouseenter
  • event:mouseleave
  • event:lclick
  • event:rclick
  • event:mclick
  • event:ldblclick
  • event:rdblclick
  • event:mdblclick
  • event:lup
  • event:rup
  • event:mup
  • event:ldown
  • event:rdown
  • event:mdown
  • event:lhold
  • event:rhold
  • event:mhold
  • event:mousewheel
  • event:touchmove
  • event:touchstart
  • event:touchend
  • event:doubletouch
  • event:touchleave
  • event:touchenter

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:

Current collection instance.

Type: 
EntityCollection

addEntities(entities) → {EntityCollection}

Adds entities array to the collection and returns collection.

Parameters:
NameTypeDescription
entitiesArray.<Entity>

Entities array.

Returns:

Current collection instance.

Type: 
EntityCollection

addTo(scene, isHiddenopt) → {EntityCollection}

Adds this collection to render node.

Parameters:
NameTypeAttributesDefaultDescription
sceneScene

Render node.

isHiddenboolean<optional>
false

Used in vector layers with planet-specific rendering.

Returns:

Current collection instance.

Type: 
EntityCollection

applyTerrainCollision()

Aligns collection entities to terrain. Currently applies to polyline entities.

belongs(entity) → {boolean}

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

Parameters:
NameTypeDescription
entityEntity

Entity.

Returns:

true if the entity belongs to this collection.

Type: 
boolean

bindScene(scene)

This function is called in the Scene assign function.

Parameters:
NameTypeDescription
sceneScene

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:

Entity array copy.

Type: 
Array.<Entity>

getOpacity() → {number}

Gets collection opacity.

Returns:

Collection opacity.

Type: 
number

getVisibility() → {boolean}

Returns collection visibility.

Returns:

Collection visibility flag.

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.

updateStrokeTextureAtlas()

Updates stroke texture 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.