zyy-engine

图形引擎API


图纸操作

<h1>图纸操作</h1> <h2>构造函数</h2> <pre><code class="language-javascript">new BCore2DFast.Viewer.Viewer2D(config)</code></pre> <p><strong>参数:</strong></p> <ul> <li><strong>config</strong>: <code>BCore2DFast.Viewer.Viewer2DConfig</code> - 二维图纸视图对象的配置。</li> </ul> <h2>方法</h2> <ol> <li> <p><strong>addDrawing(fileId)</strong></p> <ul> <li><strong>简要描述</strong>: 在场景中添加图纸。</li> <li><strong>接口</strong>: <code>addDrawing(fileId)</code></li> <li><strong>参数</strong>: <ul> <li><strong>fileId</strong>: (必选) <code>string</code> - 图纸访问凭证。</li> </ul></li> <li><strong>返回值</strong>: <code>void</code> - 返回值为空。</li> </ul> <p><strong>示例</strong>:</p> <pre><code class="language-javascript">var viewer2dConfig = new BCore2DFast.Viewer.Viewer2DConfig(); var viewer2D = new BCore2DFast.Viewer.Viewer2D(viewer2dConfig); viewer2D.initViewer2D(accessToken, () =&amp;gt; { viewer2D.addDrawing('abc'); });</code></pre> </li> <li> <p><strong>removeDrawing(fileId)</strong></p> <ul> <li><strong>简要描述</strong>: 从场景中移除图纸。</li> <li><strong>接口</strong>: <code>removeDrawing(fileId)</code></li> <li><strong>参数</strong>: <ul> <li><strong>fileId</strong>: (必选) <code>string</code> - 图纸访问凭证。</li> </ul></li> <li><strong>返回值</strong>: <code>void</code> - 返回值为空。</li> </ul> <p><strong>示例</strong>:</p> <pre><code class="language-javascript">var viewer2dConfig = new BCore2DFast.Viewer.Viewer2DConfig(); var viewer2D = new BCore2DFast.Viewer.Viewer2D(viewer2dConfig); viewer2D.initViewer2D(accessToken, () =&amp;gt; { viewer2D.removeDrawing(&amp;quot;abc&amp;quot;); });</code></pre> </li> </ol> <h3>总结</h3> <p><code>BCore2DFast.Viewer.Viewer2D</code> 提供了简便的方法来添加和移除图纸,通过 <code>fileId</code> 对图纸进行管理。在使用这些方法之前,需先初始化图对象。</p>

页面列表

ITEM_HTML