new PointLayer()
点图层
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 pointLayer = new GeoGlobe.Visuals.Three.PointLayer({
id: '3D point',
data: [{"type":"Feature","properties":{"name": "一号点","size": 600, color: "skyblue"},"geometry":{"type":"Point","coordinates":[114.27467721499235,30.61823619840472,19.61132758430084]}},
{"type":"Feature","properties":{"name": "二号点","size": 300, color: "rgb(255, 120, 0)"},"geometry":{"type":"Point","coordinates":[114.29877951124801,30.64353276353745,504.0792309408988]}},
{"type":"Feature","properties":{"name": "三号点","size": 400, color: "0xf000f0"},"geometry":{"type":"Point","coordinates":[114.30891430616117,30.627087672503677,574.7427843331463]}},
{"type":"Feature","properties":{"name": "四号点","size": 500, color: "hsl(0, 100%, 50%)"},"geometry":{"type":"Point","coordinates":[114.30712328993215,30.63381498764412,873.3612366333414]}},
{"type":"Feature","properties":{"name": "五号点","size": 1200, texture: "../../images/snowflake2.png"},"geometry":{"type":"Point","coordinates":[114.24294237237757,30.6023344482078,614.1713466047934]}}],
visible: true,
opacity: 1
});
//添加到THREE图层
pointLayer.addTo(threebox);
//绘制
threebox.render();
Members
data :Array
数据
Type:
- Array
Example
[{
"type":"Feature",
"properties":{
"id": 100001,
"name":"",
"size":100,
"color":"#ddd", //颜色纹理。如果没有纹理图片时,则有效。 图片纹理优先于颜色纹理。
"texture":'assets/textures/building.png' //图片纹理,顶部纹理
},
"geometry":{
"type":"Point",
"coordinates":[114.27731517981033,30.597299735680195,0]
}
}]
id :String
- Default Value:
- '1'
图层id
Type:
- String
opacity :Number
- Default Value:
- 1.0
透明度 0-1
Type:
- Number
options :Object
参数对象
Type:
- Object
Example
{
id: 'brightkite',
tiles: '../../images/sprites/snowflake.png',
tileSize: 256,
visible: true,
pickable: true,
opacity: 1
}
options :Object
参数对象
Type:
- Object
Example
{
id: 'rain',
texture: '../../images/sprites/rain.png',
size: 10,
visible: true,
pickable: true,
opacity: 1
}
options :Object
参数对象
Type:
- Object
Example
{
id: 'snow',
texture: '../../images/sprites/snowflake.png',
size: 10,
visible: true,
pickable: true,
opacity: 1
}
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
getPoint(data) → {Array}
点几何对象GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
coordinates - 返回点的坐标数组
- Type
- Array
getSize(data) → {Number}
点尺寸的GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
size - 尺寸值
- Type
- Number
getTexture(data) → {String}
纹理图片资源路径GET属性
Parameters:
Name | Type | Description |
---|---|---|
data |
Feature | geojson中的一个Feature |
Returns:
texture - 图片纹理资源路径
- Type
- String
remove()
从父对象中移除自己
render()
绘制