CurveLayer

GeoGlobe.Visuals.Three. CurveLayer

弧线图层,绘制三维空间的二次贝塞尔曲线

Constructor

new CurveLayer()

Author:
  • kz
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 curveLayer = new GeoGlobe.Visuals.Three.CurveLayer({
	id: '3D curve',
    data: [{
        "type": "Feature",
        "properties": {"name": "武汉->莫斯科", "width": 1, "curveness": 0.8, "color": "red"},
        "geometry": {
            "type": "LineString",
            "coordinates": [[114.2578125, 30.600093873550072], [37.6171875, 55.751849391735284]]
        }
    },{
        "type": "Feature",
        "properties": {"name": "开普敦->莫斯科", "width": 5, "curveness": 0.2, "color": "green"},
        "geometry": {
            "type": "LineString",
            "coordinates": [[18.45703125, -33.925129700071984], [37.6171875, 55.751849391735284]]
        }
    },{
        "type": "Feature",
        "properties": {"name": "洛杉矶->纽约->巴黎->莫斯科", "width": 3, "curveness": 0.3, "color": "yellow"},
        "geometry": {
            "type": "LineString",
            "coordinates": [[-118.21289062499999, 34.05265942137599], [-74.00390625, 40.730608477796636], [2.373046875, 48.86471476180277], [37.6171875, 55.751849391735284]]
        }
    }],
    texture: '../../images/lensflare.png',
    visible: true
});
 //添加到THREE图层
 curveLayer.addTo(threebox);
 //绘制
 threebox.render();

Members

data :Array

数据
Type:
  • Array
Example
[{
	"type":"Feature",
	"properties":{
		"id": 100001,
		"name":"",
		"width":1,
		"color":"#ddd", //颜色纹理。如果没有纹理图片时,则有效。 图片纹理优先于颜色纹理。
		"texture":'' //图片纹理,顶部纹理
	},
	"geometry":{
		"type":"LineString",
		"coordinates":[[114.27467721499235,30.61823619840472,19.61132758430084],[114.29877951124801,30.64353276353745,504.0792309408988]]
	}
}]

id :String

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

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

getCurveness(data) → {Number}

线曲度的GET属性(0-1)
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Returns:
curveness - 线曲度值
Type
Number

getLineString(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

getWidth(data) → {Number}

线宽度的GET属性
Parameters:
Name Type Description
data Feature geojson中的一个Feature
Returns:
size - 线宽值
Type
Number

remove()

从父对象中移除自己

render()

绘制