| | |
| | | heightReference: Cesium.HeightReference.NONE, |
| | | } |
| | | }); |
| | | // 获取两点在屏幕上的位置 |
| | | // const screenPos1 = Cesium.SceneTransforms?.wgs84ToWindowCoordinates?.(viewer.scene, position1) |
| | | // || viewer.scene.cartesianToCanvasCoordinates(position1); |
| | | // const screenPos2 = Cesium.SceneTransforms?.wgs84ToWindowCoordinates?.(viewer.scene, position2) |
| | | // || viewer.scene.cartesianToCanvasCoordinates(position2); |
| | | |
| | | // // // 生成屏幕矩形 |
| | | // const boundingRect = new Cesium.BoundingRectangle( |
| | | // Math.min(screenPos1.x, screenPos2.x), |
| | | // Math.min(screenPos1.y, screenPos2.y), |
| | | // Math.abs(screenPos1.x - screenPos2.x), |
| | | // Math.abs(screenPos1.y - screenPos2.y) |
| | | // ); |
| | | // const center = Cesium.Cartesian3.midpoint(screenPos1, screenPos2, new Cesium.Cartesian3()); |
| | | // const angle = Cesium.Math.PI_OVER_FOUR; // 45度 |
| | | |
| | | // viewer.entities.add({ |
| | | // position: center, |
| | | // rectangle: { |
| | | // coordinates: boundingRect, |
| | | // material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | // rotation: angle // 弧度制旋转 |
| | | // } |
| | | // }); |
| | | // viewer.entities.add({ |
| | | // id: `line`, |
| | | // polyline: { |