Class: LineLayer

.Visuals.DeckGL. LineLayer

基于DeckGL的线图层

new LineLayer()

Author:
  • liuck
Source:
View2D/Visuals/DeckGL/LineLayer.js
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
Source:
View2D/Visuals/DeckGL/LineLayer.js
Example
[{
"type": "Feature",
"properties": {
		"id": 10001,
		"name": "1号线"
	},
"geometry": {
		"type": "LineString",
		"coordinates": [[114.27467721499235,30.61823619840472],[114.29877951124801,30.64353276353745]]
	}
}]

fp64 :Boolean

是否开启高精度64位模式
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/Visuals/DeckGL/LineLayer.js

id :String

图层id
Type:
  • String
Default Value:
  • '1'
Source:
View2D/Visuals/DeckGL/LineLayer.js

name :String

图层名称
Type:
  • String
Default Value:
  • ''
Source:
View2D/Visuals/DeckGL/LineLayer.js

pickable :Boolean

是否开启鼠标拾取
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/Visuals/DeckGL/LineLayer.js

visible :Boolean

可见性
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/Visuals/DeckGL/LineLayer.js

Methods


addTo(deckgl)

关联DeckGL
Parameters:
Name Type Description
deckgl GeoGlobe.Visuals.DeckGL
Source:
View2D/Visuals/DeckGL/LineLayer.js

getColor(data)

颜色GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • data.properties.color
Source:
View2D/Visuals/DeckGL/LineLayer.js
Returns:
[0, 0, 0, 255]
Type
Array

getInnerLayer()

获取deckgl内部layer实例
Source:
View2D/Visuals/DeckGL/LineLayer.js
Returns:
layer
Type
Object

getSourcePosition(data)

起始点GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • data.geometry.coordinates[0]
Source:
View2D/Visuals/DeckGL/LineLayer.js
Returns:
Type
Array

getStrokeWidth(data)

宽度GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • 1
Source:
View2D/Visuals/DeckGL/LineLayer.js
Returns:
1
Type
Int

getTargetPosition(data)

终止点GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • data.geometry.coordinates[1]
Source:
View2D/Visuals/DeckGL/LineLayer.js
Returns:
Type
Array

remove()

从父对象中移除自己
Source:
View2D/Visuals/DeckGL/LineLayer.js

render()

绘制
Source:
View2D/Visuals/DeckGL/LineLayer.js