new PolygonLayer()
多边形图层
- Source:
- View2D/Visuals/Three/PolygonLayer.js
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
- Source:
- View2D/Visuals/Three/PolygonLayer.js
Example
[{ "type":"Feature", "properties":{ "id": 100001, "name":"", "color":"#ddd", //颜色纹理。如果没有纹理图片时,则有效。 图片纹理优先于颜色纹理。 "texture":'assets/textures/building.png' //图片纹理,顶部纹理 }, "geometry":{ "type":"Polygon", "coordinates":[] } }] -
id :String
-
图层id
Type:
- String
- Default Value:
-
- '1'
- Source:
- View2D/Visuals/Three/PolygonLayer.js
-
opacity :Number
-
透明度 0-1
Type:
- Number
- Default Value:
-
- 1.0
- Source:
- View2D/Visuals/Three/PolygonLayer.js
-
visible :Boolean
-
可见性
Type:
- Boolean
- Default Value:
-
- true
- Source:
- View2D/Visuals/Three/PolygonLayer.js
Methods
-
addTo(three)
-
关联Three
Parameters:
Name Type Description threeGeoGlobe.Visuals.Three - Source:
- View2D/Visuals/Three/PolygonLayer.js
-
getColor(data)
-
颜色GET属性
Parameters:
Name Type Description dataFeature geojson中的一个Feature - Source:
- View2D/Visuals/Three/PolygonLayer.js
Returns:
color - 颜色值- Type
- String
-
getPolygon(data)
-
多边形几何对象GET属性
Parameters:
Name Type Description dataFeature geojson中的一个Feature - Source:
- View2D/Visuals/Three/PolygonLayer.js
Returns:
coordinates - 返回面的坐标数组- Type
- Array
-
getTexture(data)
-
纹理图片资源路径GET属性
Parameters:
Name Type Description dataFeature geojson中的一个Feature - Source:
- View2D/Visuals/Three/PolygonLayer.js
Returns:
texture - 图片纹理资源路径- Type
- String
-
remove()
-
从父对象中移除自己
- Source:
- View2D/Visuals/Three/PolygonLayer.js
-
render()
-
绘制
- Source:
- View2D/Visuals/Three/PolygonLayer.js