图层操作
<h1>图层操作</h1>
<h2>构造函数</h2>
<pre><code class="language-javascript">new BCore2DFast.Viewer.Viewer2D(config)</code></pre>
<h2>参数</h2>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td>BCore2DFast.Viewer.Viewer2DConfig</td>
<td>二维图纸视图对象的配置</td>
</tr>
</tbody>
</table>
<h2>方法</h2>
<h3>1. 获取图层信息</h3>
<ul>
<li><strong>接口</strong>: <code>getLayersInfo()</code></li>
<li><strong>简要描述</strong>: 在场景中获取所有图层信息</li>
<li><strong>返回值说明</strong>:
<ul>
<li><code>layersList</code>: 数组,包含所有图层的信息</li>
</ul></li>
</ul>
<h3>示例</h3>
<pre><code class="language-javascript">var viewer2dConfig = new BCore2DFast.Viewer.Viewer2DConfig();
var viewer2D = new BCore2DFast.Viewer.Viewer2D(viewer2dConfig);
var layersInfo = viewer2D.getLayersInfo();</code></pre>
<hr />
<h3>2. 显示/隐藏指定图层</h3>
<ul>
<li><strong>接口</strong>:
<code>showLayer(layerId)</code> 显示指定图层
<code>hideLayer(layerId)</code> 隐藏指定图层</li>
<li><strong>参数</strong>:
<strong>layerId</strong> : <code>string</code> - 图纸图层ID</li>
</ul>
<h3>示例</h3>
<pre><code class="language-javascript">var viewer2dConfig = new BCore2DFast.Viewer.Viewer2DConfig();
var viewer2D = new BCore2DFast.Viewer.Viewer2D(viewer2dConfig);
viewer2D.showLayer(&quot;abc&quot;); //显示指定图层
viewer2D.hideLayer(&quot;abc&quot;); //隐藏指定图层</code></pre>
<h3>3. 显示/隐藏所有图层</h3>
<ul>
<li><strong>接口</strong>:
<code>showAllLayer()</code> 在场景中显示所有图层
<code>hideAllLayer()</code> 在场景中隐藏所有图层</li>
</ul>
<h5>示例</h5>
<pre><code class="language-javascript">var viewer2dConfig = new BCore2DFast.Viewer.Viewer2DConfig();
var viewer2D = new BCore2DFast.Viewer.Viewer2D(viewer2dConfig);
viewer2D.showAllLayer(); //显示所有图层
viewer2D.hideAllLayer(); //隐藏所有图层</code></pre>
<hr />
<p>该文档提供了 <code>图层操作</code> 的相关类型和基本方法,帮助用户快速使用其功能。根据需要,可以扩展更多功能或添加具体应用场景的示例代码。</p>