1. WFSLayer

Extends: Layer

1.1. 初始化 new WFSLayer(options)

WFS地图服务类,可实现WFS地图服务的添加、移除、缩放至和显隐等操作

Param Type Default Description
options Object

包含以下参数的Object对象:

[options.name] String

图层名称;

[options.show] Boolean true

是否显示;

[options.customGroupId] String

自定义分组的ID

Example

//通过图层管理类统一创建
let wfsLayer = layerManager.createLayer(BOSGeo.LayerType.WFS, "WFS服务图层", {customGroupId:'vector'});

1.2. 属性

属性名 Type Default Description
show Boolean true

是否显示图层

order Number 0

排序序号

customGroupId String

分组id

opacity Number

透明度,范围为0-1。

color String

修改实体的颜色,十六进制的颜色字符串

1.3. 方法

1.3.1. wfsLayer.add(options) ⇒ Promise.<GeoJsonDataSource>

添加WFS图层

Param Type Default Description
options Object

包含以下参数的Object对象:

[options.name] String

图层名称;

options.wfsUrl String

可以是wfs的服务地址;

[options.show] Boolean true

是否显示;

[options.customGroupId] String

若使用自定义分组,该图层所在分组的名称;

[options.stroke] String '#FF0000'

轮廓线的颜色,默认值为'#FF0000',格式为CSS颜色格式;

[options.fill] String '#ffffff'

填充颜色,默认值为'#ffffff',格式为CSS颜色格式;

[options.zoomToTarget] Boolean false

是否缩放至当前加载的GeoJson对象范围内,默认值为false。

[options.clampToGround] Boolean false

是否贴地,默认值为false。clampToGround为true时贴地,此时轮廓线设置将不起作用。

1.3.2. wfsLayer.remove(dataSource)

移除WFS图层

Param Type Description
dataSource GeoJsonDataSource

GeoJsonDataSource对象

1.3.3. wfsLayer.removeByName(name)

通过名称移除WFS图层

Param Type
name String

1.3.4. wfsLayer.destroy()

销毁本图层

1.3.5. wfsLayer.removeAll()

移除所有WFS图层

1.3.6. wfsLayer.zoomTo(dataSource)

缩放至wfs服务

Param Type Description
dataSource GeoJsonDataSource

GeoJsonDataSource对象

1.3.7. wfsLayer.zoomToLayer()

缩放至本图层

1.3.8. wfsLayer.zoomToByName(name)

缩放至指定名称的wfs服务

Param Type Description
name String

数据名

1.3.9. wfsLayer.setVisible(name, show)

设置WFS图层显隐

Param Type Description
name String
show Boolean

数据是否显示

1.3.10. wfsLayer.on(eventType, callBack)

绑定事件

Param Type Description
eventType String | LayerEventType

图层事件类型

callBack function

回调函数

Example

layer.on(BOSGeo.LayerEventType.ADD, (result) => {
    console.log(result);
});

1.3.11. wfsLayer.fire(eventType, value)

触发事件

Param Type Description
eventType String | LayerEventType

监听事件

value *

触发事件时可传入任意值

1.3.12. wfsLayer.hasOn(eventType, callBack) ⇒ Boolean

判断该函数是否已绑定该事件

Returns : Boolean -

是否绑定了该事件

Param Type Description
eventType String | LayerEventType

监听事件

callBack function

回调函数

Example

var hasBind = layer.hasOn(BOSGeo.LayerEventType.ADD, callback);

1.3.13. wfsLayer.once(eventType, callBack) ⇒ *

绑定后该函数只执行一次

Param Type Description
eventType String | LayerEventType

监听事件

callBack function

回调函数

1.3.14. wfsLayer.off(eventType, callBack) ⇒ *

取消事件绑定

Param Type Description
eventType String

监听事件

callBack function

回调函数

版权所有@盈嘉互联(北京)科技有限公司 京ICP备15051988号-9 Copyright © 2022 all right reserved,powered by Gitbook该文件修订时间: 2022-07-19 11:34:25

results matching ""

    No results matching ""