场景批注插件
在场景视图上框选模型的某些特征,进行注解。
1. 定义场景批注插件
代码示例如下:
const notePlugin = new ubm.NotePlugin()
2. 定义场景批注数据
数据格式如下
const noteData = [
// 批注组1
{
// 批注组ID
"id": 1,
// 批注组名称
"name": "11111",
// 批注组时间
"time": "2024",
// 绘制图形集合
"graphics": [
{
// ID
"id": 1719470601658,
// 位置
"location": {
"longitude": 113.18284545706396,
"latitude": 23.39626063332972,
"z": 99.00222199095643
},
// 类型 'circle'圆形 | 'rectangle'矩形 | 'text' 文本
"type": "circle",
// 颜色
"color": "#06bbdb",
// 尺寸
"size": 5,
// 宽度
"width": 388.48486328125,
// 高度
"height": 388.48486328125
},
]
}
]
注:批注数据是由多个不同的批注组分类组成,每个批注组又由多个不同的图形合成。
3. 创建场景批注
代码示例如下:
scene.event.on('scene.plugin.install', (e: any) => {
if(e.detail.plugin.id == 'note'){
notePlugin.createGraphic(noteData)
}
})
4. 注册场景批注插件
代码示例如下:
scene.plugin.register(notePlugin)
5. 获取场景批注数据
使用noteGroups
方法来获取场景中的批注数据,代码示例如下:
const newNoteData = notePlugin.noteGroups
Table of Contents