Class: Vector

og/layer/Vector~Vector

Vector layer represents alternative entities store. Used for geospatial data rendering like points, lines, polygons, geometry objects etc.

new Vector(name, options)

Name Type Default Description
name string "noname" optional Layer name.
options Object optional Layer options:
Name Type Default Description
minZoom number 0 optional Minimal visible zoom. 0 is default
maxZoom number 50 optional Maximal visible zoom. 50 is default.
attribution string optional Layer attribution.
zIndex string 0 optional Layer Z-order index. 0 is default.
visibility boolean true optional Layer visibility. True is default.
isBaseLayer boolean false optional Layer base layer. False is default.
entities Array.<og.Entity> optional Entities array.
scaleByDistance Array.<number, number, number> optional 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.
nodeCapacity number 30 optional Maximum entities quantity in the tree node. Rendering optimization parameter. 30 is default.
async boolean true optional Asynchronous vector data handling before rendering. True for optimization huge data.
clampToGround boolean false optional Clamp vector data to the ground.
relativeToGround boolean false optional Place vector data relative to the ground relief.
Fires:
  • - Triggered when entity has moved.
  • - Triggered when new entity added to the layer.
  • - Triggered when entity removes from the collection.

Extends

Members

asyncboolean

Asynchronous data handling before rendering.

clampToGroundboolean

Vector data clamp to ground flag.

pickingEnabled

Set layer picking events active.

relativeToGroundboolean

Sets vector data relative to the ground relief.

scaleByDistanceArray.<number, number, number>

First index - near distance to the entity, after that 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.

Methods

_reindexEntitiesArray(startIndex)

Refresh collected entities indexes from startIndex entitytes collection array position.
Name Type Description
startIndex number Entity array index.

abortMaterialLoading(material)

Abort exact material loading.
Name Type Description
material og.planetSegment.Material Segment material.

add(entity, rightNow){og.layer.Vector}

Adds entity to the layer.
Name Type Description
entity og.Entity Entity.
rightNow boolean optional Entity insertion option. False is deafult.
Returns:
Type Description
og.layer.Vector - Returns this layer.

addEntities(entities, rightNow){og.layer.Vector}

Adds entity array to the layer.
Name Type Description
entities Array.<og.Entity> Entities array.
rightNow boolean optional Entity insertion option. False is deafult.
Returns:
Type Description
og.layer.Vector - Returns this layer.
Adds layer to the planet.
Name Type Description
planet og.Planet Planet scene object.
Returns:
Type Description
og.layer.Vector -
TODO: Clear the layer.

each(callback)

Safety entities loop.
Name Type Description
callback callback Entity callback.

getEntities(){Array.<og.Entity>}

Returns stored entities.
Returns:
Type Description
Array.<og.Entity> -

abstracthasImageryTiles(){boolean}

Returns true if the layer has vector rasterized data.
Returns:
Type Description
boolean -

abstractloadMaterial(material)

Start to load tile material.
Name Type Description
material og.Segment.Material Current material.

removeEntities(entities){og.layer.Vector}

Removes entities from layer.
Name Type Description
entities Array.<og.Entity> Entity array.
Returns:
Type Description
og.layer.Vector - Returns this layer.
Remove entity from layer. TODO: memory leaks.
Name Type Description
entity og.Entity Entity to remove.
Returns:
Type Description
og.layer.Vector - Returns this layer.

setEntities(entities)

Removes current entities from layer and adds new entities.
Name Type Description
entities Array.<og.Entity> New entity array.

setScaleByDistance(near, far, farInvisible){og.layer.Vector}

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.
Returns:
Type Description
og.layer.Vector -

Events

Triggered when layer has added to the planet.
Triggered layer has double touched.
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 layer.
Triggered when mouse moves over the layer.
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 layer has removed from the planet.
Mouse right button is pressing.
Mouse right button up(stop pressing).
Triggered when layer has finished touching.
Triggered when touch enters over the layer.
Triggered when touching leaves layer borders.
Triggered when touching moves over the layer.
Triggered when layer begins to touch.
Triggered when layer visibilty chanched.