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.<Entity> optional Entities array.
scaleByDistance Array.<number> optional 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.
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.
polygonOffsetFactor Number 0.0 optional The scale factor for the variable depth offset. The default value is 0.
polygonOffsetUnits Number -637000.0 optional The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset.
Fires:
  • - Triggered when entity has moved.
  • - Triggered when new entity added to the layer.
  • - Triggered when entity removes from the collection.

Extends

  • Layer

Members

asyncboolean

Asynchronous data handling before rendering.

clampToGroundboolean

Vector data clamp to ground flag.

pickingEnabled

Set layer picking events active.

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.

relativeToGroundboolean

Sets vector data relative to the ground relief.

scaleByDistanceArray.<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 Material Segment material.

add(entity, rightNow){layer.Vector}

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

addEntities(entities, rightNow){layer.Vector}

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

addTo(planet){layer.Vector}

Adds layer to the planet.
Name Type Description
planet Planet Planet scene object.
Returns:
Type Description
layer.Vector -
TODO: Clear the layer.

each(callback)

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

getEntities(){Array.<Entity>}

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

insert(entity, index, rightNow){layer.Vector}

Adds entity to the layer in the index position.
Name Type Description
entity Entity Entity.
index Number Index position.
rightNow boolean optional Entity insertion option. False is deafult.
Returns:
Type Description
layer.Vector - Returns this layer.

abstractloadMaterial(material)

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

removeEntities(entities){layer.Vector}

Removes entities from layer.
Name Type Description
entities Array.<Entity> Entity array.
Returns:
Type Description
layer.Vector - Returns this layer.

removeEntity(entity){layer.Vector}

Remove entity from layer. TODO: memory leaks.
Name Type Description
entity Entity Entity to remove.
Returns:
Type Description
layer.Vector - Returns this layer.

setEntities(entities){layer.Vector}

Removes current entities from layer and adds new entities.
Name Type Description
entities Array.<Entity> New entity array.
Returns:
Type Description
layer.Vector - Returns layer instance.

setScaleByDistance(near, far, farInvisible){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
layer.Vector -