加载 GIS 场景
GIS Viewer 使用 BimEngineGIS。它用于加载在线地图底图和 3D Tiles 场景;业务侧不需要直接创建 Cesium Viewer。
初始化
import { BimEngineGIS } from 'iflow-engine';
const gis = new BimEngineGIS('gis-viewer', {
imageryUrl: 'https://example.com/tiles/{z}/{y}/{x}',
initialView: {
longitude: 116.391,
latitude: 39.907,
height: 8000,
pitch: -1.2
},
showCredit: false
});
await gis.ready;
部署时确保 /cesium/ 下存在 Workers、Assets、ThirdParty 和 Widgets 静态资源。
通过模型查看令牌加载
const model = await gis.loadModelByViewToken('YOUR_VIEW_TOKEN');
console.log(model?.id);
直接加载 3D Tiles
const model = await gis.engine?.load3DTiles({
id: 'building-tiles',
name: '园区 BIM 模型',
url: 'https://example.com/gis/building/tileset.json',
offset: [1, 2, 3, 10, 0, 0],
rotationUnit: 'degrees'
});
offset 支持 [east, north, up] 或 [east, north, up, heading, pitch, roll]。前三项单位为米;旋转默认使用弧度,指定 rotationUnit: 'degrees' 时使用角度。