KML

Layer to render KML files.

Constructor

new KML(name, optionsopt)

Parameters:
NameTypeAttributesDescription
namestring

Layer name.

optionsIKMLParams<optional>

KML layer options.

Extends

Members

_id

Overrides

(protected) _pickingColor :Vec3

Layer picking color. Assign when added to the planet.

Type:

pickingEnabled

Sets 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 something like bindEntityCollectionQuad(...)

(abstract, protected) _bindPicking()

Assign picking color to the layer.

(protected) _convertCoordonatesIntoEntities(coordinates, color, billboardopt) → {Object}

Creates billboards or polylines from array of lonlat.

Parameters:
NameTypeAttributesDescription
coordinatesArray.<Array.<Array.<Array.<number>>>>

Coordinates grouped by files and paths.

colorstring

Polyline color.

billboardIBillboardParams<optional>

Billboard options.

Returns:
Type: 
Object

(protected) _correctFullExtent()

Special correction of the whole globe extent.

(protected) _getXmlContent() → {Promise.<XMLDocument>}

Returns:
Type: 
Promise.<XMLDocument>

(protected) _parseKMLcoordinates() → {Array.<Array.<number>>}

Returns:

Array of [longitude, latitude, altitude?].

Type: 
Array.<Array.<number>>

(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) → {Vector}

Adds entity to the layer.

Parameters:
NameTypeDescription
entityEntity

Entity.

Overrides
Returns:
  • Returns this layer.
Type: 
Vector

addEntities(entities) → {Vector}

Adds entity array to the layer.

Parameters:
NameTypeDescription
entitiesArray.<Entity>

Entities array.

Returns:
  • Returns this layer.
Type: 
Vector

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

Parameters:
NameTypeAttributesDescription
kmlsArray.<Blob>

KML files.

colorstring<optional>

Polyline color.

billboardIBillboardParams<optional>

Billboard options.

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. For example: './myFile.kml' or 'http://mySite/myFile.kml'.

colorstring<optional>

Polyline color.

billboardBillboard | IBillboardParams<optional>

Billboard options.

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

addTo(planet)

Adds layer to the planet.

Parameters:
NameTypeDescription
planetPlanet

Planet scene object.

Overrides

bringToFront()

Sets z-index to the maximum value relative to other layers on the planet.

clear()

Clear the layer.

Overrides

each(callback)

Safety entities loop.

Parameters:
NameTypeDescription
callbackfunction

Entity callback.

Overrides

flyExtent()

Fly extent.

getAttribution() → {string}

Gets layer attribution.

Returns:

Layer attribution.

Type: 
string

getEntities() → {Array.<Entity>}

Returns stored entities.

Returns:

Stored entities.

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() → {number}

Gets layer identifier.

Overrides
Returns:

Layer object id.

Type: 
number

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) → {Vector}

Adds entity to the layer in the index position.

Parameters:
NameTypeDescription
entityEntity

Entity.

indexNumber

Index position.

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 layer is the same instance as the input.

Type: 
boolean

(abstract) loadMaterial(material)

Start to load tile material.

Parameters:
NameTypeDescription
materialMaterial

Current material.

remove() → {Layer}

Removes from a 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 string that represents layer attribution.

setBaseLayer(isBaseLayer)

Sets base layer type flag.

Parameters:
NameTypeDescription
isBaseLayerboolean

setColor(color)

Parameters:
NameTypeDescription
colorstring

Layer color.

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.