事件回调
<h2>事件回调</h2>
<h3>事件类型</h3>
<p>下面按照功能分类,分别介绍事件回调的类型。</p>
<h4>1.视图相关</h4>
<ul>
<li><strong>BCore.Static.EventType.ViewAdded</strong>: 视图加载</li>
</ul>
<h4>2.鼠标相关</h4>
<ul>
<li><strong>BCore.Static.EventType.MouseClicked</strong>: 鼠标单击</li>
<li><strong>BCore.Static.EventType.MouseDbClicked</strong>: 鼠标双击</li>
<li><strong>BCore.Static.EventType.MouseMove</strong>: 鼠标移动</li>
</ul>
<h4>3.构件相关</h4>
<ul>
<li><strong>BCore.Static.EventType.MeshSelected</strong>: 构件选中</li>
<li><strong>BCore.Static.EventType.MeshFocus</strong>: 构件聚焦</li>
<li><strong>BCore.Static.EventType.MeshHide</strong>: 构件隐藏</li>
<li><strong>BCore.Static.EventType.MeshShowAll</strong>: 构件显示全部</li>
<li><strong>BCore.Static.EventType.MeshTransparent</strong>: 构件透明</li>
<li><strong>BCore.Static.EventType.MeshIsolate</strong>: 构件隔离</li>
<li><strong>BCore.Static.EventType.MeshShow</strong>: 构件显示</li>
</ul>
<h4>4.移动端</h4>
<ul>
<li><strong>BCore.Static.EventType.HandPressed</strong>: 移动端长按</li>
<li><strong>BCore.Static.EventType.HandSingleTaped</strong>: 移动端单击</li>
<li><strong>BCore.Static.EventType.HandDoubleTaped</strong>: 移动端双击</li>
</ul>
<h4>5.模型相关</h4>
<ul>
<li><strong>BCore.Static.EventType.ModelAdded</strong>: 模型加载完毕</li>
<li><strong>BCore.Static.EventType.ModelRemoved</strong>: 模型移除</li>
<li><strong>BCore.Static.EventType.ModelLoadFailed</strong>: 模型加载失败</li>
<li><strong>BCore.Static.EventType.MutliModelAdded</strong>: 多模型加载</li>
<li><strong>BCore.Static.EventType.ModelAdding</strong>: 模型加载进度</li>
<li><strong>BCore.Static.EventType.SplitModelAdded</strong>: 拆分模型加载</li>
<li><strong>BCore.Static.EventType.SplitModelRemoved</strong>: 拆分模型卸载</li>
</ul>
<h4>6.相机</h4>
<ul>
<li><strong>BCore.Static.EventType.CameraControllerChange</strong>: 相机控制器更新</li>
<li><strong>BCore.Static.EventType.CameraControllerStart</strong>:相机控制器开始操作</li>
<li><strong>BCore.Static.EventType.CameraControllerEnd</strong>: 相机控制器开始结束</li>
<li><strong>BCore.Static.EventType.CameraControllerZoom</strong>: 相机控制器缩放</li>
<li><strong>BCore.Static.EventType.CameraTypeChanged</strong>: 相机类型改变</li>
<li><strong>BCore.Static.EventType.ChangeCameraOperatType</strong>: 改变相机操作风格</li>
</ul>
<h4>7.批注</h4>
<ul>
<li><strong>BCore.Static.EventType.SavePostilScreenShot</strong>: 保存批注</li>
<li><strong>BCore.Static.EventType.BeginPostil</strong>: 开始批注</li>
<li><strong>BCore.Static.EventType.EndPostil</strong>: 结束批注</li>
</ul>
<h4>8.测量</h4>
<ul>
<li><strong>BCore.Static.EventType.Measured</strong>: 量测完成/测量结果状态更新</li>
<li><strong>BCore.Static.EventType.MeasureTypeChanged</strong>: 测量类型变化</li>
<li><strong>BCore.Static.EventType.MeasureDrawClick</strong>: 测量绘制更新(面积或挖填方)</li>
<li><strong>BCore.Static.EventType.MeasureError</strong>: 量测错误</li>
</ul>
<h4>9.其他</h4>
<ul>
<li><strong>BCore.Static.EventType.FirstPerson</strong>: 第一人称控制器状态改变</li>
<li><strong>BCore.Static.EventType.FullScreenChange</strong>: 全屏事件</li>
<li><strong>BCore.Static.EventType.OverviewClicked</strong>: 单击小地图</li>
<li><strong>BCore.Static.EventType.RFAViewChanged</strong>: RFA显示视图发生变化</li>
<li><strong>BCore.Static.EventType.RFAViewError</strong>: RFA视图设置错误</li>
<li><strong>BCore.Static.SearchEventType.SearchResponse</strong>: 搜索返回</li>
</ul>
<h3>操作示例</h3>
<h4>1.增加事件监听</h4>
<h5>接口</h5>
<ul>
<li><code>addEventListener(eventType, callback)</code> 增加事件监听</li>
</ul>
<h5>参数</h5>
<ul>
<li>eventType : <code>BCore.Static.EventType.event</code> - Bcore注册静态变量事件类型</li>
<li>callback : <code>Function</code> - 回调函数</li>
</ul>
<h5>示例</h5>
<pre><code class="language-javascript">let mApplication3DConfig = new BCore.Application.Application3DConfig();
let mApplication3D = new BCore.Application.Application3D(mApplication3DConfig);
let mViewer3D = new BCore.Viewer.Viewer3D('bcorecontanier', new BCore.Viewer.Viewer3DConfig());
mApplication3D.addViewer3D(mViewer3D);
//必须先注册'ViewAdded'事件 再调用 Viewer3D.initViewer3D()
mApplication3D.addEventListener(BCore.Static.EventType.ViewAdded,()=&gt;{mViewer3D.addModel('fileId')});
mViewer3D.initViewer3D('092596df957f4b4caa52397e61724fe7');
let myEventCallback = ()=&gt;{console.log('ModelAdding')};
mViewer3D.addEventListener(BCore.Static.EventType.ModelAdding,myEventCallback);</code></pre>
<h4>2.移除事件监听</h4>
<ul>
<li><code>removeEventListener(eventType, callBack)</code> 移除事件监听</li>
</ul>
<h5>参数</h5>
<ul>
<li>eventType : <code>BCore.Static.EventType.event</code> - Bcore注册静态变量事件类型</li>
<li>callback : <code>Function</code> - 回调函数</li>
</ul>
<h5>示例</h5>
<pre><code class="language-javascript">let mApplication3DConfig = new BCore.Application.Application3DConfig();
let mApplication3D = new BCore.Application.Application3D(mApplication3DConfig);
let mViewer3D = new BCore.Viewer.Viewer3D('bcorecontanier', new BCore.Viewer.Viewer3DConfig());
mApplication3D.addViewer3D(mViewer3D);
//必须先注册'ViewAdded'事件 再调用 Viewer3D.initViewer3D()
mApplication3D.addEventListener(BCore.Static.EventType.ViewAdded,()=&gt;{mViewer3D.addModel('fileId')});
mViewer3D.initViewer3D('092596df957f4b4caa52397e61724fe7');
let myEventCallback = ()=&gt;{console.log('ModelAdding')};
mViewer3D.addEventListener(BCore.Static.EventType.ModelAdding,myEventCallback);
mViewer3D.removeEventListener(BCore.Static.EventType.ModelAdding,myEventCallback);</code></pre>
<p>此文档为 事件回调 的简要概述,更多功能及用法请查阅最新版 API 文档。</p>