Class: EntityCollection

og/entity/EntityCollection~EntityCollection

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

new EntityCollection(options)

Name Type Description
options Object optional Entity options:
Name Type Default Description
entities Array.<Entity> optional Entities array.
visibility boolean true optional Entity visibility.
scaleByDistance Array.<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.
opacity number optional Entity global opacity.
pickingEnabled boolean true optional Entity picking enable.
polygonOffsetFactor Number 0.0 optional The scale factor for the variable depth offset. The default value is 0.
polygonOffsetUnits Number 0.0 optional The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. The default value is 0.
Fires:
  • - Triggered when entity has moved.
  • - Triggered when collection entities begin draw.
  • - Triggered after collection has drawn.
  • - Triggered when added to the render node.
  • - Triggered when removed from the render node.
  • - Triggered when new entity added to the collection.
  • - Triggered when entity removes from the collection.
  • - Triggered when visibility changes.
  • - Triggered when mouse moves over the entity.
  • - Triggered when mouse has entered over the entity.
  • - Triggered when mouse leaves the entity.
  • - Mouse left button clicked.
  • - Mouse right button clicked.
  • - Mouse right button clicked.
  • - Mouse left button double click.
  • - Mouse right button double click.
  • - Mouse middle button double click.
  • - Mouse left button up(stop pressing).
  • - Mouse right button up(stop pressing).
  • - Mouse middle button up(stop pressing).
  • - Mouse left button is just pressed down(start pressing).
  • - Mouse right button is just pressed down(start pressing).
  • - Mouse middle button is just pressed down(start pressing).
  • - Mouse left button is pressing.
  • - Mouse right button is pressing.
  • - Mouse middle button is pressing.
  • - Mouse wheel is rotated.
  • - Triggered when touch moves over the entity.
  • - Triggered when entity begins to touch.
  • - Triggered when entity ends touching.
  • - Triggered entity double touch.
  • - Triggered when touching leaves entity.
  • - Triggered when touch enters over the entity.

Members

protected_entitiesArray.<Entity>

Entities array.

protected_fadingOpacitynumber

Opacity state during the animated opacity.

protected_opacitynumber

Global opacity.

protected_renderNodeIndexnumber

Render node collections array index.

protected_visibilityboolean

Visibility option.

billboardHandlerBillboardHandler

Billboards handler

eventsEvents

Entity collection events handler.

geoObjectHandlerog.GeoObjectHandler

Geo object handler

readonlyid

Unic identifier.

labelHandlerLabelHandler

Labels handler

pointCloudHandlerPointCloudHandler

PointCloud handler

polygonOffsetFactorNumber

Specifies the scale factor for gl.polygonOffset function to calculate depth values, 0.0 is default.

polygonOffsetUnitsNumber

Specifies the scale Units for gl.polygonOffset function to calculate depth values, 0.0 is default.

polylineHandlerPolylineHandler

Polyline handler

rayHandlerRayHandler

Ray handler

renderNodeRenderNode

Render node context.

scaleByDistanceArray.<number>

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.

shapeHandlerShapeHandler

Shape handler

stripHandlerStripHandler

Strip handler

Methods

add(entity){EntityCollection}

Adds entity to the collection and returns collection.
Name Type Description
entity Entity Entity.
Returns:
Type Description
EntityCollection -

addEntities(entities){EntityCollection}

Adds entities array to the collection and returns collection.
Name Type Description
entities Array.<Entity> Entities array.
Returns:
Type Description
EntityCollection -

addTo(renderNode, isHidden){EntityCollection}

Adds this collection to render node.
Name Type Description
renderNode RenderNode Render node.
isHidden boolean optional Uses in vector layers that render in planet render specific function.
Returns:
Type Description
EntityCollection -

belongs(entity){boolean}

Returns true if the entity belongs this collection, otherwise returns false.
Name Type Description
entity Entity Entity.
Returns:
Type Description
boolean -

bindRenderNode(renderNode)

This function is called in the RenderNode assign function.
Name Type Description
renderNode RenderNode
Removes all entities from colection and clear handlers.

createPickingColors()

Creates or refresh collected entities picking color.
Safety entities loop.
Name Type Description
callback function Entity callback.

getEntities(){Array.<Entity>}

Gets entity array.
Returns:
Type Description
Array.<Entity> -

getOpacity(){number}

Gets collection opacity.
Returns:
Type Description
number -

getVisibility(){boolean}

Returns collection visibility.
Returns:
Type Description
boolean -

reindexEntitiesArray(startIndex)

Refresh collected entities indexes from startIndex entitytes collection array position.
Name Type Description
startIndex number Entities collection array index.
Removes collection from render node.

removeEntity(entity)

Removes entity from this collection.
Name Type Description
entity Entity Entity to remove.
Sets collection opacity.
Name Type Description
opacity number Opacity.

setPickingEnabled(enable)

Sets collection picking ability.
Name Type Description
enable boolean Picking enable flag.

setScaleByDistance(near, far, farInvisible)

Sets scale by distance parameters.
Name Type Description
near number Full scale entity distance.
far number Zerol scale entity distance.
farInvisible number optional Entity visibility distance.

setVisibility(visibility)

Sets collection visibility.
Name Type Description
visibility boolean Visibility flag.

updateBillboardsTextureAtlas()

Updates billboard texture atlas.

updateLabelsFontAtlas()

Updates labels font atlas.