zyy-engine

图形引擎API


相机操作

<h1>相机操作</h1> <h2>构造函数</h2> <p><code>new BCore2DFast.Viewer.Viewer2D(config)</code></p> <h3>参数</h3> <ul> <li><strong>config</strong>: <code>BCore2DFast.Viewer.Viewer2DConfig</code> <ul> <li>二维图纸视图对象的配置。</li> </ul></li> </ul> <h2>方法</h2> <h3>1.恢复主视图</h3> <ul> <li><strong>描述</strong>: <code>setHomeView()</code></li> <li><strong>示例</strong>: <pre><code class="language-javascript">mViewer2D.setHomeView();</code></pre></li> </ul> <h3>2.获取当前视口状态</h3> <ul> <li><strong>接口</strong>: <code>getViewportInfo()</code></li> <li> <p><strong>返回值</strong>: <code>ViewportInfo</code></p> </li> <li><strong>示例</strong>: <pre><code class="language-javascript">var viewer2dConfig = new BCore2DFast.Viewer.Viewer2DConfig(); var viewer2D = new BCore2DFast.Viewer.Viewer2D(viewer2dConfig); var lookat = viewer2D.getViewportInfo();</code></pre></li> </ul> <h3>3.恢复指定的视口状态</h3> <ul> <li><strong>接口</strong>: <code>setViewportInfo(ViewportInfo)</code></li> <li> <p><strong>参数</strong>:</p> <ul> <li><strong>ViewportInfo</strong>: <code>ViewportInfo</code>(必选)- 视口状态信息。</li> </ul> </li> <li> <p><strong>示例</strong>:</p> <pre><code class="language-javascript">const ViewPortInfo = { cameraDirection: {x: -0, y: -0, z: -1}, cameraType: &amp;quot;PerspectiveCamera&amp;quot;, cameraUpVector: {x: 0, y: 1, z: 0}, cameraViewPoint: {x: 53277.820720150004, y: 38240.21074782251, z: 72832.73645827129}, fieldOfView: 60, target: {x: 0, y: 0, z: 0}, viewToWorldScale: 0 }; var viewer2dConfig = new BCore2DFast.Viewer.Viewer2DConfig(); var viewer2D = new BCore2DFast.Viewer.Viewer2D(viewer2dConfig); viewer2D.setViewportInfo(ViewportInfo);</code></pre> </li> </ul> <h3>4. 缩放到指定的模型盒子。</h3> <ul> <li><strong>接口</strong>: <code>zoomToBoundingBox(boundingBox, isAnimation = false, delay = 1000, callback?: Function)</code></li> <li> <p><strong>参数</strong>:</p> <ul> <li><strong>boundingBox</strong>: <code>{max, min}</code> — 包含最大点和最小点的盒子模型</li> <li><strong>isAnimation</strong>: <code>boolean</code>(可选)— 是否播放动画,默认值为 <code>false</code></li> <li><strong>delay</strong>: <code>number</code>(可选)— 延迟时间,默认值为 <code>1000</code> 毫秒</li> <li><strong>callback</strong>: <code>Function</code>(可选)— 回调函数</li> </ul> </li> <li><strong>示例</strong>: <pre><code class="language-javascript">const min = {x: 65863.96543271418, y: 49638.96915895038, z: 0 }; const max = {x: 65013.965432714176, y: 48072.302492283714, z: 0 }; viewer2D.zoomToBoundingBox({max: max, min: min});</code></pre></li> </ul> <hr />

页面列表

ITEM_HTML