| | |
| | | }, |
| | | rotateAllPoints(dataList,towerLongitude,towerLatitude,towerhHight) { |
| | | return dataList.map(item => { |
| | | const towerPoint = Cesium.Cartesian3.fromDegrees(towerLongitude, towerLatitude, towerhHight); |
| | | const newGround = { |
| | | ...item, |
| | | }; |
| | | console.log(newGround) |
| | | // 处理子空中点 |
| | | newGround.children = item.children.map(child => { |
| | | const airPoint = Cesium.Cartesian3.fromDegrees(child.longitude, child.latitude, child.height); |
| | | const rotatedAirPoint = this.rotateAroundPoint( airPoint,towerPoint, rotationAngle); |
| | | const rotatedAirCarto = Cesium.Cartographic.fromCartesian(rotatedAirPoint); |
| | | child.longitude = Cesium.Math.toDegrees(rotatedAirCarto.longitude) |
| | | child.latitude = Cesium.Math.toDegrees(rotatedAirCarto.latitude) |
| | | child.height = rotatedAirCarto.height |
| | | child.children = child.children.map(sonChild => { |
| | | const groundPoint = Cesium.Cartesian3.fromDegrees(sonChild.longitude, sonChild.latitude, sonChild.height); |
| | | const newGroundPoint = this.rotateAroundPoint( groundPoint,towerPoint, rotationAngle); |
| | | const newGroundCarto = Cesium.Cartographic.fromCartesian(newGroundPoint); |
| | | return { |
| | | ...sonChild, |
| | | longitude: Cesium.Math.toDegrees(newGroundCarto.longitude), |
| | | latitude: Cesium.Math.toDegrees(newGroundCarto.latitude), |
| | | height: newGroundCarto.height |
| | | }; |
| | | if(!item.isDeal) { |
| | | const towerPoint = Cesium.Cartesian3.fromDegrees(towerLongitude, towerLatitude, towerhHight); |
| | | const newGround = { |
| | | ...item, |
| | | }; |
| | | if(item.id == this.deviceId ){ |
| | | item.isDeal = true |
| | | } |
| | | // 处理子空中点 |
| | | newGround.children = item.children?.map(child => { |
| | | const airPoint = Cesium.Cartesian3.fromDegrees(child.longitude, child.latitude, child.height); |
| | | const rotatedAirPoint = this.rotateAroundPoint( airPoint,towerPoint, rotationAngle); |
| | | const rotatedAirCarto = Cesium.Cartographic.fromCartesian(rotatedAirPoint); |
| | | child.longitude = Cesium.Math.toDegrees(rotatedAirCarto.longitude) |
| | | child.latitude = Cesium.Math.toDegrees(rotatedAirCarto.latitude) |
| | | child.height = rotatedAirCarto.height |
| | | child.children = child.children?.map(sonChild => { |
| | | const groundPoint = Cesium.Cartesian3.fromDegrees(sonChild.longitude, sonChild.latitude, sonChild.height); |
| | | const newGroundPoint = this.rotateAroundPoint( groundPoint,towerPoint, rotationAngle); |
| | | const newGroundCarto = Cesium.Cartographic.fromCartesian(newGroundPoint); |
| | | return { |
| | | ...sonChild, |
| | | longitude: Cesium.Math.toDegrees(newGroundCarto.longitude), |
| | | latitude: Cesium.Math.toDegrees(newGroundCarto.latitude), |
| | | height: newGroundCarto.height |
| | | }; |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | return newGround; |
| | | return newGround; |
| | | } |
| | | |
| | | }); |
| | | }, |
| | | // 计算点A绕点B逆时针旋转指定角度后的新位置 |