LeadLabel

类:引线标签

Constructor

new Glodon.Bimface.Earth.Plugins.Drawable.LeadLabel(leadLabelConfig)

构造引线标签

Parameters:
NameTypeDescription
leadLabelConfigGlodon.Bimface.Earth.Plugins.Drawable.LeadLabelConfig

引线标签的配置项

Methods

enableDepthTest(isEnabled)

设置是否开启深度检测,开启后可监听标签的遮挡状态变化事件

Parameters:
NameTypeDescription
isEnabledBoolean

是否开启深度检测。

getHeight()

获取引线标签高度

Returns:
TypeDescription
Number

引线标签高度,单位为px

getLocation()

获取外部标签的位置坐标

Returns:
TypeDescription
Object

外部标签的位置坐标

getObjectId()

获取与引线标签相关联的构件ID

Returns:
TypeDescription
String

与引线标签相关联的构件ID

getOpacity()

获取引线标签不透明度

Returns:
TypeDescription
Number

引线标签透明度

getStyle()

获取引线标签样式

Returns:
TypeDescription
Object

返回引线标签的自定义样式

getText()

获取引线标签文字内容

Returns:
TypeDescription
String

引线标签文字内容

getTooltip()

获取标签的提示文字内容

Returns:
TypeDescription
String

标签的提示文字内容

getTooltipStyle()

获取标签的提示样式

Returns:
TypeDescription
Object

标签的提示样式

getVisibleDistance()

获取可见距离

Returns:
TypeDescription
Number

可见距离,单位同场景单位。

getWidth()

获取引线标签宽度

Returns:
TypeDescription
Number

引线标签宽度,单位为px

hide()

隐藏外部标签

isDepthTestEnabled()

获取深度检测的开启状态

Returns:
TypeDescription
Boolean

深度检测是否开启。

onClick(callback)

设置左键点击事件

Parameters:
NameTypeDescription
callbackFunction

回调函数

onDoubleClick(callback)

设置双击事件的回调函数

Parameters:
NameTypeDescription
callbackFunction

回调函数

onEndDrag(callback)

设置拖拽事件

Parameters:
NameTypeDescription
callbackFunction

回调函数

onObstructionChanged(callback)

设置标签遮挡状态变化事件,将返回标签是否被遮挡(true/false)。仅当开启深度检测后才生效。

Parameters:
NameTypeDescription
callbackFunction

标签被遮挡状态变化的回调函数。

Example

设置标签被遮挡后隐藏

// 开启标签的深度检测
leadLabelItem.enableDepthTest(true);
// 设置标签遮挡状态变化事件
leadLabelItem.onObstructionChanged(hideItem);
// 设置标签显隐状态
function hideItem(isObstructed){
  if(isObstructed){
    leadLabelItem.hide();
  }else{
    leadLabelItem.show();
  }
}

onRightClick(callback)

设置右键点击事件

Parameters:
NameTypeDescription
callbackFunction

回调函数

setDisplayMode(displayMode)

设置引线标签的显示模式

Parameters:
NameTypeDescription
displayModeNumber

0:完全显示 1:缩略显示(默认值:0)

setHeight(height)

设置引线标签高度

Parameters:
NameTypeDescription
heightNumber

引线标签高度

setLocation(location)

设置外部标签的位置坐标

Parameters:
NameTypeDescription
locationObject

外部标签的位置坐标

setOpacity(opacity)

设置引线标签透明度

Parameters:
NameTypeDescription
opacityNumber

引线标签透明度

setStyle(style)

设置引线标签样式

Parameters:
NameTypeDescription
styleObject

引线标签样式

lineColorGlodon.Web.Graphics.Color

引线标签颜色,包括leadLine、leadPoint中填充的颜色、文字显示框边框的颜色

backgroundColorGlodon.Web.Graphics.Color

引线标签文字显示框背景颜色

lineWidthNumber

引线标签线宽,包括leadLine和leadPoint、文字显示框边框的宽度

fontSizeNumber

引线标签字体大小

setText(text)

设置引线标签文字内容

Parameters:
NameTypeDescription
textString

引线标签文字内容

setTooltip(tip)

设置标签的提示文字内容

Parameters:
NameTypeDescription
tipString

标签的提示文字内容

setTooltipStyle(style)

设置标签的提示样式

Parameters:
NameTypeDescription
styleObject

标签的提示样式

Example

设置提示样式示例

LeadLabelItem.setTooltipStyle({
   border: '1px',
   textAlign : 'center'
})

setVisibleDistance(visibleDistance)

设置可见距离

Parameters:
NameTypeDescription
visibleDistanceNumber

可见距离,单位同场景单位,当相机与标签的距离小于可见距离时才会显示标签,默认为空,即不限制距离。

setWidth(width)

设置引线标签宽度

Parameters:
NameTypeDescription
widthNumber

引线标签宽度,单位为px

show()

显示外部标签