Class: ModelMarkup

Glodon.CIMCube.Utils. ModelMarkup

模型表面批注工具(折线拾点、编辑、段标签)

new ModelMarkup(map [, options])

Parameters:
Name Type Argument Default Description
map Glodon.CIMCube CIMCube 实例
options ModelMarkupOptions <optional>
{} 批注类型与样式

Members


<readonly> isDrawing :Boolean

是否处于绘制阶段(Glodon.CIMCube.Global.Defines.DrawEditMode.DRAW
Type:
  • Boolean

<readonly> isEditing :Boolean

是否处于编辑阶段(Glodon.CIMCube.Global.Defines.DrawEditMode.EDIT
Type:
  • Boolean

<readonly> mode :Glodon.CIMCube.Global.Defines.DrawEditMode

当前交互阶段
Type:

Methods


activate( [mode])

进入绘制或编辑阶段;与当前阶段互斥(draw ↔ edit,均会先关闭另一侧)
Parameters:
Name Type Argument Default Description
mode Glodon.CIMCube.Global.Defines.DrawEditMode <optional>
DrawEditMode.DRAW DrawEditMode.DRAWDrawEditMode.EDIT
Example
markup.activate(Glodon.CIMCube.Global.Defines.DrawEditMode.DRAW);
markup.activate(Glodon.CIMCube.Global.Defines.DrawEditMode.EDIT);

clearAll()

清空全部批注数据,不改变当前交互阶段(绘制中可继续绘制,编辑中可继续编辑)

clearSelection()

开启编辑后,取消当前选中并停止折线节点编辑

deactivate()

Example
markup.deactivate();

delete(id)

删除指定批注项
Parameters:
Name Type Description
id String

dispose()

释放图层、事件与交互,实例不可再使用

get(id)

按 id 获取批注项
Parameters:
Name Type Description
id String
Returns:
Type
Glodon.CIMCube.Utils.MarkupItem | undefined

getLabelLayer()

批注标签 Div 图层
Returns:
Type
Glodon.CIMCube.Layer.DivLayer

getMarkupLayer()

批注几何图层
Returns:
Type
Glodon.CIMCube.Layer.GraphicLayer

getSelectedItem()

获取当前选中的批注项(编辑阶段有效)
Returns:
Type
Glodon.CIMCube.Utils.MarkupItem | undefined

off( [type] [, listener])

移除事件监听
Parameters:
Name Type Argument Description
type String <optional>
事件类型;省略则移除全部
listener function <optional>
指定回调;省略则移除该类型下全部回调

on(type, listener)

注册事件监听,类型见 Glodon.CIMCube.Global.Defines.MapActionType
Parameters:
Name Type Description
type String ADD | FINISH | CHANGED | DELETE
listener function

selectItem(id)

开启编辑后,选中并进入该条折线的编辑(需已 DrawEditMode.EDIT
Parameters:
Name Type Description
id String 批注项 id

Events


ADD

拾取到有效点后触发(绘制模式)
Type: Cesium.Cartographic
Example
markup.on(Glodon.CIMCube.Global.Defines.MapActionType.ADD, carto => {
    console.log(carto);
});

CHANGED

批注几何或标签变更后触发(编辑模式)
Type: Object
Properties:
Name Type Argument Description
item Object 批注项
changeType String 变更类型:`geometry` 或 `label`
segmentIndex Number <optional>
段索引(仅 label 变更时)
Example
markup.on(Glodon.CIMCube.Global.Defines.MapActionType.CHANGED, evt => {
    console.log(evt.changeType, evt.item);
});

DELETE

批注删除后触发
Type: Object
Properties:
Name Type Description
id String 被删除的批注 id
Example
markup.on(Glodon.CIMCube.Global.Defines.MapActionType.DELETE, evt => {
    console.log(evt.id);
});

FINISH

一条批注绘制完成时触发(右键结束,至少两个顶点)
Type: Object
Example
markup.on(Glodon.CIMCube.Global.Defines.MapActionType.FINISH, item => {
    console.log(item.id);
});