From d3e47ad7ea1ec7560a1fe3b5d7210feddcc9bb81 Mon Sep 17 00:00:00 2001 From: qiushijie Date: Thu, 27 Jun 2024 15:10:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BaseViewer.vue | 141 ++++++++++++++++++++++++++++++++++ src/components/HelloWorld.vue | 40 +++++----- 2 files changed, 160 insertions(+), 21 deletions(-) create mode 100644 src/components/BaseViewer.vue diff --git a/src/components/BaseViewer.vue b/src/components/BaseViewer.vue new file mode 100644 index 0000000..5bdee9f --- /dev/null +++ b/src/components/BaseViewer.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index 19c5310..ec725d4 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -76,26 +76,26 @@ onMounted(()=>{ // }) addGeoJson(); - //设置地理区域和准备变量: - var scene = viewer.scene; - var globe = viewer.scene.globe; - //遍历当前场景中所有的地形瓦片并将相交的瓦片添加到处理列表中。 - var tilesToProcess = []; - var quadtree = - viewer.scene.globe._surface._tileProvider._quadtree._tilesToRender; - // 遍历地形瓦片 - quadtree.forEach(function(tile) { - tilesToProcess.push(tile); - if (tile instanceof Cesium.Cesium3DTileset) return; - }); - const MAX_SHORT = 32767; - var terrainProvider=viewer.terrainProvider + // //设置地理区域和准备变量: + // var scene = viewer.scene; + // var globe = viewer.scene.globe; + // //遍历当前场景中所有的地形瓦片并将相交的瓦片添加到处理列表中。 + // var tilesToProcess = []; + // var quadtree = + // viewer.scene.globe._surface._tileProvider._quadtree._tilesToRender; + // // 遍历地形瓦片 + // quadtree.forEach(function(tile) { + // tilesToProcess.push(tile); + // if (tile instanceof Cesium.Cesium3DTileset) return; + // }); + // const MAX_SHORT = 32767; + // var terrainProvider=viewer.terrainProvider - // 创建一个Request对象,这通常是可选的 - const request = new Cesium.Request({ - throttle: true, - throttleByServer: true - }); + // // 创建一个Request对象,这通常是可选的 + // const request = new Cesium.Request({ + // throttle: true, + // throttleByServer: true + // }); // terrain.readyEvent.addEventListener(provider => { // scene.globe.enableLighting = true; @@ -136,12 +136,10 @@ onMounted(()=>{ // 定义请求多个瓦片数据的函数 function requestMultipleTiles(tileCoords, level, terrainProvider) { let promises = []; - for (let tileCoord of tileCoords) { let promise = requestTileData(tileCoord.x, tileCoord.y, level, terrainProvider); promises.push(promise); } - return Promise.all(promises); }