| | |
| | | width: 40, |
| | | height: 56, |
| | | verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // 设置图片底部对齐坐标点 |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | }, |
| | | label: { |
| | | text: `${longitude.toFixed(6)}, ${latitude.toFixed(6)}`, |
| | |
| | | outlineWidth: 1, |
| | | outlineColor: Cesium.Color.WHITE, |
| | | pixelOffset: new Cesium.Cartesian2(0, -72), |
| | | eyeOffset: new Cesium.Cartesian3(0, 0, -20), |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | }, |
| | | }) |
| | | } else { |
| | |
| | | material: Cesium.Color.fromCssColorString('#6b9ca8').withAlpha(0.6), |
| | | outline: true, |
| | | outlineColor: Cesium.Color.fromCssColorString('#6b9ca8').withAlpha(0.6), |
| | | heightReference: Cesium.HeightReference.NONE, |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | }, |
| | | }) |
| | | return |
| | |
| | | |
| | | function handleMapClick(click) { |
| | | const pos = click.position |
| | | const cartesian3 = viewer.camera.pickEllipsoid(pos, viewer.scene.globe.ellipsoid) |
| | | const ray = viewer.camera.getPickRay(pos) |
| | | if (!ray) return |
| | | const cartesian3 = viewer.scene.globe.pick(ray, viewer.scene) |
| | | if (!cartesian3) return |
| | | const carto = Cesium.Cartographic.fromCartesian(cartesian3) |
| | | const longitude = Number(Cesium.Math.toDegrees(carto.longitude).toFixed(6)) |