Constructor
new ThingLayer(param)
构造函数
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
param |
Object |
Properties
|
Example
var thingLayer = app.create({
type: 'ThingLayer',
name: 'thingLayer1'
});
var geoPoint = app.create({
type: 'GeoPoint',
name: 'geoPoint',
coordinates: [116.39, 39.96],
userData:{'cityName':'Beijing'},
renderer:{
type: 'image',//image代表创建图片类型的点
url:'image/uGeo/pop.png',//图片的url
size:10 //尺寸
}
});
thingLayer.add(geoPoint);//将一个点加到ThingLayer中
map.userLayers.add(thingLayer);//ThingLayer加到Map中
Extends
Members
(readonly) objects :Array
图层中所有的对象
Type:
- Array
- Inherited From:
offsetHeight :Number
离地高度 单位:米
Type:
- Number
- Inherited From:
Example
featureLayer.offsetHeight = 200; //设置离地高度200米
offsetHeightField :String
离地高度的字段
Type:
- String
- Inherited From:
Example
featureLayer.offsetHeightField = 'height'; //根据height字段设置离地高度
Methods
add(obj)
添加对象到Layer
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | 要添加到图层中的对象 GeoPoint,GeoLine,GeoBuilding,GeoPolygon,Marker,Thing,Campus等等 |
Example
var geoPoint = app.create({
type: 'GeoPoint',
name: 'geoPoint',
coordinates: [116.39, 39.96],
userData:{'cityName':'Beijing'},
renderer:{
type: 'image',//image代表创建图片类型的点
url:'image/uGeo/pop.png',//图片的url
size:10 //尺寸
}
});
thingLayer.add(geoPoint);
remove(obj)
删除Layer中指定的对象
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | 图层中的对象 |
Example
thingLayer.remove(geoPoint);//geoPoint是thingLayer中的一个对象
removeAll()
删除layer下的所有对象
setVisible(value, effectChildren)
设置图层可见
对于图层来说,如果仅仅设置图层本身节点的visible,第二个参数传false,如果需要影响图层内各要素的visible,第二个参数传true
注:如果图层内要素visible为true 而图层本身的visible是false 这个要素是不会被显示的
Parameters:
Name | Type | Description |
---|---|---|
value |
Boolean | 是否可见 |
effectChildren |
Boolean | 是否影响图层内要素 |
- Inherited From: