Class

Layer

Layer(id)

Constructor

# new Layer(id)

图层基类

Parameters:
Name Type Description
id string

图层id

Author:
  • xyj

Members

# attr

Object

# readonly attr

属性

string

# readonly id

唯一标识

Layer

# readonly layer

图层

LayerEvent

# readonly layerEvent

图层事件

string

# readonly layerId

图层id

# show

boolean

# readonly show

显示隐藏

string

# readonly state

状态

Methods

# addGraphic(graphic) → {Layer}

添加实体

Parameters:
Name Type Description
graphic Graphic

实体

  • 当前对象
Layer

# addGraphics(graphics) → {Layer}

批量添加实体

Parameters:
Name Type Description
graphics Array.<Graphic>

实体数组

  • 当前对象
Layer

# addTo(viewer) → {Layer}

把当前图层添加至场景

Parameters:
Name Type Description
viewer Viewer

场景对象

  • 当前对象
Layer

# eachGraphic(method, context) → {Layer}

遍历实体

Parameters:
Name Type Description
method function

回调

context Context

上下文

  • 当前对象
Layer

# fire(type, params) → {Layer}

事件执行

Parameters:
Name Type Description
type String

事件类型

params Object | String

事件携带参数

  • 当前对象
Layer

# getGraphic(graphicId) → {Graphic}

根据id获取实体

Parameters:
Name Type Description
graphicId string

实体id

  • 实体对象
Graphic

# getGraphicById(graphicId) → {Graphic}

根据id获取实体

Parameters:
Name Type Description
graphicId string

实体id

  • 实体对象
Graphic

# getGraphics() → {Array.<Graphic>}

获取当前图层所有实体对象

  • 实体数组
Array.<Graphic>

# getGraphicsByAttr(attrName, attrVal) → {Array.<Graphic>}

根据属性获取实体

Parameters:
Name Type Description
attrName string

属性名字

attrVal string

属性值

  • 实体
Array.<Graphic>

# off(type, callback, context) → {Layer}

事件取消

Parameters:
Name Type Description
type String

事件类型

callback function

回调

context Context

上下文

  • 当前对象
Layer

# on(type, callback, context) → {Layer}

事件

Parameters:
Name Type Description
type String

事件类型

callback function

回调

context Context

上下文

  • 当前对象
Layer

# remove()

移出当前图层

# removeGraphic(graphic) → {Layer}

移出实体对象

Parameters:
Name Type Description
graphic Graphic

实体对象

  • 当前对象
Layer

# static getLayerType(type) → {Layer}

根据图层类型获取当前图层

Parameters:
Name Type Description
type String

类型

  • 图层
Layer