FeatureLayer

矢量图层。


矢量效果图

new CooWasm.FeatureLayer(props, callback)

Name Type Default Description
props Object

包含如下属性的Object:

Name Type Default Description
url String

WFS服务根路径。

layerName String

图层名称,通常格式为: xx:xxx。

version String 2.0.0 optional

WFS协议版本,通常为1.0.0/1.1.0/2.0.0,推荐使用2.0.0。

numPerTile Number 100 optional

单个瓦片要素数量。

polylineSymbol PolylineSymbol optional

线符号实例。

polygonSymbol PolygonSymbol optional

面符号实例。

bVisible Boolean true optional

矢量数据加载时显隐状态。

callback CallbackBoolean null optional

加载成功后触发的函数回调。

Example:
var layer = new CooWasm.FeatureLayer({
    url:"http://127.0.0.1/geoserver/ows?,
    layerName:"test:test",
    polylineSymbol: new CooWasm.PolylineSymbol({}),
    version:"2.0.0",
},(state)=>{console.log("load status:" + state)})
Demo:

Members

readonlyavatarUuid : String

矢量对象uuid。

bVisible : Boolean

矢量数据显隐状态。

Default Value: true

readonlycomponentPolygonUuid : String

面符号组件uuid。

readonlycomponentPolylineUuid : String

线符号组件uuid。

readonlycomponentUuid : String

矢量数据源组件uuid。

layerName : String

图层名称,通常格式为: xx:xxx。

numPerTile : Number

单个瓦片要素数量。

Default Value: 100

polygonSymbol : PolygonSymbol

面符号实例。

polylineSymbol : PolylineSymbol

线符号实例。

url : String

WFS服务路径。

version : String

WFS协议版本,通常为1.0.0/1.1.0/2.0.0,推荐使用2.0.0。

Default Value: 2.0.0

Methods

destroy(callback)

从场景中销毁自身。

Name Type Default Description
callback CallbackBoolean null optional

销毁图层后触发的函数回调。

Returns:

null 空值。

Example:
// 销毁图层
layer = layer.destroy((state)=>{console.log("destroy status:" + state)})

getProperties()Boolean

获取图层包含的属性。

Returns:

是否获取成功。获取成功时,会自动赋值给属性。

Example:
// 获取属性
layer.getProperties()
console.log(layer.spatialReference)

locate(callback)

从场景中定位自身(自动根据数据包围盒定位,不可修改定位参数)。

Name Type Default Description
callback CallbackBoolean null optional

飞行结束后触发的函数回调。

Example:
// 定位图层
layer.locate(()=>{console.log("locate done!")})

update(props, callback)

更新单个或者多个对象属性,使之立即生效。

一般用于多个属性的同时更新,避免性能开销过大。(待启用)

Name Type Default Description
props Object optional

包含如下属性的Object。

Name Type Default Description
url String optional

WFS服务根路径。

layerName String optional

图层名称,通常格式为: xx:xxx。

version String optional

WFS协议版本,通常为1.0.0/1.1.0/2.0.0,推荐使用2.0.0。

numPerTile Number optional

单个瓦片要素数量。

polylineSymbol PolylineSymbol optional

线符号实例。

polygonSymbol PolygonSymbol optional

面符号实例。

bVisible Boolean true optional

矢量数据加载时显隐状态。

callback CallbackBoolean null optional

更新成功后触发的函数回调。

Example:
layer.update({
     bVisible:false
},(state)=>{console.log("update status:" + state)})