From f03ea598d39abceac4eeb5f3a10b1fe7dd706b2c Mon Sep 17 00:00:00 2001 From: jihongshun <1151753686@qq.com> Date: 星期五, 25 七月 2025 16:48:31 +0800 Subject: [PATCH] 光轴 --- src/utils/components/init-map.vue | 476 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 390 insertions(+), 86 deletions(-) diff --git a/src/utils/components/init-map.vue b/src/utils/components/init-map.vue index f26094c..36e654f 100644 --- a/src/utils/components/init-map.vue +++ b/src/utils/components/init-map.vue @@ -8,12 +8,65 @@ <div class="cesiumBotton"> <div class="cesiumButtonGroup"> <el-button id="groundPoi" @click="addGroundPoi()" type="primary">鍦伴潰鐐�</el-button> - <el-button id="groundPoi" @click="addGroundPoi()" type="primary">绌轰腑鐐�</el-button> - <el-button id="groundPoi" @click="addGroundPoi()" type="primary">鍋滅暀鏃堕棿</el-button> + <!-- <el-button id="groundPoi" @click="addGroundPoi()" type="primary">鍋滅暀鏃堕棿</el-button> --> <el-input v-model="mergeNumber" placeholder="璇疯緭鍏ュ悎骞惰寖鍥�" type="number" style="width: 150px;"></el-input> <el-button @click="mergePoint()" type="success">鍚堝苟</el-button> + <el-button @click="renderData()" type="success">鏁版嵁娓叉煋</el-button> + <el-button @click="VisualCone()" type="success">鐢熸垚瑙嗛敟浣�</el-button> + <el-button @click="fly()" type="success">椋炲埌鎸囧畾鍦扮偣</el-button> </div> + <!-- <div class="key-container"> + <div class="arrow-row"> + <div + class="arrow" + :class="{ active: activeKey === 'w' }" + >W</div> + </div> + <div class="key-row"> + <div + class="key" + :class="{ active: activeKey === 'a' }" + @mousedown="handleClick('a')" + >A</div> + <div + class="key" + :class="{ active: activeKey === 's' }" + @mousedown="handleClick('s')" + >S</div> + <div + class="key" + :class="{ active: activeKey === 'd' }" + @mousedown="handleClick('d')" + >D</div> + </div> + </div> + <div class="key-container"> + <div class="arrow-row"> + <div + class="arrow" + :class="{ active: activeKey === 'ArrowUp' }" + @mousedown="handleClick('ArrowUp')" + >鈫�</div> + </div> + <div class="key-row"> + <div + class="key" + :class="{ active: activeKey === 'ArrowLeft' }" + @mousedown="handleClick('ArrowLeft')" + >鈫�</div> + <div + class="key" + :class="{ active: activeKey === 'ArrowDown' }" + @mousedown="handleClick('ArrowDown')" + >鈫�</div> + <div + class="key" + :class="{ active: activeKey === 'ArrowRight' }" + @mousedown="handleClick('ArrowRight')" + >鈫�</div> + </div> + </div> --> </div> <!-- 鍔ㄦ�佸潗鏍囥�佸姩鎬佺浉鏈哄弬鏁版樉绀� --> @@ -36,12 +89,27 @@ let viewerM; let viewerC; let counter = 0; -let pois = [125.1541, 46.5542,0] +let globalon = 0 +let globalat = 0 +let pois = [globalon, globalat,0] +let cameraVideo +let ScopeElement; //鍏夎酱銆佽棰� +let preVideoScopePrimitiveArrTie = []; +let scratchSetViewMatrix3 = new Cesium.Matrix3(); + +// let pois = [0, 0,0] let holdingPosition; let rightKeyMove = false -// let pois = [125.1541, 46.5542,0] let distance = 100; export default { + props: { + towerUrl: { + type: String, + default() { + return '' + } + }, + }, data(){ return{ moveSpeed: 1, @@ -63,35 +131,40 @@ space: false, }, animationFrameId: null, - mergeNumber:null + mergeNumber:null, + activeKey: null, + timer: null, } }, mounted(){ - console.log('111111111111111111') this.initCesium(); }, beforeDestroy() { + counter = 0 this.removeKeyboardEvents(); if (this.animationFrameId) cancelAnimationFrame(this.animationFrameId); + window.removeEventListener("keydown", this.handleKeydown); if (viewerC) viewerC.destroy(); }, methods:{ initCesium() { viewerM = this.initViewer(this.$refs.cesiumContainer.id); viewerC = this.initViewer(this.$refs.cesiumCamera.id); + window.viewerM = viewerM; + window.viewerC = viewerC; // 馃挕 鍦ㄨ繖閲岀户缁皟鐢� measure.js / camera.js / botton.js 绛夐�昏緫 // 渚嬪锛歸indow.registerMeasureTools(viewerM) setTimeout(()=>{ this.loadModel() this.addSyncListener() this.registerKeyboardEvents(); - let control = viewerC.scene.screenSpaceCameraController; control.enableRotate = false; control.enableTranslate = false; control.enableZoom = false; control.enableTilt = false; control.enableLook = false; + viewerC.scene.camera.percentageChanged = 0.05聽 this.cammove_measure_point(); },1000) }, @@ -108,8 +181,6 @@ initViewer(cesiumId){ //cesium鍏ㄧ悆30绫冲垎杈ㄧ巼鍦板舰璧勬簮token let imageryProvider1 = new Cesium.TileMapServiceImageryProvider({ - // url: process.env.VUE_APP_BASE_GIS + "/daqing/dom-sea", - // url: process.env.VUE_APP_BASE_GIS + "/daqing/dom-sea", url: `https://192.168.1.2:9999/daqing/dom-sea/`, }); let viewer = new Cesium.Viewer(cesiumId, { @@ -124,6 +195,7 @@ navigationHelpButton: false, navigationInstructionsInitiallyVisible: false, imageryProvider: imageryProvider1, + // imageryProvider: false, shadows: false, animation: false, infoBox: false, @@ -132,14 +204,19 @@ fullscreenButton: false, vrButton: false, }); - window.viewer = viewer; + // 鍏抽棴澶╃┖鐩掓晥鏋� + // viewer.scene.skyAtmosphere = undefined; // 鎴栬�呰缃负 null + + // // 鍏抽棴鍏夌収鏁堟灉 + // viewer.scene.globe.enableLighting = false; // 鍏抽棴鍏夌収鏁堟灉 + // viewer.imageryLayers.add(bdtvectoranoimagery); viewer._cesiumWidget._creditContainer.style.display="none"; return viewer; }, loadModel(){ - const modelUrl = 'http://192.168.1.2:9001/model/tower.glb'; // GLB妯″瀷璺緞 + const modelUrl = this.towerUrl; // GLB妯″瀷璺緞 // 娌垮師鐐瑰潗鏍囧拰鍦伴潰鐐瑰潗鏍囨柟鍚戜笂閫夊彇绌轰腑鐐圭殑璺濈 //鍒濆鍖栫浉鏈虹獥鍙h瑙掑弬鏁� cameraPostion = viewerM.camera.position @@ -149,17 +226,18 @@ // 璁剧疆瑙嗚锛屼娇鍏堕粯璁ゆ煡鐪嬫煇涓湴鐞嗕綅缃� viewerM.scene.camera.setView({ - destination: Cesium.Cartesian3.fromDegrees(125.1511, 46.5542, 349.0), // 浠ョ粡绾害璁剧疆浣嶇疆锛堜緥濡傦細澶у簡榫欏叴璺級 + destination: Cesium.Cartesian3.fromDegrees(globalon, globalat, 349.0), // 浠ョ粡绾害璁剧疆浣嶇疆锛堜緥濡傦細澶у簡榫欏叴璺級 + // destination: Cesium.Cartesian3.fromDegrees(0.0005, 0.0017, 207.8), // 浠ョ粡绾害璁剧疆浣嶇疆锛堜緥濡傦細澶у簡榫欏叴璺級 orientation: { - heading: Cesium.Math.toRadians(86.94), // 鏂瑰悜 - pitch: Cesium.Math.toRadians(-30.22), // 淇 + heading: Cesium.Math.toRadians(194.65), // 鏂瑰悜 + pitch: Cesium.Math.toRadians(-31.43), // 淇 roll: 0 } }); //鍒涘缓妯″瀷 const glbModelPoi = Cesium.Cartesian3.fromDegrees(pois[0], pois[1],pois[2]); - const heading = Cesium.Math.toRadians(10); + const heading = Cesium.Math.toRadians(0); const pitch = Cesium.Math.toRadians(0); const roll = Cesium.Math.toRadians(0); const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll); @@ -174,7 +252,6 @@ orientation: orientations, model: { uri: url, - scale: 20, shadows: Cesium.ShadowMode.DISABLED, imageBasedLightingFactor: new Cesium.Cartesian2(1, 0.5) } @@ -184,6 +261,7 @@ // 瀛樹笅鍥炶皟浠ヤ究閿�姣� // this._preRenderCallback = () => this.syncViewer(); viewerM.scene.preRender.addEventListener( this.syncViewer()); + window.addEventListener("keydown", this.handleKeydown); }, syncViewer(){ console.log(viewerM.camera) @@ -214,9 +292,6 @@ } }, addGroundPoi() { - console.log('1111111111111111') - console.log(new Cesium.ScreenSpaceEventHandler(viewerM.canvas)) - console.log(this) let createPinHandler = new Cesium.ScreenSpaceEventHandler(viewerM.canvas); let _this = this createPinHandler.setInputAction(function (click) { @@ -232,7 +307,6 @@ let lng = Cesium.Math.toDegrees(cartographic.longitude); let lat = Cesium.Math.toDegrees(cartographic.latitude); height = cartographic.height; - // camPosition = lng+','+lat+','+height; console.log(lng+','+lat+','+height) } @@ -263,45 +337,43 @@ 聽聽聽聽const scalerNormalize聽=聽Cesium.Cartesian3.multiplyByScalar(normalize,distance,new聽Cesium.Cartesian3()); const tagert = Cesium.Cartesian3.add(holdingPosition,scalerNormalize,new聽Cesium.Cartesian3()); console.log(Cesium.Cartographic.fromCartesian(tagert)) - var airCartographic= Cesium.Cartographic.fromCartesian(tagert) - var airPointLongitude= Cesium.Math.toDegrees(airCartographic.longitude); - var airPointLatitude = Cesium.Math.toDegrees(airCartographic.latitude); - var airPointHeight = airCartographic.height; _this.creatPin("aerialPoiId"+counter,tagert,`绌�${counter}`,Cesium.Color.RED,viewerM); + preVideoScopePrimitiveArrTie = [] + console.log(Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).height)) _this.updateCameraMovement(); - // console.log(direction) - // console.log(normalize聽) - // console.log(longitude) - // console.log(latitude) - // console.log(pois) - // console.log(azimuthtwopoi(longitude,latitude,pois[0],pois[1])) - // let data = { - // id:(Date.now().toString(16) + Math.random().toString(16).slice(2, 10)).slice(0, 16), - // label:`鍦伴潰鐐�${counter}`, - // longitude:longitude, - // latitude:latitude, - // height:height, - // children:[ - // { - // id:(Date.now().toString(16) + Math.random().toString(16).slice(2, 10)).slice(0, 16), - // label:`绌轰腑鐐�${counter}`, - // longitude:airPointLongitude, - // latitude:airPointLatitude, - // height:airPointHeight, - // } - // ] - // } - // _this.$emit('rightClickEnd',data) + if(cameraVideo){ + viewerM.scene.primitives.remove(cameraVideo) + } + //鍒涘缓瑙嗛敟浣� + let data = { + "FHorFieldAngle": 32.13, + "FVerFieldAngle": 18.39, + "altitude": Cesium.Cartographic.fromCartesian(tagert).height, + "id": "111111", + "chanNo": 1, + "latitude": Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).latitude), + "longitude": Cesium.Math.toDegrees(Cesium.Cartographic.fromCartesian(tagert).longitude), + "p": 26.8, + "t": 351.3, + "z": 1, + } + const point1 = Cesium.Cartesian3.fromDegrees(0, 0, 50); + 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); + + // 璁$畻璺濈锛堝崟浣嶏細绫筹級 + const distance1 = Cesium.Cartesian3.distance(point1, point2) + console.log(distance1) + data.distance = distance1 + _this.createVideoScope(data) + setTimeout(() => { + viewerC.camera.changed.addEventListener(_this.onCameraChange) + }, 100); + + //缁撴潫鍙抽敭鐩戝惉 createPinHandler.destroy(); //缁撴潫涓诲浘鑱斿姩楣扮溂鐩戝惉 viewerM.scene.preRender.removeEventListener(_this.syncViewer()); - // viewerM.scene.preRender.removeEventListener(this._preRenderCallback); - // if (this._preRenderCallback) { - // this.viewerM.scene.preRender.removeEventListener(this._preRenderCallback); - // this._preRenderCallback = null; - // } - //鏇存柊鐩告満瑙嗚涓虹┖涓偣 _this.changeCamera(tagert,_this.azimuthtwopoi(longitude,latitude,pois[0],pois[1])); rightKeyMove = true counter += 1; @@ -341,7 +413,6 @@ }); }, registerKeyboardEvents() { - console.log('11111111111111111111111') window.addEventListener("keydown", this.onKeyDown); window.addEventListener("keyup", this.onKeyUp); }, @@ -401,9 +472,6 @@ case "1": viewerC.scene.mode = Cesium.SceneMode.SCENE3D; break; - // case "2": - // viewerC.scene.mode = Cesium.SceneMode.SCENE2D; - // break; case "3": viewerC.scene.mode = Cesium.SceneMode.COLUMBUS_VIEW; break; @@ -411,22 +479,16 @@ }, onKeyUp(event) { //閿洏鎶捣杩涜鏇存柊宸︿晶绌轰腑鐐筽in - console.log(viewerM) - console.log(counter) //鑾峰彇鍙充晶鐩告満 if(rightKeyMove){ const camera = viewerC.camera; - console.log(camera) const carto = Cesium.Cartographic.fromCartesian(camera.position); - console.log(carto) //鍙充晶鐩告満瑙嗚杞寲涓虹粡绾害 const lon = Cesium.Math.toDegrees(carto.longitude); const lat = Cesium.Math.toDegrees(carto.latitude); const height = carto.height; const position = Cesium.Cartesian3.fromDegrees(lon, lat, height) - console.log(position) let pinBuilder = new Cesium.PinBuilder(); - // const dest = this.calculateDestinationPoint(lon, lat, camera.heading, speed); const groupEntity = viewerM.entities.getById("aerialPoiId"+(counter-1)); //宸︿晶鍦板浘鍚屾鏇存柊pin绌轰腑鐐逛綅缃� if (groupEntity == undefined) { @@ -521,17 +583,8 @@ let rotSpeed = 1; if (this.keyState.shift) rotSpeed *= this.speedMultiplier; if (this.keyState.ctrl) rotSpeed *= this.slowMultiplier; - const multiplyByScalarrotateAmount = Cesium.Math.toRadians(0.5 * rotSpeed); - - // if (this.keyState.up) camera.lookUp(rotateAmount); - // if (this.keyState.down) camera.lookDown(rotateAmount); - // if (this.keyState.left) camera.lookLeft(rotateAmount); - // if (this.keyState.right) camera.lookRight(rotateAmount); if (holdingPosition) { - // const groupPosition = groupEntity.position.getValue(Cesium.JulianDate.now()); - // console.log(groupPosition) const distance = Cesium.Cartesian3.distance(holdingPosition, camera.position); - const surroundSpeed = 0.005; //鐜粫閫熷害,瑙掑害 let cameraHeading = camera.heading; let cameraPitch = camera.pitch; @@ -548,9 +601,8 @@ if (this.keyState.right) camera.lookRight(rotateAmount); } this.resetRoll(); - // Schedule next frame - this.animationFrameId = requestAnimationFrame(this.updateCameraMovement); + // this.animationFrameId = requestAnimationFrame(this.updateCameraMovement); }, calculateDestinationPoint(lon1, lat1, bearing, distance, radius = 6371000) { const toRad = (d) => d * Math.PI / 180; @@ -573,9 +625,7 @@ return { lon: toDeg(lon2Norm), lat: toDeg(lat2Rad) }; }, - uavMoveForward(speed) { - console.log('11111' +speed) const camera = viewerC.camera; const carto = Cesium.Cartographic.fromCartesian(camera.position); const lon = Cesium.Math.toDegrees(carto.longitude); @@ -621,20 +671,16 @@ viewerC.camera.flyHome(1.0); }, move_measure_point(){ - CesiumSurvey.measureMovePoint(viewerM,'moveResultCon'); + CesiumSurvey.measureMovePoint(viewerC,'moveResultCon'); }, cammove_measure_point(){ - CesiumSurvey.cammeasureMovePoint(viewerM,'cammoveResultCon'); + CesiumSurvey.cammeasureMovePoint(viewerC,'cammoveResultCon'); + }, + renderData(){ + this.$emit('renderData',viewerM) }, mergePoint(){ let allEntities = viewerM.entities.values; // 鎵�鏈夊疄浣撳璞$粍鎴愮殑鏁扮粍 - console.log(allEntities) - allEntities.forEach(entity => { - console.log('ID:', entity.id); - console.log('Position:', entity.position ? entity.position.getValue(Cesium.JulianDate.now()) : null); - console.log('Name:', entity.name); - console.log('Properties:', entity.properties); // 鑷畾涔夊睘鎬� - }); const grouped = {}; //鎵�鏈夊疄浣撳璞$粍鎴愮殑鏁扮粍杞崲鎴愬乏渚ф爲闇�瑕佺殑鏍煎紡 allEntities.forEach(item => { @@ -683,7 +729,222 @@ latitude: Cesium.Math.toDegrees(cartographic.latitude), height: cartographic.height }; - } + }, + handleClick(key) { + this.triggerKey(key); + }, + triggerKey(key) { + this.activeKey = key; + clearTimeout(this.timer); + this.timer = setTimeout(() => { + this.activeKey = null; + }, 200); + + // 鑷畾涔夊姩浣滆Е鍙� + console.log("Key triggered:", key); + // 杩欓噷鍙互鍙戝嚭浜嬩欢鎴栬皟鐢ㄥ叾瀹冩柟娉� + }, + handleKeydown(e) { + const key = e.key; + console.log(key) + const validKeys = ["a", "s", "d", "w",'q','e','ArrowUp','ArrowDown','ArrowLeft','ArrowRight','q','e']; + if (validKeys.includes(key)) { + this.triggerKey(key); + } + this.updateCameraMovement() + }, + VisualCone(){ + let data = { + "FHorFieldAngle": 32.13, + "FVerFieldAngle": 18.39, + "altitude": 55, + "cameraId": "fdae8144e0fc47cf95152080eb3f7db3", + "chanNo": 1, + "latitude": 46.58528798, + "longitude": 124.9662813, + "p": 26.8, + "t": 351.3, + "z": 1 + } + }, + // 鍒涘缓鍒濆鍖栫殑鍏夎酱 + createVideoScope(data) { + console.log(data) + console.log(data.distance) + if (data == undefined) { + this.$message({ + showClose: true, + message: '鏆傛棤鏁版嵁', + type: "warning", + }); + } else { + ScopeElement = this.createVideoElementOld( + "http://192.168.5.122:9998/live?port=1234&app=live&stream=mystream", + data.id, + 1.7778 + ); + // let poi = data.camPosition.split(","); + // let hight = data.pe_offset.split(","); + let positionCt3 = Cesium.Cartesian3.fromDegrees( + Number(data.longitude), + Number(data.latitude), + // Number(data.altitude) + Number(hight[1]) + 1.7 + Number(data.altitude) + ); + console.log(data) + let inverseViewMatrix = this.hpr2m({ + position: positionCt3, // 鐩告満鍧愭爣 + // heading: Cesium.Math.toRadians(Number(120)), + // pitch: Cesium.Math.toRadians(Number(-5)), + // roll: Cesium.Math.toRadians(Number(0)), + heading: Cesium.Math.toRadians(180), + pitch: Cesium.Math.toRadians(0), + roll: Cesium.Math.toRadians(0), + }); + let frustum = new Cesium.PerspectiveFrustum({ + fov: Cesium.Math.toRadians(6), + aspectRatio: Number(1.77778), // 瀹介珮姣� + near: Number(0.05), // 璁惧鐒﹁窛 + far: Number(data.distance), // 鎷嶆憚璺濈 + }); + cameraVideo = new Cesium.XbsjCameraVideo({ + inverseViewMatrix: inverseViewMatrix, + frustum: frustum, + videoElement: ScopeElement, + showHelperPrimitive: true, + }); + cameraVideo._primitive.classificationType = 2; //聽鍚屾椂鎶曞奖鍦板舰鍜�3dtiles鏁版嵁 + cameraVideo.id = "sz" + data.id; + let isHole = false; + cameraVideo._primitive.appearance.material = new Cesium.Material({ + fabric: { + type: "Color", + uniforms: { + color: new Cesium.Color(0, 1, 0, 0.2), + }, + }, + }); + cameraVideo._helperPrimitive.geometryInstances.attributes.color = + Cesium.ColorGeometryInstanceAttribute.fromColor( + new Cesium.Color(0, 1.0, 0, 1.0) + ); + // viewer.scene.primitives.add(cameraVideo); + let pmObj = {}; + console.log(data) + pmObj.id = "sz" + data.id; + console.log(pmObj) + pmObj.primitive = cameraVideo; + // pmCollection.push(pmObj);//骞曞竷锛岃棰戣浆鎹娇鐢� + viewerM.scene.primitives.add(cameraVideo); + preVideoScopePrimitiveArrTie.push(pmObj); + } + // } + }, + // 鍒涘缓鍏夎酱涓嬬殑骞曞竷 + createVideoElementOld(videoSrc, id) { + var videoElement = document.createElement("div"); + videoElement.id = "video" + id; + videoElement.style.position = "absolute"; + videoElement.style.zIndex = "-100"; + videoElement.style.background = "green"; + document.getElementById("videoSource").appendChild(videoElement); + return videoElement; + }, + //h,p,r杞琺atrix4 + hpr2m(obj, result) { + // const inverseViewMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(position, headingPitchRoll, undefined, undefined, result); + const inverseViewMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( + obj.position, + undefined, + result + ); + let rotMat = Cesium.Matrix3.fromRotationX( + Cesium.Math.PI_OVER_TWO, + scratchSetViewMatrix3 + ); + Cesium.Matrix4.multiplyByMatrix3( + inverseViewMatrix, + rotMat, + inverseViewMatrix + ); + rotMat = Cesium.Matrix3.fromRotationY( + -obj.heading, + scratchSetViewMatrix3 + ); + Cesium.Matrix4.multiplyByMatrix3( + inverseViewMatrix, + rotMat, + inverseViewMatrix + ); + + rotMat = Cesium.Matrix3.fromRotationX(obj.pitch, scratchSetViewMatrix3); + Cesium.Matrix4.multiplyByMatrix3( + inverseViewMatrix, + rotMat, + inverseViewMatrix + ); + + rotMat = Cesium.Matrix3.fromRotationZ(-obj.roll, scratchSetViewMatrix3); + Cesium.Matrix4.multiplyByMatrix3( + inverseViewMatrix, + rotMat, + inverseViewMatrix + ); + + return inverseViewMatrix; + }, + fly(){ + viewerM.scene.camera.setView({ + destination: Cesium.Cartesian3.fromDegrees(124.9662813, 46.58528798, 349.0), // 浠ョ粡绾害璁剧疆浣嶇疆锛堜緥濡傦細澶у簡榫欏叴璺級 + orientation: { + heading: Cesium.Math.toRadians(194.65), // 鏂瑰悜 + pitch: Cesium.Math.toRadians(-31.43), // 淇 + roll: 0 + } + }); + }, + onCameraChange() { + const camera = viewerC.camera; + const position = camera.positionCartographic; + const heading = Cesium.Math.toDegrees(camera.heading); + const pitch = Cesium.Math.toDegrees(camera.pitch); + const roll = Cesium.Math.toDegrees(camera.roll); + const point1 = Cesium.Cartesian3.fromDegrees(0, 0, 50); + const point2 = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(position.longitude),Cesium.Math.toDegrees(position.latitude),position.height) + // 璁$畻璺濈锛堝崟浣嶏細绫筹級 + const distanceBetween = Cesium.Cartesian3.distance(point1, point2) + console.log(distanceBetween) + if(preVideoScopePrimitiveArrTie?.length !=0 ){ + let obj = this.updateSZScope(Cesium.Math.toDegrees(position.longitude),Cesium.Math.toDegrees(position.latitude),position.height,heading,pitch,roll,1,distanceBetween) + preVideoScopePrimitiveArrTie[0].primitive.inverseViewMatrix = obj.M + preVideoScopePrimitiveArrTie[0].primitive.frustum = obj.F + } + }, + //鏇存柊瑙嗘浣撲綅缃� + updateSZScope(lon, lat, alt, camHeading, camPitch, camRoll, LightView,distanceBetween) { + let positionCt3 = Cesium.Cartesian3.fromDegrees( + Number(lon), + Number(lat), + Number(alt) + ); + console.log(positionCt3) + console.log(distanceBetween) + let frustum = new Cesium.PerspectiveFrustum({ + fov: Cesium.Math.toRadians(LightView), + aspectRatio: Number(1.77778), + near: Number(0.05), + far: Number(distanceBetween), + }); + console.log(frustum) + let inverseViewMatrixNew = this.hpr2m({ + position: positionCt3, + heading: Cesium.Math.toRadians(Number(camHeading)), + pitch: Cesium.Math.toRadians(Number(camPitch)), + roll: Cesium.Math.toRadians(Number(camRoll)), + }); + console.log(inverseViewMatrixNew) + return {M: inverseViewMatrixNew, F: frustum}; + }, } } </script> @@ -738,3 +999,46 @@ .box_rb{width:10px;height:10px;position:absolute;border-bottom:2px solid #00d3e7;border-right:2px solid #00d3e7;right:0px;bottom:0px;} .box_lb{width:10px;height:10px;position:absolute;border-bottom:2px solid #00d3e7;border-left:2px solid #00d3e7;left:0px;bottom:0px;} </style> + +<style scoped> +.key-container { + display: inline-block; + background-color: rgba(0, 0, 0, 0.7); + padding: 8px 10px; + border-radius: 10px; + color: white; + font-family: sans-serif; + margin-top: 55px; +} + +.arrow-row{ + display: flex; + justify-content: center; + margin-bottom: 4px; +} +.key-row { + display: flex; + justify-content: space-between; + margin-bottom: 4px; +} + +.arrow, +.key { + width: 30px; + height: 30px; + margin: 0 2px; + background-color: #333; + border-radius: 4px; + display: flex; + justify-content: center; + align-items: center; + font-weight: bold; + transition: background-color 0.2s; + cursor: pointer; +} + +.arrow.active, +.key.active { + background-color: #00aaff; +} +</style> \ No newline at end of file -- Gitblit v1.9.3