基础设置
<h3>一、BCore.Application.Application3DConfig</h3>
<h4>构造</h4>
<pre><code class="language-javascript">new BCore.Application.Application3DConfig();</code></pre>
<h4>方法</h4>
<ul>
<li><strong>setMainUIConfig(config: string[])</strong>
<ul>
<li>设置主界面UI配置</li>
</ul></li>
<li><strong>setToolbarsConfig(config: string[])</strong>
<ul>
<li>设置工具条按钮</li>
</ul></li>
<li><strong>setViewerControllerConfig(width?, height?, isShowMenu?)</strong>
<ul>
<li>配置视图控制器</li>
</ul></li>
</ul>
<h4>成员变量</h4>
<table>
<thead>
<tr>
<th>成员变量</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>enableBottomToolbar</td>
<td>boolean</td>
<td>启用工具条</td>
</tr>
<tr>
<td>enableContextMenu</td>
<td>boolean</td>
<td>启用右键菜单</td>
</tr>
<tr>
<td>enableFileList</td>
<td>boolean</td>
<td>启用文件列表</td>
</tr>
<tr>
<td>enableViewerController</td>
<td>boolean</td>
<td>启用视图控制器</td>
</tr>
<tr>
<td>enableMessage</td>
<td>boolean</td>
<td>启用消息提示</td>
</tr>
<tr>
<td>enableViewList</td>
<td>boolean</td>
<td>启用RFA视图切换列表 (v2.6)</td>
</tr>
<tr>
<td>Property.isShowCustomerPropertyEdit</td>
<td>boolean</td>
<td>启用自定义属性编辑 (v2.6.6)</td>
</tr>
</tbody>
</table>
<hr />
<h3>二、BCore.Application.Application3D</h3>
<h4>构造</h4>
<pre><code class="language-javascript">new BCore.Application.Application3D(config);</code></pre>
<ul>
<li><strong>参数</strong>:
<ul>
<li><code>config</code>: <code>BCore.Application.Application3DConfig</code> 三维应用程序的配置</li>
</ul></li>
</ul>
<h4>方法</h4>
<ul>
<li><strong>addViewer3D(viewer3D)</strong>
添加视图</li>
<li><strong>destoryViewer3D(viewer3D)</strong>
销毁视图</li>
<li><strong>toggleToolbar(boolean)</strong>
显示/隐藏底部工具条</li>
<li><strong>toggleViewList(boolean)</strong>
显示/隐藏RFA视图列表 - v2.6</li>
<li><strong>toggleContextMenu(boolean)</strong>
显示/隐藏右键菜单 - v2.7.0</li>
<li><strong>toggleViewerController(boolean)</strong>
显示/隐藏视图控制器 - v2.7.4</li>
<li><strong>toggleViewerControllerMenu(boolean)</strong>
显示/隐藏视图控制器菜单 - v2.7.4</li>
<li><strong>setViewerControllerSize(width: number, height: number)</strong>
设置视图控制器尺寸 - v2.7.4</li>
<li><strong>getViewerControllerSize(): {width: number, height: number}</strong>
获取视图控制器尺寸 - v2.7.4</li>
<li><strong>insertToolBar(toolbar, site)</strong>
添加工具栏菜单 - v2.8</li>
<li><strong>insertToolBarMenu(toolbar, site)</strong>
添加工具条更多菜单内菜单(仅PC) - v2.8</li>
<li><strong>setToolBarMaxLength(length)</strong>
设置工具条菜单最大个数,多余折叠进更多下拉菜单内(仅PC) - v2.8</li>
<li><strong>resetToolbars()</strong>
还原工具栏菜单 - v3.2.5</li>
<li><strong>updatePropertyPanel(fileId: string, guid: string)</strong>
更新属性面板 - v2.9.13</li>
<li><strong>clearPropertyPanel()</strong>
清空属性面板 - v2.9.13</li>
<li><strong>insertContextMenu(menu)</strong>
插入右键菜单 - v3.1.0</li>
<li><strong>setContextMenus(menus)</strong>
自定义右键菜单 - v3.1.0</li>
<li><strong>deleteContextMenu(key)</strong>
删除右键菜单 - v3.1.0</li>
<li><strong>toggleContextMenuAble(key,type)</strong>
禁用/启用右键菜单选项 - v3.1.0</li>
<li><strong>resetContextMenus()</strong>
还原右键菜单 - v3.2.5</li>
<li><strong>openIndexDBCache():void</strong>
开启模型渲染数据缓存 - v3.2.4</li>
<li><strong>closeIndexDBCache():void</strong>
关闭模型渲染数据缓存 - v3.2.4</li>
<li><strong>clearIndexDBCache():void</strong>
清空模型渲染数据缓存 - v3.2.4</li>
</ul>
<p><br><br></p>
<h4>示例1(配置主界面-UI功能组件)</h4>
<pre><code class="language-javascript">// 配置应用程序
let mApplication3DConfig = new BCore.Application.Application3DConfig();
// 数组中的值可以设置为Toolbar,Modellist,Viewbox,Toolbar表示工具栏,Modellist表示文件列表,Viewbox表示视图控制器
mApplication3DConfig.setMainUIConfig([&quot;Toolbar&quot;, &quot;Modellist&quot;]);
let mApplication3D = new BCore.Application.Application3D(mApplication3DConfig);
// 初始化视图
let mViewer3D = new BCore.Viewer.Viewer3D('bcorecontainer', new BCore.Viewer.Viewer3DConfig());
mViewer3D.initViewer3D('accessToken');
mApplication3D.addViewer3D(mViewer3D);
mViewer3D.addModel('fileId');</code></pre>
<p><br><br></p>
<h4>示例2(设置工具栏-功能项)</h4>
<pre><code class="language-javascript">let mApplication3DConfig = new BCore.Application.Application3DConfig();
mApplication3DConfig.setToolbarsConfig([&quot;Tree&quot;,&quot;Search&quot;,&quot;Property&quot;,&quot;Setting&quot;]);
// config分别可设置为Tree,Search,Group,RectangleSelect,Property,Walk,Map,Annotate,Tool,Information,Setting,FullScreen,VR
// Tree目录树,Search搜索,Group构件组,RectangleSelect框选,Property属性,Walk漫游
// Map小地图,Annotate批注,Tool剖切和测量的工具箱,Information信息,Setting设置
// FullScreen全屏(移动端没有全屏),VR(仅移动端存在VR按钮)
let mApplication3D = new BCore.Application.Application3D(mApplication3DConfig);
// 初始化视图
let mViewer3D = new BCore.Viewer.Viewer3D('bcorecontanier', new BCore.Viewer.Viewer3DConfig());
mViewer3D.initViewer3D('accessToken');
mApplication3D.addViewer3D(mViewer3D);
mViewer3D.addModel('fileId');</code></pre>
<p><br><br></p>
<h4>示例3(配置视图控制器)</h4>
<pre><code class="language-javascript">let mApplication3DConfig = new BCore.Application.Application3DConfig();
//隐藏右侧视图控制按钮
mApplication3DConfig.setViewerControllerConfig(undefined, undefined, false);
let mApplication3D = new BCore.Application.Application3D(mApplication3DConfig);
// 初始化视图
let mViewer3D = new BCore.Viewer.Viewer3D('bcorecontanier', new BCore.Viewer.Viewer3DConfig());
mViewer3D.initViewer3D('accessToken');
mApplication3D.addViewer3D(mViewer3D);
mViewer3D.addModel('fileId');</code></pre>
<p><br><br></p>
<h4>示例4(添加3D视图)</h4>
<pre><code class="language-javascript">let mApplication3D = new BCore.Application.Application3D(new BCore.Application.Application3DConfig());
let mViewer3D = new BCore.Viewer.Viewer3D('bcorecontanier', new BCore.Viewer.Viewer3DConfig());
mViewer3D.initViewer3D('accessToken');
mApplication3D.addViewer3D(mViewer3D);
mViewer3D.addModel('fileId');</code></pre>
<p><br><br></p>
<h4>示例5(移除3D视图)</h4>
<pre><code class="language-javascript"> mApplication3D.destoryViewer3D(mViewer3D);</code></pre>
<h4>注意</h4>
<p>所有示例中的方法调用需要根据具体的应用需求进行修改,可以根据具体文档或需求进一步探索各方法的详细功能。</p>