| | |
| | | <div class="zoom-info"> |
| | | <el-tag type="success">倍率: {{ zoomRatio.toFixed(1) }}X</el-tag><br> |
| | | <el-tag type="success">距离: {{ betweenDistance.toFixed(1) }}米</el-tag><br> |
| | | <el-tag type="success">P: {{ cameraP.toFixed(1) }} T: {{ cameraT.toFixed(1) }} </el-tag> |
| | | <el-tag type="success">P: {{ cameraP }} T: {{ cameraT }} </el-tag> |
| | | </div> |
| | | |
| | | |
| | |
| | | }, |
| | | betweenDistance:0, |
| | | cameraP:0.0, |
| | | cameraT:0.0 |
| | | cameraT:0.0, |
| | | pointGround: { lon: 0, lat: 0, height: 0 }, |
| | | pointFly: { lon: 0, lat: 0, height: 0 }, |
| | | } |
| | | }, |
| | | mounted(){ |
| | |
| | | let data = { |
| | | "altitude": Cesium.Cartographic.fromCartesian(tagert).height, |
| | | "id": chooseId, |
| | | 'name':`空中点${counter}`, |
| | | "latitude": Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).latitude), |
| | | "longitude": Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).longitude), |
| | | } |
| | |
| | | //塔的距离和观测点的距离 |
| | | console.log(_this.deviceData) |
| | | const point1 = Cesium.Cartesian3.fromDegrees(0, 0, _this.deviceData?.modelHeight || 45); |
| | | _this.pointGround = { |
| | | lon:longitude, |
| | | lat:latitude, |
| | | height:height |
| | | } |
| | | // const point1 = Cesium.Cartesian3.fromDegrees(0, 0, 45); |
| | | const point2 = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).longitude), Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).latitude), Cesium.Cartographic.fromCartesian(tagert).height); |
| | | |
| | | _this.pointFly = { |
| | | lon:Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).longitude), |
| | | lat:Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).latitude), |
| | | height:Cesium.Cartographic.fromCartesian(tagert).height |
| | | } |
| | | _this.createDashedLine() |
| | | _this.createBillboard() |
| | | // 计算距离(单位:米) |
| | | const distanceCalculate = Cesium.Cartesian3.distance(point1, point2) |
| | | data.distance = distanceCalculate |
| | |
| | | } |
| | | console.log('右键点击监听已停止'); |
| | | }, Cesium.ScreenSpaceEventType.RIGHT_CLICK); // 监听右键点击 |
| | | }, |
| | | createDashedLine() { |
| | | this.lineEntity = viewerM.entities.add({ |
| | | polyline: { |
| | | positions: new Cesium.CallbackProperty(() => { |
| | | return Cesium.Cartesian3.fromDegreesArrayHeights([ |
| | | this.pointGround.lon, this.pointGround.lat, this.pointGround.height, |
| | | this.pointFly.lon, this.pointFly.lat, this.pointFly.height, |
| | | ]); |
| | | }, false), |
| | | width: 3, |
| | | material: new Cesium.PolylineDashMaterialProperty({ |
| | | color: Cesium.Color.RED, |
| | | }), |
| | | }, |
| | | }); |
| | | }, |
| | | createBillboard() { |
| | | // Billboard 中点计算 |
| | | viewerM.entities.add({ |
| | | position: new Cesium.CallbackProperty(() => { |
| | | const midLon = (this.pointGround.lon + this.pointFly.lon) / 2; |
| | | const midLat = (this.pointGround.lat + this.pointFly.lat) / 2; |
| | | const midHeight = (this.pointGround.height + this.pointFly.height) / 2; |
| | | return Cesium.Cartesian3.fromDegrees(midLon, midLat, midHeight); |
| | | }, false), |
| | | label: { |
| | | text: new Cesium.CallbackProperty(() => { |
| | | return `距离: ${this.betweenDistance.toFixed(1)} m\nP: ${this.cameraP}\nT:${this.cameraT}`; |
| | | }, false), |
| | | font: "16px sans-serif", |
| | | fillColor: Cesium.Color.BLACK, |
| | | outlineColor: Cesium.Color.WHITE, |
| | | outlineWidth: 2, |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | verticalOrigin: Cesium.VerticalOrigin.BOTTOM, |
| | | horizontalOrigin: Cesium.HorizontalOrigin.CENTER, |
| | | pixelOffset: new Cesium.Cartesian2(0, -20), // 向上偏移 |
| | | showBackground: true, |
| | | backgroundColor: new Cesium.Color(1, 1, 1, 0.7), |
| | | }, |
| | | }); |
| | | }, |
| | | azimuthtwopoi(x1, y1, x2, y2) { |
| | | let result; |
| | |
| | | const gure = Cesium.Cartesian3.distance(point1, point2) |
| | | this.betweenDistance = gure |
| | | } |
| | | |
| | | this.pointFly = { |
| | | lon: lon, |
| | | lat: lat, |
| | | height: height |
| | | } |
| | | this.dealTree() |
| | | } |
| | | const key = event.key; |
| | |
| | | // viewer.scene.primitives.add(cameraVideo); |
| | | let pmObj = {}; |
| | | pmObj.id = data.id; |
| | | pmObj.name = data.name; |
| | | pmObj.primitive = cameraVideo; |
| | | viewerM.scene.primitives.add(cameraVideo); |
| | | preVideoScopePrimitiveArrTie.push(pmObj); |
| | |
| | | ',' + |
| | | roll.toFixed(1) + |
| | | '\u00B0'; |
| | | console.log(heading) |
| | | this.cameraP = heading.toFixed(2) |
| | | this.cameraT = pitch.toFixed(2) |
| | | document.getElementById('cammoveResultCon').innerHTML = camResult; |
| | | // 计算距离(单位:米) |
| | | const distanceBetween = Cesium.Cartesian3.distance(point1, point2) |
| | | console.log(preVideoScopePrimitiveArrTie) |
| | | preVideoScopePrimitiveArrTie.map((item)=>{ |
| | | if(item.id == chooseId){ |
| | | let obj = this.updateSZScope(Cesium.Math.toDegrees(position.longitude),Cesium.Math.toDegrees(position.latitude),position.height,heading,pitch,roll,this.zoomRatio,distanceBetween) |
| | |
| | | Cesium.Cartesian3.normalize(directionLocal, directionLocal); |
| | | return Math.asin(directionLocal.z); // z轴向上 |
| | | }, |
| | | DealVisualCone(data,node){ |
| | | if(data.children && data.children?.length > 0) { |
| | | preVideoScopePrimitiveArrTie.map((item)=>{ |
| | | if(item.name != data.children[0].label){ |
| | | item.primitive.show = false |
| | | }else{ |
| | | item.primitive.show = true |
| | | } |
| | | }) |
| | | }else { |
| | | preVideoScopePrimitiveArrTie.map((item)=>{ |
| | | if(item.name != data.label){ |
| | | item.primitive.show = false |
| | | }else { |
| | | item.primitive.show = true |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |