Categorize overlay elements with the same business logic or attributes for the same management
The base class of the layer, its subclasses are instantiated and need to be added to the 3D scene in order to display all kinds of 3D data
:::warning This basic class cannot be instantiated :::
{String} id
readonly
{Boolean} show
{Object} attr
:Business Properties{String} state
readonly
{String} type
readonly
addOverlay(overlay)
{Overlay} overlay
this
addOverlays(overlays)
{Array<Overlay>} overlays
this
removeOverlay(overlay)
{Overlay} overlay
this
getOverlay(overlayId)
{String} overlayId
overlay
getOverlayById(Id)
{String} Id
overlay
getOverlaysByAttr(attrName, attrVal)
{String} attrName
{Object} attrVal
array
overlay.attr.name = 'test'
let arr = layer.getOverlaysByAttr('name', 'test')
getOverlays()
array
eachOverlay(method, context)
{Function} method
:Callback function with parameters for overlay{Object} context
this
layer.eachOverlay((item) => {})
clear()
this
remove()
this
addTo(viewer)
{Viewer|World} viewer
:场景this
on(type, callback, context)
Event Subscription
{Object} type
{Function} callback
{Object} context
returns this
off(type, callback, context)
Event Unsubscribe
{Object} type
{Function} callback
{Object} context
returns this
fire(type,params)
{Object} type
{Object} params
this
registerType(type)
{String} type
getLayerType()
string
Layer groups, grouping layers according to a certain logic to facilitate unified management
let layerGroup = new DC.LayerGroup('id')
viewer.addLayerGroup(layerGroup)
let layer = new DC.VectorLayer('layer')
layerGroup.addLayer(layer)
constructor(id)
{String} id
layerGroup
{String} id
readonly
{Boolean} show
{String} type
readonly
addLayer(layer)
{Layer} layer
this
removeLayer(layer)
{Layer} layer
this
getLayer(id)
{String} id
layer
getLayers()
layer
remove()
this
addTo(viewer)
{Viewer|World} viewer
:场景this
Vector layer, used to add all kinds of vector data (points, lines, surfaces, etc.), grouping vector data according to a certain logic to facilitate unified management, inherited from Layer
let layer = new DC.VectorLayer('id')
viewer.addLayer(layer)
constructor(id)
{String} id
vectorLayer
Dynamic layer, used to add all kinds of dynamic data (billboard、model etc.), grouping vector data according to a certain logic to facilitate unified management, inherited from Layer
let layer = new DC.DynamicLayer('id')
viewer.addLayer(layer)
constructor(id)
{String} id
vectorLayer
The primitive layer, which is used to add all kinds of primitive data, group the primitive data in a certain logic to facilitate unified management, inherited from Layer
let layer = new DC.PrimitiveLayer('id')
viewer.addLayer(layer)
constructor(id)
{String} id
primitiveLayer
The ground primitive layer, which is used to add all kinds of ground primitive data, group the ground primitive data in a certain logic to facilitate unified management, inherited from Layer
let layer = new DC.GroundPrimitiveLayer('id')
viewer.addLayer(layer)
constructor(id)
{String} id
groundPrimitiveLayer
3dTiles layer, used to add 3dTiles model data, inherits fromLayer
let layer = new DC.TilesetLayer('id')
viewer.addLayer(layer)
constructor(id)
{String} id
tilesetLayer
GeoJson layer, used to load GeoJson data, inherited from Layer,
let layer = new DC.GeoJsonLayer('id', '**/**.geojson')
layer.eachOverlay((item) => {
// item is an entity,
if (item.polyline) {
//todo
let polyline = DC.Polyline.fromEntity(item)
}
if (item.polygon) {
//todo
let polygon = DC.Polygon.fromEntity(item)
}
if (item.billboard) {
//todo
let point = DC.Point.fromEntity(item)
let divIcon = DC.DivIcon.fromEntity(item)
let billboard = DC.Billboard.fromEntity(item)
}
})
constructor(id,url,[options])
{String} id
{String} url
{Object} options
GeoJsonDataSourcegeoJsonLayer
toVectorLayer()
vectorLayer
toModelLayer(modelUrl)
{String} modelUrl
vectorLayer
TopoJson layer, used to load TopoJson data, inherited from Layer,
let layer = new DC.GeoJsonLayer('id', '**/**.geojson')
layer.eachOverlay((item) => {
// item is an entity,
if (item.polyline) {
//todo
let polyline = DC.Polyline.fromEntity(item)
}
if (item.polygon) {
//todo
let polygon = DC.Polygon.fromEntity(item)
}
if (item.billboard) {
//todo
let point = DC.Point.fromEntity(item)
let divIcon = DC.DivIcon.fromEntity(item)
let billboard = DC.Billboard.fromEntity(item)
}
})
constructor(id,url,[options])
{String} id
{String} url
{Object} options
GeoJsonDataSourcetopoJsonLayer
toVectorLayer()
vectorLayer
toModelLayer(modelUrl)
{String} modelUrl
vectorLayer
Html layer for loading DivIcon nodes, inherited from Layer,
let layer = new DC.HtmlLayer('dom')
viewer.addLayer(layer)
DC.HtmlLayer 构造函数
{String} id
:图层唯一标识htmlLayer
Czml layer for loading Czml data, inherited from Layer
let layer = new DC.CzmlLayer('id', '**/**.czml')
layer.eachOverlay((item) => {
if (item.polyline) {
//todo
}
if (item.polygon) {
//todo
}
if (item.billboard) {
//todo
}
})
constructor(id,url,[options])
{String} id
{String} url
{Object} options
CzmlDataSourceczmlLayer
Kml layer for loading Kml data, inherited from Layer
let layer = new DC.KmlLayer('id', '**/**.kml')
layer.eachOverlay((item) => {
if (item.polyline) {
//todo
}
if (item.polygon) {
//todo
}
if (item.billboard) {
//todo
}
})
constructor(id,url,[options])
{String} id
{String} url
{Object} options
KmlDataSourcekmlLayer
Gpx layer for loading gpx data, inherited from Layer
let layer = new DC.GpxLayer('id', '**/**.gpx')
constructor(id,url,[options])
{String} id
{String} url
{Object} options
GpxDataSourcegpxLayer
Inherited from Layer
let layer = new DC.ClusterLayer('id')
viewer.addLayer(layer)
constructor(id,[options])
{String} id
{Object} options
clusterLayer
{
"size": 48,
"pixelRange": 40,
"gradient": {
"0.0001": DC.Color.DEEPSKYBLUE,
"0.001": DC.Color.GREEN,
"0.01": DC.Color.ORANGE,
"0.1": DC.Color.RED
},
"style": "circle", // circle or clustering
"fontSize": 12,
"fontColor": DC.Color.BLACK
}
Inherited from Layer
let layer = new DC.HeatLayer('id')
viewer.addLayer(layer)
constructor(id,[options])
{String} id
{Object} options
heatLayer
//options(optional)
{
"gradient": {
"0.5": "green",
"0.6": "orange",
"0.95": "red"
},
"height": 0,
"radius": 30,
"useGround": false,
"classificationType": 2 // only use for "useGround" is true
}
setPositions(positions)
{Array<Object>} positions
heatLayer
{
"lng": "",
"lat": "",
"value": 1
}
addPosition(position)
{Object} position
heatLayer
{
"lng": "",
"lat": "",
"value": 1
}
Inherited from Layer
let layer = new DC.WindLayer('id')
viewer.addLayer(layer)
constructor(id,[options])
{String} id
{Object} options
windLayer
//options(optional)
{
"globalAlpha": 0.9,
"lineWidth": 1,
"colorScale": "#fff",
"velocityScale": 1 / 25,
"maxAge": 90,
"paths": 800,
"frameRate": 20,
"useCoordsDraw": true,
"gpet": true
}
setData(data,[options])
{Object} data
{Object} options
windLayer
setOptions(options)
{Object} options
windLayer
SInherited from Layer
let layer = new DC.S3MLayer('id','**.scp')
viewer.addLayer(layer)
constructor(id,url,[options])
{String} id
{String} url
{Object} options
windLayer
//options(optional)
{
"maxVisibleDistance":Number.MAX_VALUE,
"minVisibleDistance":0,
}