LeadLabel
类:引线标签
Constructor
new Glodon.Bimface.Earth.Plugins.Drawable.LeadLabel(leadLabelConfig)
构造引线标签
Parameters:
Name | Type | Description |
---|---|---|
leadLabelConfig | Glodon.Bimface.Earth.Plugins.Drawable.LeadLabelConfig | 引线标签的配置项 |
Methods
enableDepthTest(isEnabled)
设置是否开启深度检测,开启后可监听标签的遮挡状态变化事件
Parameters:
Name | Type | Description |
---|---|---|
isEnabled | Boolean | 是否开启深度检测。 |
getHeight()
获取引线标签高度
Returns:
Type | Description |
---|---|
Number | 引线标签高度,单位为px |
getLocation()
获取外部标签的位置坐标
Returns:
Type | Description |
---|---|
Object | 外部标签的位置坐标 |
getObjectId()
获取与引线标签相关联的构件ID
Returns:
Type | Description |
---|---|
String | 与引线标签相关联的构件ID |
getOpacity()
获取引线标签不透明度
Returns:
Type | Description |
---|---|
Number | 引线标签透明度 |
getStyle()
获取引线标签样式
Returns:
Type | Description |
---|---|
Object | 返回引线标签的自定义样式 |
getText()
获取引线标签文字内容
Returns:
Type | Description |
---|---|
String | 引线标签文字内容 |
getTooltip()
获取标签的提示文字内容
Returns:
Type | Description |
---|---|
String | 标签的提示文字内容 |
getTooltipStyle()
获取标签的提示样式
Returns:
Type | Description |
---|---|
Object | 标签的提示样式 |
getVisibleDistance()
获取可见距离
Returns:
Type | Description |
---|---|
Number | 可见距离,单位同场景单位。 |
getWidth()
获取引线标签宽度
Returns:
Type | Description |
---|---|
Number | 引线标签宽度,单位为px |
hide()
隐藏外部标签
isDepthTestEnabled()
获取深度检测的开启状态
Returns:
Type | Description |
---|---|
Boolean | 深度检测是否开启。 |
onClick(callback)
设置左键点击事件
Parameters:
Name | Type | Description |
---|---|---|
callback | Function | 回调函数 |
onDoubleClick(callback)
设置双击事件的回调函数
Parameters:
Name | Type | Description |
---|---|---|
callback | Function | 回调函数 |
onEndDrag(callback)
设置拖拽事件
Parameters:
Name | Type | Description |
---|---|---|
callback | Function | 回调函数 |
onObstructionChanged(callback)
设置标签遮挡状态变化事件,将返回标签是否被遮挡(true/false)。仅当开启深度检测后才生效。
Parameters:
Name | Type | Description |
---|---|---|
callback | Function | 标签被遮挡状态变化的回调函数。 |
Example
设置标签被遮挡后隐藏
// 开启标签的深度检测
leadLabelItem.enableDepthTest(true);
// 设置标签遮挡状态变化事件
leadLabelItem.onObstructionChanged(hideItem);
// 设置标签显隐状态
function hideItem(isObstructed){
if(isObstructed){
leadLabelItem.hide();
}else{
leadLabelItem.show();
}
}
onRightClick(callback)
设置右键点击事件
Parameters:
Name | Type | Description |
---|---|---|
callback | Function | 回调函数 |
setDisplayMode(displayMode)
设置引线标签的显示模式
Parameters:
Name | Type | Description |
---|---|---|
displayMode | Number | 0:完全显示 1:缩略显示(默认值:0) |
setHeight(height)
设置引线标签高度
Parameters:
Name | Type | Description |
---|---|---|
height | Number | 引线标签高度 |
setLocation(location)
设置外部标签的位置坐标
Parameters:
Name | Type | Description |
---|---|---|
location | Object | 外部标签的位置坐标 |
setOpacity(opacity)
设置引线标签透明度
Parameters:
Name | Type | Description |
---|---|---|
opacity | Number | 引线标签透明度 |
setStyle(style)
设置引线标签样式
Parameters:
Name | Type | Description |
---|---|---|
style | Object | 引线标签样式 |
setText(text)
设置引线标签文字内容
Parameters:
Name | Type | Description |
---|---|---|
text | String | 引线标签文字内容 |
setTooltip(tip)
设置标签的提示文字内容
Parameters:
Name | Type | Description |
---|---|---|
tip | String | 标签的提示文字内容 |
setTooltipStyle(style)
设置标签的提示样式
Parameters:
Name | Type | Description |
---|---|---|
style | Object | 标签的提示样式 |
Example
设置提示样式示例
LeadLabelItem.setTooltipStyle({
border: '1px',
textAlign : 'center'
})
setVisibleDistance(visibleDistance)
设置可见距离
Parameters:
Name | Type | Description |
---|---|---|
visibleDistance | Number | 可见距离,单位同场景单位,当相机与标签的距离小于可见距离时才会显示标签,默认为空,即不限制距离。 |
setWidth(width)
设置引线标签宽度
Parameters:
Name | Type | Description |
---|---|---|
width | Number | 引线标签宽度,单位为px |
show()
显示外部标签