From 9de7ab532d3f59f80d8fe3cffe4488f88dd06b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com> Date: Fri, 12 Dec 2025 17:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Global/MouseCoordinate/index.js | 4 ++-- src/Global/global.js | 7 ++++--- src/Measure/MeasureLocation/index.js | 16 ++++++++-------- src/Tools/projConvert.js | 4 +++- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/Global/MouseCoordinate/index.js b/src/Global/MouseCoordinate/index.js index c4ac9e6..a7cb7f5 100644 --- a/src/Global/MouseCoordinate/index.js +++ b/src/Global/MouseCoordinate/index.js @@ -172,7 +172,7 @@ const MouseCoordinate = (sdk, status) => { let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer) let coordinateSystem = getCoordinateSystem() let positionType = getDMS() - if (coordinateSystem === 'EPSG:4326') { + if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') { position = { x: degrees.lng, y: degrees.lat, @@ -202,7 +202,7 @@ const MouseCoordinate = (sdk, status) => { } else { let coordinateSystem = getCoordinateSystem() - if (coordinateSystem === 'EPSG:4326') { + if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') { contentElm.innerHTML = `

经度:-

维度:-

海拔:-

` } else { diff --git a/src/Global/global.js b/src/Global/global.js index d1b53bf..aae7b9f 100644 --- a/src/Global/global.js +++ b/src/Global/global.js @@ -158,7 +158,7 @@ function CesiumContainer(sdk, options) { infoElm.style['border-radius'] = '18px'; infoElm.style.display = 'flex'; - if (coordinateSystem === 'EPSG:4326') { + if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') { infoElm.innerHTML = `
经度:-
纬度:-
@@ -198,7 +198,7 @@ function CesiumContainer(sdk, options) { // let pos = sdk.viewer.scene.clampToHeight(_cartesian) let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer) // position.alt = height - if (coordinateSystem === 'EPSG:4326') { + if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') { // infoElm.innerHTML = ` // 经度:${Number(position.lng.toFixed(6))}° // 纬度:${Number(position.lat.toFixed(6))}° @@ -233,6 +233,7 @@ function CesiumContainer(sdk, options) { else { // let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', coordinateSystem) let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position)) + if (result.points.length) { infoElm.innerHTML = `
x:${Number(result.points[0].x.toFixed(2))}
@@ -773,7 +774,7 @@ function setCoordinateSystem(sdk, epsg) { let tools = new Tools() let proj = sdk.proj let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer) - if (coordinateSystem === 'EPSG:4326') { + if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') { // infoElm.innerHTML = ` // 经度:${Number(position.lng.toFixed(6))}° // 纬度:${Number(position.lat.toFixed(6))}° diff --git a/src/Measure/MeasureLocation/index.js b/src/Measure/MeasureLocation/index.js index 042c466..0a72975 100644 --- a/src/Measure/MeasureLocation/index.js +++ b/src/Measure/MeasureLocation/index.js @@ -12,11 +12,11 @@ import { getCoordinateSystem } from "../../Global/global"; class MeasureLocation extends Measure { /** * @constructor - * @param sdk + * @param sdk * @description 坐标测量 * */ constructor(sdk) { - super(sdk, {text: ""}); + super(sdk, { text: "" }); this.defaultColor = "#f11515" this.locationID = this.randomString() this.position = new Cesium.Cartesian3() @@ -103,16 +103,16 @@ class MeasureLocation extends Measure { let leftEvent = (movement, cartesian) => { this.position = cartesian let entity = this.viewer.entities.getById(this.locationID) - if(entity) { + if (entity) { entity.show = true } let p = this.cartesian3Towgs84(cartesian, this.viewer) let coordinateSystem = getCoordinateSystem() - if(coordinateSystem==='EPSG:4326') { + if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') { this.text = `经度:${Number(p.lng.toFixed(8))}\n纬度:${Number(p.lat.toFixed(8))}\n海拔:${Number(p.alt.toFixed(2))}` } else { - let result = this.convert([{x: p.lng, y: p.lat, z: p.alt}], 'EPSG:4326', coordinateSystem) + let result = this.convert([{ x: p.lng, y: p.lat, z: p.alt }], 'EPSG:4326', coordinateSystem) this.text = `x:${Number(result.points[0].x.toFixed(8))}\ny:${Number(result.points[0].y.toFixed(8))}\nz:${Number(result.points[0].z.toFixed(2))}` } this.end() @@ -125,17 +125,17 @@ class MeasureLocation extends Measure { this.event.mouse_move((movement, cartesian) => { this.tip.setPosition(cartesian, movement.endPosition.x, movement.endPosition.y) let entity = this.viewer.entities.getById(this.locationID) - if(entity) { + if (entity) { entity.show = true } this.position = cartesian let p = this.cartesian3Towgs84(cartesian, this.viewer) let coordinateSystem = getCoordinateSystem() - if(coordinateSystem==='EPSG:4326') { + if (coordinateSystem === 'EPSG:4326' || coordinateSystem === 'EPSG:4490') { this.text = `经度:${Number(p.lng.toFixed(8))}\n纬度:${Number(p.lat.toFixed(8))}\n海拔:${Number(p.alt.toFixed(2))}` } else { - let result = this.convert([{x: p.lng, y: p.lat, z: p.alt}], 'EPSG:4326', coordinateSystem) + let result = this.convert([{ x: p.lng, y: p.lat, z: p.alt }], 'EPSG:4326', coordinateSystem) this.text = `x:${Number(result.points[0].x.toFixed(8))}\ny:${Number(result.points[0].y.toFixed(8))}\nz:${Number(result.points[0].z.toFixed(2))}` } }) diff --git a/src/Tools/projConvert.js b/src/Tools/projConvert.js index a8473b3..aa7a017 100644 --- a/src/Tools/projConvert.js +++ b/src/Tools/projConvert.js @@ -3,6 +3,7 @@ import { Proj } from './proj' import { legp } from '../Obj/Element/datalist'; import Tools from "../Tools"; let _DialogObject +let Draw const open = async (sdk, closeCallBack) => { let proj = new Proj() let tools = new Tools(sdk) @@ -194,7 +195,7 @@ const open = async (sdk, closeCallBack) => { }); let DrawPoint = require('../Draw/drawPoint').default pickUpElm.addEventListener('click', () => { - let Draw = new DrawPoint(sdk) + Draw = new DrawPoint(sdk) Draw.start((a, positions) => { switch (type * 1) { case 0: @@ -451,6 +452,7 @@ const close = () => { _DialogObject.close() _DialogObject = null } + Draw && Draw.end() } export { open, close }