Constructor
new LineLayer()
Example
//构造地图对象
var map = new GeoGlobe.Map({
style: Cfg.style,
container: 'map',
zoom: 4.5,
bearing: 27.2,
pitch: 50,
units: "degrees",
center: [-0.244029,51.517662]
});
//构造DeckGL可视化图层
var deckgl = new GeoGlobe.Visuals.DeckGL();
//绑定初始构建事件
deckgl.on('overlayerinit', function(o){
o.param.enable(o.param.DEPTH_TEST);
o.param.depthFunc(o.param.LEQUAL);
});
//绑定鼠标点击事件
deckgl.on('overlayerclick', function(e,a,b){
});
//绑定鼠标移动事件
deckgl.on('overlayerhover', function(o,a,b){
})
//添加到地图中
deckgl.addTo(map);
//构造图层
var lineLayer = new GeoGlobe.Visuals.DeckGL.LineLayer({
id: 'line-layer',
data: [
{ "type": "Feature", "properties": {}, "geometry": { "type": "LineString", "coordinates": [[114.27467721499235,30.61823619840472],[114.29877951124801,30.64353276353745]] } }
],
visible: true,
pickable: true,
fp64: false,
opacity: 0.6,
strokeWidth: 10,
getColor: function(){return [255,0,0]}
});
//添加到DeckGL图层
lineLayer.addTo(deckgl);
//绘制
deckgl.render();
Members
data :Array
geojson结构
Type:
- Array
Example
[{
"type": "Feature",
"properties": {
"id": 10001,
"name": "1号线"
},
"geometry": {
"type": "LineString",
"coordinates": [[114.27467721499235,30.61823619840472],[114.29877951124801,30.64353276353745]]
}
}]
fp64 :Boolean
- Default Value:
- true
是否开启高精度64位模式
Type:
- Boolean
id :String
- Default Value:
- '1'
图层id
Type:
- String
name :String
- Default Value:
- ''
图层名称
Type:
- String
pickable :Boolean
- Default Value:
- true
是否开启鼠标拾取
Type:
- Boolean
visible :Boolean
- Default Value:
- true
可见性
Type:
- Boolean
Methods
addTo(deckgl)
关联DeckGL
Parameters:
Name | Type | Description |
---|---|---|
deckgl |
GeoGlobe.Visuals.DeckGL |
getColor(data) → {Array}
- Default Value:
- data.properties.color
颜色GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
[0, 0, 0, 255]
- Type
- Array
getInnerLayer() → {Object}
获取deckgl内部layer实例
Returns:
layer
- Type
- Object
getSourcePosition(data) → {Array}
- Default Value:
- data.geometry.coordinates[0]
起始点GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
- Type
- Array
getStrokeWidth(data) → {Int}
- Default Value:
- 1
宽度GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
1
- Type
- Int
getTargetPosition(data) → {Array}
- Default Value:
- data.geometry.coordinates[1]
终止点GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
- Type
- Array
remove()
从父对象中移除自己
render()
绘制