Class: VideoLayer

.Visuals.Three. VideoLayer

视频图层,垂直于地面。

new VideoLayer()

Author:
  • liuck
Source:
View2D/Visuals/Three/VideoLayer.js
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

是否自动播放
Type:
  • Boolean
Default Value:
  • true
Source:
View2D/Visuals/Three/VideoLayer.js

data :Array

数据
Type:
  • Array
Source:
View2D/Visuals/Three/VideoLayer.js
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

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

opacity :Float

透明度 0-1
Type:
  • Float
Default Value:
  • 1.0
Source:
View2D/Visuals/Three/VideoLayer.js

visible :Boolean

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

Methods


addTo(three)

关联Three
Parameters:
Name Type Description
three GeoGlobe.Visuals.Three
Source:
View2D/Visuals/Three/VideoLayer.js

getBaseElevation(data)

建筑起始高程的GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • data.properties.base_height
Source:
View2D/Visuals/Three/VideoLayer.js
Returns:
elevation - 返回起始高程值
Type
Int

getElevation(data)

建筑高程的GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • data.properties.height
Source:
View2D/Visuals/Three/VideoLayer.js
Returns:
elevation - 返回高程值
Type
Int

getLine(data)

两点线的几何对象GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • data.geometry.coordinates
Source:
View2D/Visuals/Three/VideoLayer.js
Returns:
coordinates - 返回组成线的2点坐标数组
Type
Array
Example
[[114.267589714434,30.593727684842285],[114.26679606746787,30.59349755409514]]

getVideoTexture(data)

视频纹理资源路径GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Default Value:
  • data.properties.video_texture
Source:
View2D/Visuals/Three/VideoLayer.js
Returns:
uri - 视频路径
Type
String

play()

播放
Source:
View2D/Visuals/Three/VideoLayer.js

remove()

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

render()

绘制
Source:
View2D/Visuals/Three/VideoLayer.js

stop()

停止
Source:
View2D/Visuals/Three/VideoLayer.js