GeoElementLayer

标绘元素图层

new Cesium.GeoElementLayer(options)

Name Type Description
options Object optional 参数选项:
Name Type Description
viewer viewer optional 三维地球
show Boolean optional 图层隐藏显示
dataSource DataSource optional 图层数据源对象,参见GeoDataSource
Author:
  • liuck
Example:
示例代码:
Demo:

Extends

Methods

addTo(map)

绑定到三维地图
Name Type Description
map viewer
Inherited From:

createElement(type, points, callback)

通过类型和几何创建标号
Name Type Description
type GeoElementType 元素标号类型
points Array xyz地理坐标点位,例如:[[113, 34, 100], [114, 40, 100]]
callback function 元素创建成功后的回调函数

createElementByFeature(geoElmentFeatrue)

通过要素创建元素标号
Name Type Description
geoElmentFeatrue Object 是GeoJSON中的feature结构的适当扩展属性节点的结构对象
Example:
//示例代码:
 var geoElmentFeatrue = {
            "type": "Feature",
            "properties": {
                "OID": "", //编号
                "classType": Cesium.GeoElementType.BILLBOARD, //类型
                "style": {
                    "image": "/geomap-api/JsCesuimDemo/resource/images/firesymbol.png",
                    "scale": 1.0,
                    "pixelOffset": [0, 0],
                    "horizontalOrigin": 0,
                    "verticalOrigin": 0,
                    "width": 36,
                    "height": 36
                }, //样式                
                "controlGeometry": null, //控制点,一般为多点集合,点标号类型时为空值
                "name": "", //元素名称
                "visible": true, //可见性
                "color": "red", //颜色
                "transparent": 1, //透明度
                "property": {}, //其他属性
                "objectKey": "", //对象标识
                "parentID": "", //父元素ID
                "deleted": false, //是否已删除
                "order": 0, //元素排序
                "updateTime": Date //更新时间
            },
            "geometry": { "type": "Point", "coordinates": [114.284, 30.552, 0] } //几何
        }
        geoElementLayer.createElementByFeature(geoElmentFeatrue);

createGroupObject(geoElmentFeatrues)

创建组合标号
Name Type Description
geoElmentFeatrues Object 是GeoJSON中的feature结构的适当扩展属性节点的结构对象的数组

destroy()

销毁图层对象

getAnimationsByElement(el)Array.<Animation>

获取标绘要素对应的动画对象
Name Type Description
el Object 标绘要素
Returns:
animations 动画对象数组

getData()

获取图层数据
Inherited From:

getDataSource()

获取数据源
Inherited From:

getElementByObjectKey(objectKey)

根据objectKey查找对应标绘元素
Name Type Description
objectKey Object 标绘元素objectKey

hide()

设置图层隐藏
Inherited From:

pickFeatures(pickedFeatures, windowPosition, geographicPosition, eventType)Object

拾取图层中的要素
Name Type Description
pickedFeatures Array 场景中被拾取的对象集合,需要在图层自己内部判断识别出属于自己的,并挂接上图层的属性信息
windowPosition Cartesian2 画布的二维坐标
geographicPosition Object 地理位置,{ lng: lng, lat: lat, height: height }
eventType ScreenSpaceEventType 事件类型
Returns:
返回固定形态的结构数据
Example:
//返回结构参考样例
{
	houseCode: fwCode,
	floorCode: floor,
	eventType: ScreenSpaceEventType.LEFT_CLICK,
	originalLayer: geoSingleBuildingLayer,
	param:{
		info: pickedFeature,
		pickedInfos: pickedFeatureList
	}
}

remove(element)

删除图层中图元,如无指定图元则清空图层
Name Type Description
element Object

removeDataSource()

移除数据源
Inherited From:

render()

渲染

setData(data)

设置图层数据
Name Type Description
data Object 是GeoJSON中的feature结构的适当扩展属性节点的结构对象的数组
Example:
var data = [
 //广告牌元素符号,point的geometry,广告牌。
 { "type": "Feature", "properties": { "name": "XXX", "value": 0, "elementType": "BILLBOARD", "style": { } }, "geometry": { "type": "Point", "coordinates": [ x, y, z ] } },
 //单箭头标号,polygon的geometry,controlPoints控制点属性。
 { "type": "Feature", "properties": { "name": "XXX", "value": 0, "elementType": "SINGLEARROW", "style": { }, "controlGeometry": [[100.0, 0.0], [101.0, 1.0]]  }, "geometry": { "type": "Polygon", "coordinates": [ [ [ x1, y1, z1 ], [ x2, y2, z2], ..., [ xn, yn, zn ] ] ] } },
]

setDataSource(dataSource)

设置数据源
Name Type Description
dataSource GeoDataSource

show()

设置图层显示
Inherited From:

unGroupObject(geoElmentFeatrues)

拆分组合对象
Name Type Description
geoElmentFeatrues Object 是GeoJSON中的feature结构的适当扩展属性节点的结构对象的数组