Drawing marks in 3d scene
Signature:
export default class MarkGraph extends Tool
Extends: Tool
在拾取模式中(DrawMode为0) ,按住Ctrl键,支持多选 在绘制线和矩形时(DrawMode为2 或者4) ,按住Ctrl键,线或者矩形的长边会和xyz中最近的轴平行 可以配合TransformGizmo工具一起使用,支持mark标记的位置编辑
// viewer基础的交互事件
viewer.addInput(new Modelo.View.Input.Mouse(viewer));
viewer.addInput(new Modelo.View.Input.Keyboard(viewer));
// 标记的工具
var markGraph = new Modelo.View.Tool.MarkGraph(viewer);
// 位置编辑控件
var gizmo = new Modelo.View.Tool.TransformGizmo(viewer);
// 添加tool到viewer
viewer.addTool(markGraph);
viewer.addTool(gizmo);
// 开启标绘功能
markGraph.setEnabled(true);
viewer.loadModel(modelId, ()=>{}.then(() => {
// 监听标绘的创建
viewer.getEventEmitter().on("MarkGraph-Created", function(id){
console.log('create mark success: ' + id);
});
// 监听标绘的删除
viewer.getEventEmitter().on("MarkGraph-Removed", function(id){
console.log('delete mark: ' + id);
});
})
// 如果想给标绘添加gizemo
document.getElementById("Gizmo").onclick = function(){
// 获得当前选中的标记(也可以用其它方式)
let marks = markGraph.getSelectMarks();
// 这里目前只支持单个mark的gizmo操作
if(marks[0]){
useGizmo = !useGizmo;
gizmo.setDrawable(marks[0].drawable);
}else{
useGizmo = false;
}
gizmo.setEnabled(useGizmo);
}
Constructor | Description |
---|---|
(constructor)(viewer, selector) | Constructs a new instance of the MarkGraph class |
Property | Modifiers | Description |
---|---|---|
enableGizmo | ||
enableOnlyDrawingRevoke | ||
marks | Map<string | Map for store marks, composed by key-value pairs | |
orthoDrawing | ||
revokeEnabled |