PolygonLayer

GeoGlobe.Visuals.Three. PolygonLayer

new PolygonLayer()

多边形图层
Example
//构造地图对象
 var map = new GeoGlobe.Map({
    style: Cfg.style,
    container: 'map',
    zoom: 16,
    bearing: -47,
	pitch: 45,
    units: "degrees",
    center: [114.26734490525155, 30.594607628267966]
});
 //构造THREE可视化图层
 var threebox = new GeoGlobe.Visuals.Three();
 //添加到地图中
 threebox.addTo(map);
 //构造点图层
 var polygonLayer = new GeoGlobe.Visuals.Three.PolygonLayer({
	id: '3D point',
    data: [{"type":"Feature","properties":{"name": "一号多边形", color: "skyblue"},"geometry":{"type":"Polygon","coordinates":[]}},
            {"type":"Feature","properties":{"name": "二号多边形", color: "rgb(255, 120, 0)"},"geometry":{"type":"Polygon","coordinates":[]}}],
    visible: true,
    opacity: 1
});
 //添加到THREE图层
 polygonLayer.addTo(threebox);
 //绘制
 threebox.render();

Members

data :Array

数据
Type:
  • Array
Example
[{
	"type":"Feature",
	"properties":{
		"id": 100001,
		"name":"",
		"color":"#ddd", //颜色纹理。如果没有纹理图片时,则有效。 图片纹理优先于颜色纹理。
		"texture":'assets/textures/building.png' //图片纹理,顶部纹理
	},
	"geometry":{
		"type":"Polygon",
		"coordinates":[]
	}
}]

id :String

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

opacity :Number

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

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

getPolygon(data) → {Array}

多边形几何对象GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Returns:
coordinates - 返回面的坐标数组
Type
Array

getTexture(data) → {String}

纹理图片资源路径GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Returns:
texture - 图片纹理资源路径
Type
String

remove()

从父对象中移除自己

render()

绘制