1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
- <meta
- name="viewport"
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
- />
- <meta
- name="description"
- content="Demonstrates use cases for a batch table hierarchy."
- />
- <meta name="cesium-sandcastle-labels" content="3D Tiles, SuitBIM" />
- <title>模型加载示例</title>
- <script type="text/javascript" src="../Build/Cesium/Cesium.js"></script>
- <script type="text/javascript" src="../Build/Cesium/Sandcastle-header.js"></script>
- </head>
- <body
- class="sandcastle-loading"
- data-sandcastle-bucket="bucket-requirejs.html"
- >
- <style>
- @import url(./templates/bucket.css);
- #toolbar button {
- display: block;
- }
- </style>
- <div id="cesiumContainer" class="fullSize"></div>
- <div id="loadingOverlay"><h1>Loading...</h1></div>
- <div id="toolbar"></div>
- <script id="cesium_sandcastle_script">
- window.startup = async function (Cesium) {
- "use strict";
- //Sandcastle_Begin
- const viewer = new Cesium.Viewer("cesiumContainer", {
- suitBaseSettings: true, // 基础设置按钮,例如透明度、抗锯齿等
- suitMeasure: true, // 测量工具
- suitClippings: false
- });
- viewer.scene.debugShowFramesPerSecond = true;
- viewer.scene.globe.depthTestAgainstTerrain = true; // 地形深度与普通的图形深度进行测试
- // 模型加载初始化
- const collection = viewer.addSuitcimTilesetCollection({
- // enableIndexedDB : false, // 默认值true,是否开启本地缓存,来存储已经请求过的模型数据
- // enablePackDownload : false, // 默认值:true, 启用该技术将有效地减少几何体数据的网络请求次数
- // enableOcclusion : false, // 默认值:true,是否启用遮挡剔除
- serverHost: "https://bimrun.com/bim/",
- });
- // 根据项目id加载模型
- collection.displayProjects([357554579]);
- // 拉进到模型
- collection.readyPromise.then(() => {
- viewer.zoomTo(collection);
- });
- // 模型构建信息获取
- const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
- handler.setInputAction(function (movement) {
- const pickedFeature = viewer.scene.pick(movement.position);
- pickedFeature.getPropertyIds().forEach((item) => {
- console.log(item + ": " + pickedFeature.getProperty(item));
- });
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
- //Sandcastle_End
- Sandcastle.finishedLoading();
- };
- if (typeof Cesium !== "undefined") {
- window.startupCalled = true;
- window.startup(Cesium);
- }
- </script>
- </body>
- </html>
|