Three

GeoGlobe.Visuals. Three

基于ThreeJS的可视化图层。

Constructor

new Three()

Author:
  • liuck
Example
//构造地图对象
 var map = new GeoGlobe.Map({
    style: Cfg.style,
    container: 'map',
    zoom: 16,
    bearing: -138.23,
	pitch: 57.50,
    units: "degrees",
    center: [114.20509630753577, 30.776055193053764]
});
 //构造THREE可视化图层
 var threebox = new GeoGlobe.Visuals.Three();
 //添加到地图中
 threebox.addTo(map);
 //绑定鼠标点击事件
 threebox.on('overlayerclick', function(e){
	alert(e.param.info.userData.attributes.OriginalData.aliasName);
});
 //绑定鼠标移动事件
 threebox.on('overlayerhover', function(e){
	console.info(e);
})
 //绘制
 threebox.render();

Classes

Base
BrightkiteLayer
BuildingLayer
CurveLayer
LineLayer
ModelLayer
PointLayer
PolygonLayer
RainLayer
SingleBuildingLayer
SnowLayer
SymbolLayer
TextLayer
VideoLayer

Members

container :Object

map的容器
Type:
  • Object

layers :Array

图层容器
Type:
  • Array

map :GeoGlobe.Map

Default Value:
  • null
地图对象
Type:

type :String

Default Value:
  • 'three'
可视化图层类别
Type:
  • String

Methods

addLayer(layer)

向threejs可视化图层中添加子图层
Parameters:
Name Type Description
layer Object Three命名空间下的子图层对象

addTo(map)

与gl地图对象关联
Parameters:
Name Type Description
map Object gl地图对象

getLayer(id) → {Object}

获取指定id图层
Parameters:
Name Type Description
id string 图层id.
Returns:
Layer
Type
Object

moveLayer(id, before)

移动图层
Parameters:
Name Type Description
id String 要移动的图层的ID
before String 之前插入新图层的现有图层的ID。如果省略此参数,则新图层将移动到最上层

remove()

移除图层容器

removeLayer(id)

移除图层
Parameters:
Name Type Description
id string 图层id

render()

绘制图层,包含子图层

unprojectFromWorld(point) → {Array}

通过webgl世界坐标系坐标反算地理坐标,例如点击建筑物获取高度及其经纬度
Example
//绑定鼠标点击事件
     threebox.on('overlayerclick', function(event){
			if(event && event.param && event.param.pickedInfos){
		    	var xyz = threebox.unprojectFromWorld(event.param.pickedInfos[0].point);
			}
		});
Parameters:
Name Type Description
point Point {x:15.145329754799604, y:-73.6837176498957, z:240.09772653562322}
Returns:
xyz
Type
Array