SymbolLayer

GeoGlobe.Visuals.Three. SymbolLayer

3D模型符号图层

Constructor

new SymbolLayer()

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);
//构造符号图层,汽车模型 ,glTF格式
var symbolLayer2 = new GeoGlobe.Visuals.Three.SymbolLayer({
	id: '3D marker 2',
	data: [
		{"type": "Feature","properties": {"id": 10001, "name": "五号汽车","height": 0 }, "geometry": {"type": "Point","coordinates": [114.20257245367856, 30.773372078561778]}}
	],
	visible: true,
	opacity: 1,
	scale: 20,
	modelURL: "../../data/CesiumMilkTruck/CesiumMilkTruck.gltf",
	getGeometry: function(geometry, data){
	    geometry.rotateX((90/360)*2*Math.PI);
	    geometry.rotateY((-90/360)*2*Math.PI);
	    return geometry
	},
	getLoader: function(){
		return new THREE.GLTFLoader() //glTF versions >= 2.0
	}
})
//添加到THREE图层
symbolLayer2.addTo(threebox);
//绘制
threebox.render();

Members

autoplay :Boolean

Default Value:
  • false
是否自动播放模型动画
Type:
  • Boolean

data :Array

数据
Type:
  • Array
Example
[{
"type": "Feature",
"properties": {
		"id": 10001,
		"name": "五号汽车",
		"height": 0
	},
"geometry": {
		"type": "Point",
		"coordinates": [114.20257245367856, 30.773372078561778]
	}
}]

id :String

Default Value:
  • '1'
图层id
Type:
  • String

modelURL :String

Default Value:
  • ''
3D符号模型文件路径
Type:
  • String

opacity :Float

Default Value:
  • 1.0
透明度 0-1
Type:
  • Float

scale :Int

Default Value:
  • 1
缩放比例 1-~
Type:
  • Int

scale :Int

Default Value:
  • 1
缩放比例 1-~
Type:
  • Int

visible :Boolean

Default Value:
  • true
可见性
Type:
  • Boolean

Methods

addTo(three)

关联Three
Parameters:
Name Type Description
three GeoGlobe.Visuals.Three

getColor(data) → {String}

颜色GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Returns:
color - 颜色值
Type
String

getGeometry(geometry, data) → {Geometry}

几何对象GET属性
Parameters:
Name Type Description
geometry Geometry THREE.Geometry
data Feature geojson中的一个Feature
Returns:
geometry - 可对geometry平移旋转缩放后的
Type
Geometry

getLoader() → {Loader}

模型加载器GET属性
Example
return THREE.JSONLoader() //或
return THREE.GLTFLoader()
Returns:
loader
Type
Loader

getPosition(data) → {Array}

地理位置GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Returns:
point - [x,y,z]
Type
Array

redraw()

重绘但不重新加载模型

remove()

从父对象中移除自己

render()

绘制