Class: Label

csvector~ Label


new Label(options)

构建标签
Parameters:
Name Type Description
options Object
Properties
Name Type Description
position Cartesian3 标签的位置
noteText string 标签显示的文本内容

Extends

Methods


getPosition()

获取标签的位置

setPosition(position)

设置标签显示的位置
Parameters:
Name Type Description
position Cartesian3 位置坐标

computeScreenSpacePosition( [result])

计算点屏幕坐标,如果是贴地的,会计算贴地的点屏幕坐标
Parameters:
Name Type Argument Description
result Cesium.Cartesian2 <optional>

getNoteText()

获取标签显示的文本内容

setNoteText(noteText)

设置标签显示的文本内容
Parameters:
Name Type Description
noteText string 文本内容

getNoteFont()

获取标签文本内容的字体

setNoteFont(noteFont)

设置标签文本内容的字体
Parameters:
Name Type Description
noteFont string 文本内容的字体

getNoteFillColor()

获取文本标签的填充颜色

setNoteFillColor(fillColor)

设置文本标签的填充颜色
Parameters:
Name Type Description
fillColor string

getNoteOutlineColor()

获取文本标签的外边框颜色

setNoteOutlineColor(outlineColor)

设置文本标签的外边框颜色
Parameters:
Name Type Description
outlineColor string

getNoteOutlineWidth()

获取文本标签的外边框宽度

setNoteOutlineWidth(outlineWidth)

设置文本标签的外边框宽度
Parameters:
Name Type Description
outlineWidth Number

getNoteOffset()

获取文本标签的偏移量

setNoteOffset(offset)

设置标签的偏移量
Parameters:
Name Type Description
offset Array.<Number> 偏移量

getNoteTextAlign()

获取标签内文本的对齐方式

setNoteTextAlign(textAlign)

设置标签内文本的对齐方式
Parameters:
Name Type Description
textAlign string 对齐方式

getNoteScale()

获取标签的缩放比例

setNoteScale(scale)

设置标签的缩放比例
Parameters:
Name Type Description
scale Number 缩放比例

toJson( [isSuper])

导出为json字符串
Parameters:
Name Type Argument Description
isSuper Boolean <optional>
判断当前对象是否是基类
Overrides:

<static> fromJson(jsonObject, options)

从json对象中构造标签对象
Parameters:
Name Type Description
jsonObject Object json对象,保存的是标签对象
options Object
Properties
Name Type Argument Description
parentLayer HTMLElement | string <optional>
新图层所在的父图层组,如果存在,则自动将新图层添加到父图层组中
Returns:
Type
module:csvector.Label

<static> copy(object, newOptions)

拷贝标签对象,构造新的标签
Parameters:
Name Type Description
object * 标签对象
newOptions Object
Properties
Name Type Argument Description
parentLayer HTMLElement | string <optional>
新图层所在的父图层组,如果存在,则自动将新图层添加到父图层组中
Returns:
Type
module:csvector.Label

destroy()

销毁标签
Overrides:

getVectorLayer()

获取当前的矢量图层
Inherited From:
Overrides:

setVectorLayer(vectorLayer)

添加矢量图层
Parameters:
Name Type Description
vectorLayer module:csvector.VectorLayer 矢量图层
Inherited From:
Overrides:

bind(vector)

绑定二维矢量,一旦绑定之后,调用三维矢量的相关接口时,比如改变颜色、位置等,二维矢量会同步改变
Parameters:
Name Type Description
vector * 矢量图层
Inherited From:
Overrides:
See:

unbind()

解除绑定二维矢量
Inherited From:
Overrides:
See:

getUuid()

获取当前矢量的唯一标识(UUID)
Inherited From:
Overrides:

getPickId()

鼠标选取到当前矢量时返回的对象
Inherited From:
Overrides:

getVisible()

获取矢量图层的显示隐藏状态
Inherited From:
Overrides:

setVisible(visible)

设置矢量图层显示或隐藏
Parameters:
Name Type Description
visible Boolean 矢量图层显隐
Inherited From:
Overrides:

获取矢量图层闪烁的状态
Inherited From:
Overrides:

设置矢量图层是否闪烁
Parameters:
Name Type Description
value Boolean 矢量图层闪烁状态
Inherited From:
Overrides:

getPickable()

获取对象是否可以被选中
Inherited From:
Overrides:

setPickable(canPick)

设置对象是否可以被选中
Parameters:
Name Type Description
canPick Boolean 是否可以被选中
Inherited From:
Overrides:

getCustom()

获取用户自定义对象
Inherited From:
Overrides:

setCustom(customObj)

设置用户自定义对象
Parameters:
Name Type Description
customObj * 用户自定义对象
Inherited From:
Overrides:

dispatchEvent(event)

发送事件消息,每个事件消息都有类型(type),所有监听此对象对应类型事件的监听者都会接收到相应的事件消息
Parameters:
Name Type Description
event string | module:events.Event 事件对象
Inherited From:
Overrides:

on(type, listener [, opt_this])

指定监听器监听指定类型的事件
Parameters:
Name Type Argument Default Description
type string 事件类型
listener callback | function 监听器
opt_this Object <optional>
target 在监听器中的`this`所指示的对象,默认是`target`自身
Inherited From:
Overrides:
Returns:
监听器的唯一标识.
Type
Object

once(type, listener [, opt_this])

指定监听器只监听一次指定类型的事件
Parameters:
Name Type Argument Default Description
type string 事件类型
listener callback | function 监听器
opt_this Object <optional>
target 在监听器中的`this`所指示的对象,默认是`target`自身
Inherited From:
Overrides:
Returns:
监听器的唯一标识.
Type
Object

un(type, listener [, opt_this])

取消指定监听器监听指定类型的事件
Parameters:
Name Type Argument Default Description
type string 事件类型
listener callback | function 监听器
opt_this Object <optional>
target 在监听器中的`this`所指示的对象,默认是`target`自身
Inherited From:
Overrides:

unByKey(key)

根据监听器的唯一标识取消指定监听器监听事件,监听器的唯一标识通过`on()`或者`once()`返回得到
Parameters:
Name Type Description
key Object | Array.<Object> 监听器的唯一标识,通过`on()`或者`once()`返回得到,可以是多个监听器的唯一标识数组
Inherited From:
Overrides: