Commit 249f3edb authored by xinzhedeai's avatar xinzhedeai

add:tilesetjson

parent ec0d00ec
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
/** /**
* 初始化Cesium地图 * 初始化Cesium地图
*/ */
initCesium() { async initCesium() {
Cesium.Ion.defaultAccessToken = Cesium.Ion.defaultAccessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0ZDAxZGFhYy02MjJlLTRiNzktODNhZi00N2VjZGY0NTk4YmIiLCJpZCI6Mjc0NDAxLCJpYXQiOjE3NjMzNDYwNTR9.ZQW2DZ4KaMGbHuwrtIbyI6EdSSvgMJUHmmD74eZW7PQ"; "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0ZDAxZGFhYy02MjJlLTRiNzktODNhZi00N2VjZGY0NTk4YmIiLCJpZCI6Mjc0NDAxLCJpYXQiOjE3NjMzNDYwNTR9.ZQW2DZ4KaMGbHuwrtIbyI6EdSSvgMJUHmmD74eZW7PQ";
try { try {
...@@ -64,18 +64,49 @@ export default { ...@@ -64,18 +64,49 @@ export default {
}); });
// 设置相机视图 // 设置相机视图
this.viewer.camera.setView({ // this.viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(104.06, 30.67, 10000000), // 经度、纬度、高度 // destination: Cesium.Cartesian3.fromDegrees(104.06, 30.67, 10000000), // 经度、纬度、高度
// orientation: {
// heading: Cesium.Math.toRadians(0.0), // 方向
// pitch: Cesium.Math.toRadians(-90.0), // 倾斜角度
// roll: 0.0, // 翻滚角度
// },
// });
this.viewer.scene.camera.setView({
// 视角-环翠
duration: 1,
destination: {
x: -2739843.563038797,
y: 4357442.794747324,
z: 3880768.3292693933,
},
orientation: { orientation: {
heading: Cesium.Math.toRadians(0.0), // 方向 heading: 6.037000745578596,
pitch: Cesium.Math.toRadians(-90.0), // 倾斜角度 pitch: -1.2499586064720978,
roll: 0.0, // 翻滚角度 roll: 0.000005306352659495417,
}, },
}); });
// 隐藏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 =
"http://192.168.2.11:8080/Apps/assets/media/gaoquyingji";
try {
const tileset = await Cesium.Cesium3DTileset.fromUrl(
VUE_APP_GIS + "/tiles/01_guanwei/tileset.json"
);
this.viewer.scene.primitives.add(tileset);
console.log("tileset", tileset);
} catch (error) {
console.error(`Error creating tileset: ${error}`);
}
console.log("Cesium地图初始化成功"); console.log("Cesium地图初始化成功");
} catch (error) { } catch (error) {
console.error("Cesium地图初始化失败:", error); console.error("Cesium地图初始化失败:", 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