MarkLayer

MarkLayer

new MarkLayer()

标注图层

Extends

Methods

add()

Overrides:

添加

addMark(optionsArray)

添加标注 目前支持divMark/billboard/label

Parameters:
Name Type Attributes Description
optionsArray

单个标注或者一组标注

options.id Number <optional>

标注ID 要求唯一

options.position Cartesian3 <optional>

标注在场景中的位置 Cartesian3类型

options.divMark Object <optional>

div标注相关参数

Properties
Name Type Attributes Default Description
div Object <optional>

对应的div 需要实时计算修改div的屏幕位置

divWidth Number <optional>

div宽度 单位像素

divHeight Number <optional>

div高度 单位像素

offsetX Number <optional>

div在水平方向的偏移量 单位像素

offsetY Number <optional>

div在垂直方向的偏移量 单位像素

minDis Number <optional>

div最小显示距离 单位米 默认值0

maxDis Number <optional>

div最大显示距离 单位米 默认值正无穷

zIndex Number <optional>
9999

zIndex值 默认9999

setPosCallback function <optional>

设置位置的回调函数 有此回调时不会自动校正div位置,会把div本身和屏幕坐标作为参数来执行回调

options.billboard Object <optional>

公告板 支持Cesium原生所有参数

options.label Object <optional>

文字标注 支持Cesium原生所有参数

Returns:

None

centerAt(duration)

Inherited From:

定位到图层

Parameters:
Name Type Description
duration Number

定位到图层经历的秒数

create()

Inherited From:

创建图层,可以在图层的Config中定义 OnCreate(viewer) 方法, 当图层创建时调用

deleteAllMark()

移除所有标注

Returns:

None

deleteMark(idopt)

根据ID移除单个标注

Parameters:
Name Type Attributes Description
id Number <optional>

标注ID

Returns:

None

getEntityCollection()

获取该图层的实体集合

Returns:

EntityCollection

getMarkByID()

根据ID来获取标注 返回Object对象{entity:xxx,markInfo:xxx} entity是添加到场景中的实体 markInfo是构建标注时的参数

Returns:

Object

getVisible() → {boolean}

Inherited From:

得到图层是否显示

Returns:

图层是否显示

Type
boolean

initialize(cfg, viewer)

Inherited From:

初始化图层

Parameters:
Name Type Description
cfg Object

图层配置

Properties
Name Type Attributes Default Description
url String

图层的url

center Object <optional>

图层的原始定位点

Properties
Name Type Description
x Number

经度

y Number

纬度

z Number

高度

heading Number
pitch Number
roll Number
visible Boolean <optional>
true

是否可见

flyTo Boolean <optional>
false

是否定位到这个图层,整个场景只能有一个

flyToDuration Number <optional>
0

定位到这个图层需要的时间(秒)

viewer ViewerEx

remove()

Overrides:

移除

setOpacity(value)

Inherited From:

设置不透明度

Parameters:
Name Type Description
value Number

不透明度 0.0 到 1.0

setVisible(val)

Inherited From:

设置图层是否显示

Parameters:
Name Type Description
val boolean

图层是否显示

setZIndex(value)

Inherited From:

设置叠加顺序

Parameters:
Name Type Description
value Number

叠加顺序, int值