Constructor
new VideoLayer()
Example
//构造地图对象
var map = new GeoGlobe.Map({
style: Cfg.style,
container: 'map',
zoom: 18,
bearing: -47,
pitch: 45,
units: "degrees",
center: [114.26734490525155, 30.594607628267966]
});
//构造THREE可视化图层
var threebox = new GeoGlobe.Visuals.Three();
//绑定鼠标点击事件
threebox.on('overlayerclick', function(e){
var xyz = threebox.unprojectFromWorld(e.param.pickedInfos[0].point);
alert(e.param.info.userData.attributes.OriginalData.properties.name + '\n经纬度及高程:' + xyz);
});
//绑定鼠标移动事件
threebox.on('overlayerhover', function(e){
console.info(e);
});
//添加到地图中
threebox.addTo(map);
//构造视频图层
var videoLayer = new GeoGlobe.Visuals.Three.VideoLayer({
id: 'video in 3D',
data: [
{"type":"Feature","properties":{"name": "一号视频","height": 40, "base_height": 50, "video_texture": "../../data/video.mp4"},"geometry":{"type":"LineString","coordinates":[[114.267589714434,30.593727684842285],[114.26679606746787,30.59349755409514]]}},
],
visible: true,
opacity: 1,
autoplay: true
});
//添加到THREE图层
videoLayer.addTo(threebox);
//绘制
threebox.render();
Members
autoplay :Boolean
- Default Value:
- true
是否自动播放
Type:
- Boolean
data :Array
数据
Type:
- Array
Example
[{
"type":"Feature",
"properties":{
"id": 100001,
"name":"1号视频",
"height":3,
"base_height":30,
"video_texture":'../../data/video.mp4' //视频纹理
},
"geometry":{
"type":"LineString",
"coordinates":[[114.267589714434,30.593727684842285],[114.26679606746787,30.59349755409514]]
}
}]
id :String
- Default Value:
- '1'
图层id
Type:
- String
opacity :Float
- Default Value:
- 1.0
透明度 0-1
Type:
- Float
visible :Boolean
- Default Value:
- true
可见性
Type:
- Boolean
Methods
addTo(three)
关联Three
Parameters:
Name | Type | Description |
---|---|---|
three |
GeoGlobe.Visuals.Three |
getBaseElevation(data) → {Int}
- Default Value:
- data.properties.base_height
建筑起始高程的GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
elevation - 返回起始高程值
- Type
- Int
getElevation(data) → {Int}
- Default Value:
- data.properties.height
建筑高程的GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
elevation - 返回高程值
- Type
- Int
getLine(data) → {Array}
- Default Value:
- data.geometry.coordinates
两点线的几何对象GET属性
Example
[[114.267589714434,30.593727684842285],[114.26679606746787,30.59349755409514]]
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
coordinates - 返回组成线的2点坐标数组
- Type
- Array
getVideoTexture(data) → {String}
- Default Value:
- data.properties.video_texture
视频纹理资源路径GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
uri - 视频路径
- Type
- String
play()
播放
remove()
从父对象中移除自己
render()
绘制
stop()
停止