Class: SymbolLayer

.Visuals.Three. SymbolLayer

3D模型符号图层

new SymbolLayer()

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

是否自动播放模型动画
Type:
  • Boolean
Default Value:
  • false
Source:
View2D/Visuals/Three/SymbolLayer.js

data :Array

数据
Type:
  • Array
Source:
View2D/Visuals/Three/SymbolLayer.js
Example
[{
"type": "Feature",
"properties": {
		"id": 10001,
		"name": "五号汽车",
		"height": 0
	},
"geometry": {
		"type": "Point",
		"coordinates": [114.20257245367856, 30.773372078561778]
	}
}]

id :String

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

modelURL :String

3D符号模型文件路径
Type:
  • String
Default Value:
  • ''
Source:
View2D/Visuals/Three/SymbolLayer.js

opacity :Float

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

scale :Int

缩放比例 1-~
Type:
  • Int
Default Value:
  • 1
Source:
View2D/Visuals/Three/SymbolLayer.js

scale :Int

缩放比例 1-~
Type:
  • Int
Default Value:
  • 1
Source:
View2D/Visuals/Three/TextLayer.js

visible :Boolean

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

Methods


addTo(three)

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

getColor(data)

颜色GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Source:
View2D/Visuals/Three/SymbolLayer.js
Returns:
color - 颜色值
Type
String

getGeometry(geometry, data)

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

getLoader()

模型加载器GET属性
Source:
View2D/Visuals/Three/SymbolLayer.js
Returns:
loader
Type
Loader
Example
return THREE.JSONLoader() //或
return THREE.GLTFLoader()

getPosition(data)

地理位置GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Source:
View2D/Visuals/Three/SymbolLayer.js
Returns:
point - [x,y,z]
Type
Array

redraw()

重绘但不重新加载模型
Source:
View2D/Visuals/Three/SymbolLayer.js

remove()

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

render()

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