Class: EntityCollection

og.EntityCollection

new og.EntityCollection(options)

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.
Name Type Description
options Object optional Entity options:
Name Type Default Description
entities Array.<og.Entity> optional Entities array.
visibility boolean true optional Entity visibility.
scaleByDistance Array.<number, number, number> optional Entity scale by distance parameters. 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.
Fires:

Members

protected_animatedOpacitynumber

Opacity state during the animated opacity.

protected_entitiesArray.<og.Entity>

Entities array.

protected_opacitynumber

Global opacity.

protected_renderNodeIndexnumber

Render node collections array index.

protected_visibilityboolean

Visibility option.

billboardHandlerog.BillboardHandler

Billboards handler

eventsog.Events

Entity collection events handler.

readonlyid

Unic identifier.

labelHandlerog.LabelHandler

Labels handler

pointCloudHandlerog.PointCloudHandler

PointCloud handler

polylineHandlerog.PolylineHandler

Polyline handler
Render node context.

scaleByDistanceArray.<number, number, 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.

shapeHandlerog.ShapeHandler

Shape handler

Methods

Adds entity to the collection and returns collection.
Name Type Description
entity og.Entity Entity.
Returns:
Type Description
og.EntityCollection
Adds entities array to the collection and returns collection.
Name Type Description
entities Array.<og.Entity> Entities array.
Returns:
Type Description
og.EntityCollection
Adds this collection to render node.
Name Type Description
renderNode og.scene.RenderNode Render node.
isHidden boolean optional Uses in vector layers that render in planet render specific function.
Returns:
Type Description
og.EntityCollection

belongs(entity){boolean}

Returns true if the entity belongs this collection, otherwise returns false.
Name Type Description
entity og.Entity Entity.
Returns:
Type Description
boolean
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.
Gets entities.
Returns:
Type Description
Array.<og.Entity>
Gets collection opacity.
Name Type Description
opacity number Opacity.

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 og.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.

setRenderer(renderer)

Sets renderer. Used in renderer initialization, when entity collection starts before renderer has initialized.
Name Type Description
renderer og.Renderer Renderer.

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.

Events

Triggered when added to the render node.
Triggered entity double touch.
Triggered when collection entities begin draw.
Triggered after collection has drawn.
Triggered when new entity added to the collection.
Triggered when entity has moved.
Triggered when entity removes from the collection.
Mouse left button clicked.
Mouse left button double click.
Mouse left button is just pressed down(start pressing).
Mouse left button is pressing.
Mouse left button up(stop pressing).
Mouse right button clicked.
Mouse middle button double click.
Mouse middle button is just pressed down(start pressing).
Mouse middle button is pressing.
Triggered when mouse has entered over the entity.
Triggered when mouse leaves the entity.
Triggered when mouse moves over the entity.
Mouse wheel is rotated.
Mouse middle button up(stop pressing).
Mouse right button clicked.
Mouse right button double click.
Mouse right button is just pressed down(start pressing).
Triggered when removed from the render node.
Mouse right button is pressing.
Mouse right button up(stop pressing).
Triggered when entity ends touching.
Triggered when touch enters over the entity.
Triggered when touching leaves entity.
Triggered when touch moves over the entity.
Triggered when entity begins to touch.
Triggered when visibility changes.