Commit 8a1ca47b authored by xinzhedeai's avatar xinzhedeai

add:相机仰视角调整

parent 4581e2b7
...@@ -92,9 +92,6 @@ export default { ...@@ -92,9 +92,6 @@ export default {
// 隐藏Cesium logo // 隐藏Cesium logo
this.viewer._cesiumWidget._creditContainer.style.display = "none"; this.viewer._cesiumWidget._creditContainer.style.display = "none";
// var tilesetpath =
// "http://localhost:8080/Apps/assets/media/rushanruibo/tileset.json";
const VUE_APP_GIS = const VUE_APP_GIS =
"http://192.168.2.11:8080/Apps/assets/media/gaoquyingji"; "http://192.168.2.11:8080/Apps/assets/media/gaoquyingji";
try { try {
...@@ -103,29 +100,12 @@ export default { ...@@ -103,29 +100,12 @@ export default {
); );
this.viewer.scene.primitives.add(tileset); this.viewer.scene.primitives.add(tileset);
console.log("倾斜摄影模型加载成功", tileset); console.log("倾斜摄影模型加载成功tileset", tileset);
if (tileset) { if (tileset) {
this.tileset = tileset; this.tileset = tileset;
this.locateToTileset(); this.locateToTileset();
} }
// tileset.allTilesLoaded.addEventListener(() => {
// this.tileset = tileset;
// console.log("All tiles are loaded");
// this.locateToTileset();
// });
// // // 监听模型加载完成事件
// tileset.readyPromise
// .then(() => {
// this.locateToTileset();
// })
// .catch((error) => {
// console.error("定位到模型失败:", error);
// });
console.log("tileset", this.tileset);
} catch (error) { } catch (error) {
console.error(`加载倾斜摄影模型失败: ${error}`); console.error(`加载倾斜摄影模型失败: ${error}`);
} }
...@@ -180,7 +160,7 @@ export default { ...@@ -180,7 +160,7 @@ export default {
// 计算相机看向模型中心的方向 // 计算相机看向模型中心的方向
const heading = Cesium.Math.toRadians(0); // 方向角 const heading = Cesium.Math.toRadians(0); // 方向角
const pitch = Cesium.Math.toRadians(-60); // 俯仰角 - 负数表示向下看 const pitch = Cesium.Math.toRadians(-90); // 俯仰角 - 负数表示向下看
const roll = Cesium.Math.toRadians(0); // 翻滚角 const roll = Cesium.Math.toRadians(0); // 翻滚角
// 使用flyTo方法平滑过渡到目标位置 // 使用flyTo方法平滑过渡到目标位置
...@@ -196,16 +176,6 @@ export default { ...@@ -196,16 +176,6 @@ export default {
console.log("相机已成功定位到模型上方"); console.log("相机已成功定位到模型上方");
}, },
}); });
// 或者使用lookAt方法直接看向模型中心
// this.viewer.camera.lookAt(
// center,
// new Cesium.HeadingPitchRange(
// heading,
// pitch,
// distance
// )
// );
} catch (error) { } catch (error) {
console.error("定位到模型上方失败:", error); console.error("定位到模型上方失败:", error);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment