KML

Layer to render KMLs files

Constructor

new KML(name, optionsopt)

Parameters:
NameTypeAttributesDescription
namestring
options*<optional>

Extends

Members

_id

Overrides

(protected) _pickingColor :Vec3

Layer picking color. Assign when added to the planet.

Type:

pickingEnabled

Set layer picking events active.

planet

Returns planet instance.

Overrides

Methods

(abstract, protected) _assignPlanet(planet)

Assign the planet.

Parameters:
NameTypeDescription
planetPlanet

Planet render node.

_bindEventsDefault(entityCollection)

Parameters:
NameTypeDescription
entityCollection
To Do
  • (refactoring) could be used in somethig like bindEntityCollectionQuad(...)

(abstract, protected) _bindPicking()

Assign picking color to the layer.

(protected) _convertCoordonatesIntoEntities(coordonates, color) → {any}

Creates billboards or polylines from array of lonlat.

Parameters:
NameTypeDescription
coordonatesArray
colorstring
Returns:
Type: 
any

(protected) _correctFullExtent()

Special correction of the whole globe extent.

_createEntityCollectionsTree()

(protected) _getXmlContent() → {Document}

Returns:
Type: 
Document

(protected) _parseKMLcoordinates()

(protected) _reindexEntitiesArray(startIndex)

Refresh collected entities indexes from startIndex entities collection array position.

Parameters:
NameTypeDescription
startIndexnumber

Entity array index.

abortMaterialLoading(material)

Abort exact material loading.

Parameters:
NameTypeDescription
materialMaterial

Segment material.

add(entity, rightNowopt) → {Vector}

Adds entity to the layer.

Parameters:
NameTypeAttributesDefaultDescription
entityEntity

Entity.

rightNowboolean<optional>
false

Entity insertion option. False is default.

Overrides
Returns:
  • Returns this layer.
Type: 
Vector

addEntities(entities, rightNowopt) → {Vector}

Adds entity array to the layer.

Parameters:
NameTypeAttributesDefaultDescription
entitiesArray.<Entity>

Entities array.

rightNowboolean<optional>
false

Entity insertion option. False is default.

Returns:
  • Returns this layer.
Type: 
Vector

(async) addKmlFromFiles(kmls, coloropt, billboardopt) → {Promise.<{entities: Array.<Entity>, extent: Extent}>}

Parameters:
NameTypeAttributesDescription
kmlsArray.<File>
colorstring<optional>
billboardBillboard<optional>
Returns:
Type: 
Promise.<{entities: Array.<Entity>, extent: Extent}>

(async) addKmlFromUrl(url, coloropt, billboardopt) → {Promise.<{entities: Array.<Entity>, extent: Extent}>}

Parameters:
NameTypeAttributesDescription
urlstring

Url of the KML to display. './myFile.kml' or 'http://mySite/myFile.kml' for example.

colorstring<optional>
billboardBillboard<optional>
Returns:
Type: 
Promise.<{entities: Array.<Entity>, extent: Extent}>

addTo(planet) → {Vector}

Adds layer to the planet.

Parameters:
NameTypeDescription
planetPlanet

Planet scene object.

Overrides
Returns:
Type: 
Vector

bringToFront()

Set zIndex to the maximal value depend on other layers on the planet.

clear()

TODO: Clear the layer.

Overrides

each(callback)

Safety entities loop.

Parameters:
NameTypeDescription
callback
Overrides

flyExtent()

Fly extent.

getAttribution() → {string}

Gets layer attribution.

Returns:

Layer attribution

Type: 
string

getEntities() → {Array.<Entity>}

Returns stored entities.

Returns:
Type: 
Array.<Entity>

getExtent() → {Extent}

Gets layer extent.

Returns:
  • Layer geodetic extent.
Type: 
Extent

getExtentMerc() → {Extent}

Gets layer web-mercator extent.

Returns:
  • Layer extent.
Type: 
Extent

getHeight() → {number}

Gets layer height.

Returns:
Type: 
number

getID() → {string}

Gets layer identifier.

Overrides
Returns:
  • Layer object id.
Type: 
string

getVisibility() → {boolean}

Gets layer visibility.

Returns:
  • Layer visibility.
Type: 
boolean

getZIndex() → {number}

Gets z-index.

Returns:
Type: 
number

(abstract) hasImageryTiles() → {boolean}

Returns true if a layer has imagery tiles.

Returns:
  • Imagery tiles flag.
Type: 
boolean

insert(entity, index, rightNowopt) → {Vector}

Adds entity to the layer in the index position.

Parameters:
NameTypeAttributesDefaultDescription
entityEntity

Entity.

indexNumber

Index position.

rightNowboolean<optional>
false

Entity insertion option. False is default.

Overrides
Returns:
  • Returns this layer.
Type: 
Vector

isBaseLayer() → {boolean}

Returns true if the layer is a base.

Returns:
  • Base layer flag.
Type: 
boolean

isEqual(layer) → {boolean}

Compares layers instances.

Parameters:
NameTypeDescription
layerLayer

Layer instance to compare.

Returns:
  • Returns true if the layers is the same instance of the input.
Type: 
boolean

(abstract) loadMaterial(material)

Start to load tile material.

Parameters:
NameTypeDescription
materialMaterial

Current material.

remove() → {Layer}

Removes from planet.

Overrides
Returns:

-This layer.

Type: 
Layer

removeEntities(entities) → {Vector}

Removes entities from layer.

Parameters:
NameTypeDescription
entitiesArray.<Entity>

Entity array.

Returns:
  • Returns this layer.
Type: 
Vector

removeEntity(entity) → {Vector}

Remove entity from layer. TODO: memory leaks.

Parameters:
NameTypeDescription
entityEntity

Entity to remove.

Returns:
  • Returns this layer.
Type: 
Vector

setAttribution(html)

Sets layer attribution text.

Parameters:
NameTypeDescription
htmlstring

HTML code that represents layer attribution, it could be just a text.

setBaseLayer(isBaseLayer)

Sets base layer type true.

Parameters:
NameTypeDescription
isBaseLayerboolean

setColor(color)

Parameters:
NameTypeDescription
colorstring

setEntities(entities) → {Vector}

Removes current entities from layer and adds new entities.

Parameters:
NameTypeDescription
entitiesArray.<Entity>

New entity array.

Returns:
  • Returns layer instance.
Type: 
Vector

setExtent(extent)

Sets visible geographical extent.

Parameters:
NameTypeDescription
extentExtent

Layer visible geographical extent.

setHeight(height)

Sets height over the ground.

Parameters:
NameTypeDescription
heightnumber

Layer height.

(abstract) setVisibility(visibility)

Sets layer visibility.

Parameters:
NameTypeDescription
visibilityboolean

Layer visibility.

setZIndex(zIndex)

Sets z-index.

Parameters:
NameTypeDescription
zIndexnumber

Layer z-index.

viewExtent()

View extent.