我们在浏览模型的过程中,有时候我们想对模型进行一些批注(箭头、云线、圆圈、矩形等),下面是代码的具体实现方法。
- 第一步正常加载模型
- 第二步页面上写实现代码
// 添加待显示的模型或图纸
viewer3D.addView(viewToken);
// 待模型添加完成以后,监听ViewAdded事件
viewer3D.addEventListener(Glodon.Bimface.Viewer.Viewer3DEvent.ViewAdded, function(){
// 手动render
viewer3D.render();
// *******************
// 举例:在下文中编写如何绘制批注的代码
// *******************
// 配置annotationconfig
var annotationconfig = new Glodon.Bimface.Plugins.Annotation.AnnotationManagerConfig();
// 把viewer3D注册到annotation绘制管理器
annotationconfig.viewer = viewer3D;
// annotation样式的配置
annotationconfig.lineColor = new Glodon.Web.Graphics.Color(255, 0, 0, 1);
annotationconfig.fillColor = new Glodon.Web.Graphics.Color(255, 255, 255, 0);
// 创建annotation的绘制管理器
var annotationmanager= new Glodon.Bimface.Plugins.Annotation.AnnotationManager(annotationconfig);
// 设置annotation的类型
annotationmanager.setAnnotationType(Glodon.Bimface.Plugins.Annotation.AnnotationTypeOption.Circle);
// 开始绘制
annotationmanager.startDrawing();
// 手动render
viewer3D.render();
});