new ModelMarkup(map [, options])
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
map |
Glodon.CIMCube | CIMCube 实例 | ||
options |
ModelMarkupOptions |
<optional> |
{} | 批注类型与样式 |
Members
-
<readonly> isDrawing :Boolean
-
Type:
- Boolean
-
<readonly> isEditing :Boolean
-
Type:
- Boolean
-
<readonly> mode :Glodon.CIMCube.Global.Defines.DrawEditMode
-
当前交互阶段
Type:
Methods
-
activate( [mode])
-
进入绘制或编辑阶段;与当前阶段互斥(draw ↔ edit,均会先关闭另一侧)
Parameters:
Name Type Argument Default Description modeGlodon.CIMCube.Global.Defines.DrawEditMode <optional>
DrawEditMode.DRAW DrawEditMode.DRAW或DrawEditMode.EDITExample
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 idString -
dispose()
-
释放图层、事件与交互,实例不可再使用
-
get(id)
-
按 id 获取批注项
Parameters:
Name Type Description idString Returns:
- Type
- Glodon.CIMCube.Utils.MarkupItem | undefined
-
getLabelLayer()
-
批注标签 Div 图层
Returns:
-
getMarkupLayer()
-
批注几何图层
Returns:
-
getSelectedItem()
-
获取当前选中的批注项(编辑阶段有效)
Returns:
- Type
- Glodon.CIMCube.Utils.MarkupItem | undefined
-
off( [type] [, listener])
-
移除事件监听
Parameters:
Name Type Argument Description typeString <optional>
事件类型;省略则移除全部 listenerfunction <optional>
指定回调;省略则移除该类型下全部回调 -
on(type, listener)
-
注册事件监听,类型见
Glodon.CIMCube.Global.Defines.MapActionTypeParameters:
Name Type Description typeString ADD | FINISH | CHANGED | DELETE listenerfunction -
selectItem(id)
-
开启编辑后,选中并进入该条折线的编辑(需已
DrawEditMode.EDIT)Parameters:
Name Type Description idString 批注项 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 itemObject 批注项 changeTypeString 变更类型:`geometry` 或 `label` segmentIndexNumber <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 idString 被删除的批注 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); });