EntityCollection
Source: EntityCollection.ts:101
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.
Fires
event:drawevent:drawendevent:addevent:removeevent:entityaddevent:entityremoveevent:visibilitychangeevent:mousemoveevent:mouseenterevent:mouseleaveevent:lclickevent:rclickevent:mclickevent:ldblclickevent:rdblclickevent:mdblclickevent:lupevent:rupevent:mupevent:ldownevent:rdownevent:mdownevent:lholdevent:rholdevent:mholdevent:mousewheelevent:touchmoveevent:touchstartevent:touchendevent:doubletouchevent:touchleaveevent:touchenter
Constructor
new EntityCollection(options?: Object): EntityCollectionParameters
options(Object, optional) — Entity options:options.entities(Array.<Entity>, optional) — Entities array.options.visibility(boolean, optional, default: true) — Entity visibility.options.labelMaxLetters(number, optional) — Maximum label letters per line used by the label handler.options.pickingEnabled(boolean, optional) — Enables/disables picking for all entity handlers.options.receiveProjectors(boolean, optional, default: true) — Enables/disables projector effect reception for this collection.options.receiveFrameTransparency(boolean, optional, default: false) — Enables/disables frame transparency reception for this collection.options.receiveShadows(boolean, optional, default: true) — Enables/disables shadow map reception for this collection.options.scaleByDistance(Array.<number>, optional) — Scale by distance parameters:[near, far, vanish, scale]. The fourth entry is a plain multiplier and defaults to1, so three entries are accepted as well. SeeEntityCollection#scaleByDistancefor what each entry means. Default is[MAX32, MAX32, MAX32, 1](no distance scaling).options.pickingScale(number | Array.<number>, optional) — Picking scale value or xyz scale array.options.opacity(number, optional) — Entity global opacity.options.shadeMode(number | string, optional, default: 1) — Geo object shading mode:0|none|unlit,0.5|phong,1|pbr.options.depthOrder(number, optional, default: 0) — Rendering order for grouped vector layer collections.options.depthOffset(Number, optional, default: "0.0") — Signed world-space depth offset along the camera ray. Negative values move geometry closer to the camera, positive values move it farther.options.disableCullFace(boolean, optional, default: false) — Disables back-face culling for geo object rendering. //@fires entitymove
Instance Methods
setVisibility(visibility: boolean)
Sets collection visibility.
Parameters
visibility(boolean) — Visibility flag.
requestRedraw()
Requests the next frame to be rendered.
getVisibility(): boolean
Returns collection visibility.
Returns
boolean— Collection visibility flag.
setOpacity(opacity: number)
Sets collection opacity.
Parameters
opacity(number) — Opacity.
setPickingEnabled(enable: boolean)
Sets collection picking ability.
Parameters
enable(boolean) — Picking enable flag.
setReceiveProjectors(enable: boolean)
Sets whether this collection receives projector effects.
Parameters
enable(boolean) —trueto receive projector effects,falseto ignore them.
setReceiveFrameTransparency(enable: boolean)
Sets whether this collection receives frame transparency.
Parameters
enable(boolean) —trueto receive frame transparency,falseto ignore it.
setReceiveShadows(enable: boolean)
Sets whether this collection receives shadow map effects.
Parameters
enable(boolean) —trueto receive shadow map effects,falseto ignore them.
getOpacity(): number
Gets collection opacity.
Returns
number— Collection opacity.
setScaleByDistance(
near: number,
far: number,
vanish?: number,
scale?: number,
)
Sets scale by distance parameters.
Parameters
near(number) — Distance below which a geoObject keeps its world size. Billboards and labels ignore it; pass0to disable the world scale ramp.far(number) — Distance up to which an entity keeps its size.vanish(number, optional) — Distance at which the size reaches zero. Defaults tofar, which means no fading at all: pastfara billboard or a label keeps its screen size, and a geoObject keeps the world size it reached there.scale(number, optional) — Plain multiplier applied on top, for every entity type.
applyTerrainCollision()
Aligns collection entities to terrain. Currently applies to polyline entities.
add(entity: Entity): EntityCollection
Adds entity to the collection and returns collection.
Parameters
entity(Entity) — Entity.
Returns
EntityCollection— Current collection instance.
addEntities(entities: Array.<Entity>): EntityCollection
Adds entities array to the collection and returns collection.
Parameters
entities(Array.<Entity>) — Entities array.
Returns
EntityCollection— Current collection instance.
belongs(entity: Entity): boolean
Returns true if the entity belongs to this collection, otherwise returns false.
Parameters
entity(Entity) — Entity.
Returns
boolean—trueif the entity belongs to this collection.
removeEntity(entity: Entity)
Removes entity from this collection.
Parameters
entity(Entity) — Entity to remove.
createPickingColors()
Creates or refresh collected entities picking color.
reindexEntitiesArray(startIndex: number)
Refresh collected entities indexes from startIndex entities collection array position.
Parameters
startIndex(number) — Entities collection array index.
addTo(scene: Scene, isHidden?: boolean): EntityCollection
Adds this collection to render node.
Parameters
scene(Scene) — Render node.isHidden(boolean, optional, default: false) — Used in vector layers with planet-specific rendering.
Returns
EntityCollection— Current collection instance.
bindScene(scene: Scene)
This function is called in the Scene assign function.
Parameters
scene(Scene)
_updateGeodeticCoordinates(ellipsoid: Ellipsoid)
Updates coordinates all lonLat entities in collection after collection attached to the planet node.
Parameters
ellipsoid(Ellipsoid) — Globe ellipsoid.
updateBillboardsTextureAtlas()
Updates billboard texture atlas.
updateLabelsFontAtlas()
Updates labels font atlas.
updateStrokeTextureAtlas()
Updates stroke texture atlas.
remove()
Removes collection from render node.
getEntities(): Array.<Entity>
Gets entity array.
Returns
Array.<Entity>— Entity array copy.
each(callback: function)
Safety entities loop.
Parameters
callback(function) — Entity callback.
clear()
Removes all entities from collection and clear handlers.
Events
draw
Triggered when collection entities begin draw.
drawend
Triggered after collection has drawn.
add
Triggered when added to the render node.
remove
Triggered when removed from the render node.
entityadd
Triggered when new entity added to the collection.
entityremove
Triggered when entity removes from the collection.
visibilitychange
Triggered when visibility changes.
mousemove
Triggered when mouse moves over the entity.
mouseenter
Triggered when mouse has entered over the entity.
mouseleave
Triggered when mouse leaves the entity.
lclick
Mouse left button clicked.
rclick
Mouse right button clicked.
mclick
Mouse right button clicked.
ldblclick
Mouse left button double click.
rdblclick
Mouse right button double click.
mdblclick
Mouse middle button double click.
lup
Mouse left button up(stop pressing).
rup
Mouse right button up(stop pressing).
mup
Mouse middle button up(stop pressing).
ldown
Mouse left button is just pressed down(start pressing).
rdown
Mouse right button is just pressed down(start pressing).
mdown
Mouse middle button is just pressed down(start pressing).
lhold
Mouse left button is pressing.
rhold
Mouse right button is pressing.
mhold
Mouse middle button is pressing.
mousewheel
Mouse wheel is rotated.
touchmove
Triggered when touch moves over the entity.
touchstart
Triggered when entity begins to touch.
touchend
Triggered when entity ends touching.
doubletouch
Triggered entity double touch.
touchleave
Triggered when touching leaves entity.
touchenter
Triggered when touch enters over the entity.