|
|
@ -43,6 +43,7 @@ |
|
|
<!-- 定位弹窗 --> |
|
|
<!-- 定位弹窗 --> |
|
|
<locate-dialog |
|
|
<locate-dialog |
|
|
:visible="locateDialogVisible" |
|
|
:visible="locateDialogVisible" |
|
|
|
|
|
:coordinateFormat="coordinateFormat" |
|
|
@update:visible="locateDialogVisible = $event" |
|
|
@update:visible="locateDialogVisible = $event" |
|
|
@confirm="handleLocateConfirm" |
|
|
@confirm="handleLocateConfirm" |
|
|
@cancel="handleLocateCancel" |
|
|
@cancel="handleLocateCancel" |
|
|
@ -114,6 +115,10 @@ export default { |
|
|
unit: 'km', |
|
|
unit: 'km', |
|
|
position: 'bottom-right' |
|
|
position: 'bottom-right' |
|
|
}) |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
coordinateFormat: { |
|
|
|
|
|
type: String, |
|
|
|
|
|
default: 'dms' // 'decimal' 或 'dms' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
@ -133,6 +138,11 @@ export default { |
|
|
this.updateScaleFromConfig(newVal) |
|
|
this.updateScaleFromConfig(newVal) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
coordinateFormat: { |
|
|
|
|
|
handler(newVal) { |
|
|
|
|
|
this.updateCoordinatesDisplay() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
@ -185,6 +195,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// 鼠标经纬度 |
|
|
// 鼠标经纬度 |
|
|
coordinatesText: '经度: --, 纬度: --', |
|
|
coordinatesText: '经度: --, 纬度: --', |
|
|
|
|
|
currentCoordinates: null, |
|
|
// 比例尺(高德风格) |
|
|
// 比例尺(高德风格) |
|
|
scaleBarText: '--', |
|
|
scaleBarText: '--', |
|
|
scaleBarWidthPx: 80, |
|
|
scaleBarWidthPx: 80, |
|
|
@ -1695,7 +1706,7 @@ export default { |
|
|
webgl: { |
|
|
webgl: { |
|
|
antialias: true, |
|
|
antialias: true, |
|
|
msaa: true, |
|
|
msaa: true, |
|
|
msaaSamples: 8 |
|
|
msaaSamples: 4 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
@ -2259,10 +2270,18 @@ this.viewer.scene.postProcessStages.fxaa.enabled = true |
|
|
addCoordinateLabels() { |
|
|
addCoordinateLabels() { |
|
|
for (let lon = -180; lon <= 180; lon += 30) { |
|
|
for (let lon = -180; lon <= 180; lon += 30) { |
|
|
for (let lat = -90; lat <= 90; lat += 30) { |
|
|
for (let lat = -90; lat <= 90; lat += 30) { |
|
|
|
|
|
let latText, lonText |
|
|
|
|
|
if (this.coordinateFormat === 'dms') { |
|
|
|
|
|
latText = `${this.degreesToDMS(lat)}N` |
|
|
|
|
|
lonText = `${this.degreesToDMS(lon)}E` |
|
|
|
|
|
} else { |
|
|
|
|
|
latText = `${lat.toFixed(2)}°N` |
|
|
|
|
|
lonText = `${lon.toFixed(2)}°E` |
|
|
|
|
|
} |
|
|
this.viewer.entities.add({ |
|
|
this.viewer.entities.add({ |
|
|
position: Cesium.Cartesian3.fromDegrees(lon, lat), |
|
|
position: Cesium.Cartesian3.fromDegrees(lon, lat), |
|
|
label: { |
|
|
label: { |
|
|
text: `${this.degreesToDMS(lat)}N\n${this.degreesToDMS(lon)}E`, |
|
|
text: `${latText}\n${lonText}`, |
|
|
font: '12px sans-serif', |
|
|
font: '12px sans-serif', |
|
|
fillColor: Cesium.Color.BLACK, |
|
|
fillColor: Cesium.Color.BLACK, |
|
|
outlineColor: Cesium.Color.WHITE, |
|
|
outlineColor: Cesium.Color.WHITE, |
|
|
@ -2524,7 +2543,7 @@ this.viewer.scene.postProcessStages.fxaa.enabled = true |
|
|
color: Cesium.Color.fromCssColorString(this.defaultStyles.line.color), |
|
|
color: Cesium.Color.fromCssColorString(this.defaultStyles.line.color), |
|
|
dashLength: 16 |
|
|
dashLength: 16 |
|
|
}), |
|
|
}), |
|
|
arcType: Cesium.ArcType.NONE |
|
|
clampToGround: true |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
@ -4653,7 +4672,13 @@ this.viewer.scene.postProcessStages.fxaa.enabled = true |
|
|
}, |
|
|
}, |
|
|
duration: 2 |
|
|
duration: 2 |
|
|
}) |
|
|
}) |
|
|
this.$message.success(`已定位到经度 ${this.degreesToDMS(lng)},纬度 ${this.degreesToDMS(lat)}`) |
|
|
let coordinateText |
|
|
|
|
|
if (this.coordinateFormat === 'dms') { |
|
|
|
|
|
coordinateText = `${this.degreesToDMS(lng)},${this.degreesToDMS(lat)}` |
|
|
|
|
|
} else { |
|
|
|
|
|
coordinateText = `${lng.toFixed(6)},${lat.toFixed(6)}` |
|
|
|
|
|
} |
|
|
|
|
|
this.$message.success(`已定位到经度 ${coordinateText}`) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -4925,12 +4950,26 @@ this.viewer.scene.postProcessStages.fxaa.enabled = true |
|
|
const cartographic = Cesium.Cartographic.fromCartesian(cartesian) |
|
|
const cartographic = Cesium.Cartographic.fromCartesian(cartesian) |
|
|
const longitude = Cesium.Math.toDegrees(cartographic.longitude) |
|
|
const longitude = Cesium.Math.toDegrees(cartographic.longitude) |
|
|
const latitude = Cesium.Math.toDegrees(cartographic.latitude) |
|
|
const latitude = Cesium.Math.toDegrees(cartographic.latitude) |
|
|
this.coordinatesText = `经度: ${this.degreesToDMS(longitude)}, 纬度: ${this.degreesToDMS(latitude)}` |
|
|
this.currentCoordinates = { longitude, latitude } |
|
|
|
|
|
this.updateCoordinatesDisplay() |
|
|
} else { |
|
|
} else { |
|
|
this.coordinatesText = '经度: --, 纬度: --' |
|
|
this.coordinatesText = '经度: --, 纬度: --' |
|
|
} |
|
|
} |
|
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE) |
|
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE) |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 更新坐标显示 |
|
|
|
|
|
updateCoordinatesDisplay() { |
|
|
|
|
|
if (!this.currentCoordinates) { |
|
|
|
|
|
this.coordinatesText = '经度: --, 纬度: --' |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const { longitude, latitude } = this.currentCoordinates |
|
|
|
|
|
if (this.coordinateFormat === 'dms') { |
|
|
|
|
|
this.coordinatesText = `经度: ${this.degreesToDMS(longitude)}, 纬度: ${this.degreesToDMS(latitude)}` |
|
|
|
|
|
} else { |
|
|
|
|
|
this.coordinatesText = `经度: ${longitude.toFixed(6)}, 纬度: ${latitude.toFixed(6)}` |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
destroyViewer() { |
|
|
destroyViewer() { |
|
|
this.stopDrawing() |
|
|
this.stopDrawing() |
|
|
this.clearAll(false) |
|
|
this.clearAll(false) |
|
|
|