new TrackLayer()
- Source:
- View2D/Visuals/DeckGL/TrackLayer.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 trackLayer = new GeoGlobe.Visuals.DeckGL.TrackLayer({ id: 'track-layer', data: [ {"type": "Feature", "properties": {"id": 10001, "name": "轨迹点1", "time": "2018-11-01 09:00"}, "geometry": {"type": "Point", "coordinates": [114.20257245367856, 30.073372078561778]}}, {"type": "Feature", "properties": {"id": 10002, "name": "轨迹点2", "time": "2018-11-01 09:10"}, "geometry": {"type": "Point", "coordinates": [114.30257245367856, 30.673372078561778]}}, {"type": "Feature", "properties": {"id": 10003, "name": "轨迹点3", "time": "2018-11-01 09:20"}, "geometry": {"type": "Point", "coordinates": [114.40257245367856, 30.273372078561778]}} ], visible: true, pickable: true, fp64: false, opacity: 0.6, strokeWidth: 5, getColor: function (d) { if (d.properties.T === 0) {//不播放 return [50, 50, 50]; } else if (d.properties.T === 1) {//已播放 return [200, 200, 200]; } else if (d.properties.T === 2) {//待播放 return [35, 152, 255]; } } }); //添加到DeckGL图层 trackLayer.addTo(deckgl); //绘制 deckgl.render();
Members
-
data :Array
-
geojson结构
Type:
- Array
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
Example
[ {"type": "Feature", "properties": {"id": 10001, "name": "轨迹点1", "time": "2018-11-01 09:00"}, "geometry": {"type": "Point", "coordinates": [114.20257245367856, 30.073372078561778]}}, {"type": "Feature", "properties": {"id": 10002, "name": "轨迹点2", "time": "2018-11-01 09:10"}, "geometry": {"type": "Point", "coordinates": [114.30257245367856, 30.673372078561778]}}, {"type": "Feature", "properties": {"id": 10003, "name": "轨迹点3", "time": "2018-11-01 09:20"}, "geometry": {"type": "Point", "coordinates": [114.40257245367856, 30.273372078561778]}} ]
-
fp64 :Boolean
-
是否开启高精度64位模式
Type:
- Boolean
- Default Value:
-
- true
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
id :String
-
图层id
Type:
- String
- Default Value:
-
- '1'
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
name :String
-
图层名称
Type:
- String
- Default Value:
-
- ''
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
opacity :Number
-
轨迹的不透明度
Type:
- Number
- Default Value:
-
- 1
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
pickable :Boolean
-
是否开启鼠标拾取
Type:
- Boolean
- Default Value:
-
- true
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
rounded :Boolean
-
轨迹斜接处是否圆角
Type:
- Boolean
- Default Value:
-
- false
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
visible :Boolean
-
可见性
Type:
- Boolean
- Default Value:
-
- true
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
Methods
-
addTo(deckgl)
-
关联DeckGL
Parameters:
Name Type Description deckgl
GeoGlobe.Visuals.DeckGL - Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
getColor(data)
-
单条线段颜色GET属性
Parameters:
Name Type Description data
Feature geojson中的一个Feature - Default Value:
-
- data.properties.color
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
Returns:
[0, 0, 0, 255]- Type
- Array
-
getDashArray(data)
-
单条线段绘制为实线/虚线
Parameters:
Name Type Description data
Feature geojson中的一个Feature - Default Value:
-
- [0, 0]
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
Returns:
[0, 0]- Type
- Array
-
getInnerLayer()
-
获取deckgl内部layer实例
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
Returns:
layer- Type
- Object
-
getPath(data)
-
单条轨迹线段GET属性
Parameters:
Name Type Description data
Feature geojson中的一个Feature - Default Value:
-
- data.geometry.coordinates
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
Returns:
- Type
- Array
-
getWidth(data)
-
单条线段宽度GET属性
Parameters:
Name Type Description data
Feature geojson中的一个Feature - Default Value:
-
- 1
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
Returns:
1- Type
- Number
-
initialize(options)
-
构造函数
Parameters:
Name Type Description options
Object 参数对象 - Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
remove()
-
从父对象中移除自己
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
render()
-
绘制
- Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
setData(data)
-
更新轨迹数据
Parameters:
Name Type Description data
Array 轨迹数据 - Source:
- View2D/Visuals/DeckGL/TrackLayer.js
-
setRange(startTime, endTime)
-
设置轨迹的时间范围
Parameters:
Name Type Description startTime
Number 起始时间戳 endTime
Number 终止时间戳 - Source:
- View2D/Visuals/DeckGL/TrackLayer.js