|
|
@@ -79,7 +79,10 @@
|
|
|
<script>
|
|
|
import * as Cesium from "../../Cesium";
|
|
|
import "../../Cesium/Widgets/widgets.css";
|
|
|
-import fjLonLatJson from "./fjLonLat1.json";
|
|
|
+import fjMYLonLatJson from "../fjLonLatJson/fj_MY1.json";
|
|
|
+import fjWHZLonLatJson from "../fjLonLatJson/fj_WHZ.json"; //京能旺海庄
|
|
|
+import fjYPLLonLatJson from "../fjLonLatJson/fj_YPL.json"; //京能营盘梁
|
|
|
+import mountainPosJson from "../fjLonLatJson/mountainPos.json";
|
|
|
import allStationJson from "./allStationJson.json";
|
|
|
import basicGeoJson from "../../assets/geoJson/basic.json";
|
|
|
import comModelDialog from "@/components/comModelDialog.vue";
|
|
|
@@ -105,7 +108,7 @@ import { WindLayer } from "cesium-wind";
|
|
|
import windGridData from "./windGridData.json";
|
|
|
import { HeightReference } from "cesium";
|
|
|
|
|
|
-import AdvancedBillboardGenerator from "@/tools/lightsign.js"
|
|
|
+import AdvancedBillboardGenerator from "@/tools/lightsign.js";
|
|
|
|
|
|
export default {
|
|
|
name: "windMap3D",
|
|
|
@@ -119,6 +122,23 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ restLatLon: [
|
|
|
+ {
|
|
|
+ longitude: 107.034945,
|
|
|
+ latitude: 37.309099,
|
|
|
+ name: "MYFDC",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ longitude: 112.88355172,
|
|
|
+ latitude: 40.46617836,
|
|
|
+ name: "JNWHZ",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ longitude: 112.5270545,
|
|
|
+ latitude: 40.35920334,
|
|
|
+ name: "JNYPL",
|
|
|
+ },
|
|
|
+ ],
|
|
|
loading: true,
|
|
|
viewer: null,
|
|
|
windLayer: null, // 风场图
|
|
|
@@ -187,9 +207,9 @@ export default {
|
|
|
// 展示场站
|
|
|
// this.showAllStation(viewer)
|
|
|
// 展示风机
|
|
|
- // this.initCesiumTerrain();
|
|
|
+ // this.initCesiumTerrain();
|
|
|
this.initCesiumBaseMapImage();
|
|
|
- // this.initGeoJsonData();
|
|
|
+ // this.initGeoJsonData();
|
|
|
this.showWindFromStation(viewer);
|
|
|
},
|
|
|
|
|
|
@@ -402,10 +422,25 @@ export default {
|
|
|
},
|
|
|
// 展示所选风场的风机
|
|
|
showWindFromStation(viewer) {
|
|
|
- this.infoBoxes = [];
|
|
|
+ let stationName = this.$route.query.nameEn;
|
|
|
+ let fjLonLatJson = [];
|
|
|
+ if (stationName === "MYFDC") {
|
|
|
+ fjLonLatJson = fjMYLonLatJson;
|
|
|
+ } else if (stationName === "JNWHZ") {
|
|
|
+ fjLonLatJson = fjWHZLonLatJson;
|
|
|
+ } else if (stationName === "JNYPL") {
|
|
|
+ fjLonLatJson = fjYPLLonLatJson;
|
|
|
+ }
|
|
|
fjLonLatJson.data.forEach((e, index) => {
|
|
|
this.showStatuswind(viewer, e);
|
|
|
});
|
|
|
+
|
|
|
+ // let mountainMsg = mountainPosJson.data.find(it => it.stationName === stationName)
|
|
|
+
|
|
|
+ // this.addTreeain(
|
|
|
+ // viewer,
|
|
|
+ // mountainMsg
|
|
|
+ // );
|
|
|
this.resetWindViewport();
|
|
|
},
|
|
|
// 根据状态展示不同颜色风机贴图
|
|
|
@@ -416,7 +451,7 @@ export default {
|
|
|
e.longitude,
|
|
|
e.latitude,
|
|
|
e.status,
|
|
|
- e.height || -5000,
|
|
|
+ e.heightS || 0,
|
|
|
e
|
|
|
);
|
|
|
},
|
|
|
@@ -452,9 +487,56 @@ export default {
|
|
|
return type === "en" ? "bw" : "并网";
|
|
|
}
|
|
|
},
|
|
|
+ addTreeain(viewer, mountainMsg) {
|
|
|
+ const hpRoll = new Cesium.HeadingPitchRoll(90.0, 0.0, 0.0);
|
|
|
+ const position = Cesium.Cartesian3.fromDegrees(
|
|
|
+ mountainMsg.longitude,
|
|
|
+ mountainMsg.latitude,
|
|
|
+ mountainMsg.height || 0
|
|
|
+ );
|
|
|
+
|
|
|
+ const orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ position,
|
|
|
+ hpRoll
|
|
|
+ );
|
|
|
+
|
|
|
+ const offsetLocal = new Cesium.Cartesian3(
|
|
|
+ mountainMsg.east,
|
|
|
+ mountainMsg.north,
|
|
|
+ mountainMsg.up
|
|
|
+ ); // E, N, U
|
|
|
+
|
|
|
+ const transform = Cesium.Transforms.eastNorthUpToFixedFrame(position);
|
|
|
+ const offsetGlobal = new Cesium.Cartesian3();
|
|
|
+ Cesium.Matrix4.multiplyByPointAsVector(
|
|
|
+ transform,
|
|
|
+ offsetLocal,
|
|
|
+ offsetGlobal
|
|
|
+ );
|
|
|
+
|
|
|
+ const finalPos = Cesium.Cartesian3.add(
|
|
|
+ position,
|
|
|
+ offsetGlobal,
|
|
|
+ new Cesium.Cartesian3()
|
|
|
+ );
|
|
|
+
|
|
|
+ const terrain = viewer.entities.add({
|
|
|
+ name: mountainMsg.modelName, // 模型名称
|
|
|
+ position: finalPos, // 模型位置
|
|
|
+ orientation, // 模型朝向
|
|
|
+ animation: false,
|
|
|
+ model: {
|
|
|
+ uri: `/public/static/model/dixing/${mountainMsg.modelNameEn}.glb`,
|
|
|
+ // uri: "/public/static/model/dixing/terrain.glb",
|
|
|
+ scale: mountainMsg.scale,
|
|
|
+ // 模型贴地
|
|
|
+ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
//添加模型
|
|
|
addModel(viewer, name, lon, lat, status, height, model) {
|
|
|
- const hpRoll = new Cesium.HeadingPitchRoll(90.0, 0.0, 0.0);
|
|
|
+ const hpRoll = new Cesium.HeadingPitchRoll(45.0, 0.0, 0.0);
|
|
|
const position = Cesium.Cartesian3.fromDegrees(lon, lat, height || 0);
|
|
|
const orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
position,
|
|
|
@@ -472,13 +554,14 @@ export default {
|
|
|
orientation, // 模型朝向
|
|
|
animation: false,
|
|
|
model: {
|
|
|
- uri: this.dixingAdd
|
|
|
- ? // ? "/public/static/model/fjSolo/model.glb"
|
|
|
- // ? "/public/static/model/fjStatus/fj_anmation_bw.glb"
|
|
|
- `/public/static/model/fjStatus/fj_${statueFJ}.glb`
|
|
|
- : "/public/static/model/dixing/model.glb",
|
|
|
- // : "/public/static/model/dixing/terrain.glb",
|
|
|
- scale: this.dixingAdd ? 20 : 10000,
|
|
|
+ // uri: this.dixingAdd
|
|
|
+ // ? // ? "/public/static/model/fjSolo/model.glb"
|
|
|
+ // // ? "/public/static/model/fjStatus/fj_anmation_bw.glb"
|
|
|
+ // `/public/static/model/fjStatus/fj_${statueFJ}.glb`
|
|
|
+ // : "/public/static/model/dixing/model.glb",
|
|
|
+ // // : "/public/static/model/dixing/terrain.glb",
|
|
|
+ uri: `/public/static/model/fjStatus/fj_${statueFJ}.glb`,
|
|
|
+ scale: 0.5,
|
|
|
// 模型贴地
|
|
|
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
// heightReference: Cesium.HeightReference.NONE,
|
|
|
@@ -486,6 +569,11 @@ export default {
|
|
|
// silhouetteColor: Cesium.Color.fromCssColorString(statueColor),
|
|
|
// runAnimations: wtStatue !== 7 ? false : true,
|
|
|
},
|
|
|
+ label: {
|
|
|
+ text: name,
|
|
|
+ font: "14px sans-serif",
|
|
|
+ fillColor: Cesium.Color.fromBytes(255, 255, 255),
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
// 使用高级灯牌生成器
|
|
|
@@ -515,51 +603,51 @@ export default {
|
|
|
borderGradient: ["#00e5ff", "#2979ff"],
|
|
|
});
|
|
|
|
|
|
- const entityxy = viewer.entities.add({
|
|
|
- name,
|
|
|
- position,
|
|
|
- billboard: {
|
|
|
- image: billboardImage,
|
|
|
- scale: 1,
|
|
|
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 原来已经是CENTER,现在改为BOTTOM
|
|
|
- pixelOffset: new Cesium.Cartesian2(80, -50), // 原来是-20,现在改为30,向上移动
|
|
|
- eyeOffset: new Cesium.Cartesian3(0, 0, 0), // 保持固定大小
|
|
|
- heightReference: Cesium.HeightReference.NONE,
|
|
|
- },
|
|
|
- });
|
|
|
+ // const entityxy = viewer.entities.add({
|
|
|
+ // name,
|
|
|
+ // position,
|
|
|
+ // billboard: {
|
|
|
+ // image: billboardImage,
|
|
|
+ // scale: 1,
|
|
|
+ // verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 原来已经是CENTER,现在改为BOTTOM
|
|
|
+ // pixelOffset: new Cesium.Cartesian2(80, -50), // 原来是-20,现在改为30,向上移动
|
|
|
+ // eyeOffset: new Cesium.Cartesian3(0, 0, 0), // 保持固定大小
|
|
|
+ // heightReference: Cesium.HeightReference.NONE,
|
|
|
+ // },
|
|
|
+ // });
|
|
|
|
|
|
this.dixingAdd = true;
|
|
|
|
|
|
- const btn = document.getElementById("windBtn")
|
|
|
+ const btn = document.getElementById("windBtn");
|
|
|
|
|
|
- btn.addEventListener('click', function(event) {
|
|
|
+ btn.addEventListener("click", function (event) {
|
|
|
entityxy.show = !entityxy.show;
|
|
|
});
|
|
|
|
|
|
- // viewer.camera.moveEnd.addEventListener(() => {
|
|
|
- // // 获取相机的笛卡尔3D坐标
|
|
|
- // const position = viewer.camera.position;
|
|
|
-
|
|
|
- // // 将笛卡尔坐标转换为地理坐标(弧度)
|
|
|
- // const cartographic = Cesium.Cartographic.fromCartesian(position);
|
|
|
-
|
|
|
- // // 高度(以米为单位)
|
|
|
- // // 注意:这个高度是相对于WGS84椭球体的高度,不是海拔高度(MSL)
|
|
|
- // const height = Cesium.Math.toDegrees(cartographic.height);
|
|
|
- // if (height > 3000000) {
|
|
|
- // entityxy.show = false;
|
|
|
- // console.log("entityxy false", entityxy.show);
|
|
|
- // }
|
|
|
- // if (height < 3000000) {
|
|
|
- // entityxy.show = true;
|
|
|
- // console.log("entityxy true", entityxy.show);
|
|
|
- // }
|
|
|
- // // 强制请求一次场景重绘
|
|
|
- // if (viewer && viewer.scene) {
|
|
|
- // viewer.scene.requestRender();
|
|
|
- // }
|
|
|
- // console.log("相机高度 (椭球体高):", height, "米");
|
|
|
- // });
|
|
|
+ // viewer.camera.moveEnd.addEventListener(() => {
|
|
|
+ // // 获取相机的笛卡尔3D坐标
|
|
|
+ // const position = viewer.camera.position;
|
|
|
+
|
|
|
+ // // 将笛卡尔坐标转换为地理坐标(弧度)
|
|
|
+ // const cartographic = Cesium.Cartographic.fromCartesian(position);
|
|
|
+
|
|
|
+ // // 高度(以米为单位)
|
|
|
+ // // 注意:这个高度是相对于WGS84椭球体的高度,不是海拔高度(MSL)
|
|
|
+ // const height = Cesium.Math.toDegrees(cartographic.height);
|
|
|
+ // if (height > 3000000) {
|
|
|
+ // entityxy.show = false;
|
|
|
+ // console.log("entityxy false", entityxy.show);
|
|
|
+ // }
|
|
|
+ // if (height < 3000000) {
|
|
|
+ // entityxy.show = true;
|
|
|
+ // console.log("entityxy true", entityxy.show);
|
|
|
+ // }
|
|
|
+ // // 强制请求一次场景重绘
|
|
|
+ // if (viewer && viewer.scene) {
|
|
|
+ // viewer.scene.requestRender();
|
|
|
+ // }
|
|
|
+ // console.log("相机高度 (椭球体高):", height, "米");
|
|
|
+ // });
|
|
|
|
|
|
// 创建事件处理器
|
|
|
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
|
@@ -854,6 +942,7 @@ export default {
|
|
|
let fromLon = this.$route.query.longitude * 1;
|
|
|
let fromLat = this.$route.query.latitude * 1;
|
|
|
let fromheight = this.$route.query.height * 1;
|
|
|
+ let fromname = this.$route.query.nameEn;
|
|
|
// 设置镜头到指定的经纬度(度)、高度(米)
|
|
|
this.viewer.camera.setView({
|
|
|
destination: Cesium.Cartesian3.fromDegrees(
|
|
|
@@ -868,9 +957,17 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
// 目标位置:经度、纬度、高度
|
|
|
- const targetLon = 107.034945;
|
|
|
- const targetLat = 37.309099;
|
|
|
- const targetHeight = 30000;
|
|
|
+ // const targetLon = 107.034945;
|
|
|
+ // const targetLat = 37.309099;
|
|
|
+ let targetLon = null;
|
|
|
+ let targetLat = null;
|
|
|
+ this.restLatLon.forEach((it) => {
|
|
|
+ if (it.name === fromname) {
|
|
|
+ targetLon = it.longitude;
|
|
|
+ targetLat = it.latitude;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const targetHeight = 10000;
|
|
|
|
|
|
const draggableHeightTolerance = 5000; // 允许拖拽的高度范围:20,000 ~ 30,000
|
|
|
const minHeight = 5000; // 最低高度
|
|
|
@@ -899,7 +996,7 @@ export default {
|
|
|
// },
|
|
|
orientation: {
|
|
|
heading: 0, //北京天安门角度 0 上海角度 1
|
|
|
- pitch: -0.7,
|
|
|
+ pitch: -0.3,
|
|
|
roll: 0,
|
|
|
},
|
|
|
duration: 3.0,
|