This commit is contained in:
zh
2025-12-12 17:02:05 +08:00
4 changed files with 17 additions and 14 deletions

View File

@ -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 = `<div class='mousePosiWords' style='width: 150px;position: absolute; z-index: 777; color: #ffffff; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>经度:-</p><p style='margin: 0;'>维度:-</p><p style='margin: 0;'>海拔:-</p></div>`
}
else {

View File

@ -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 = `
<div><span>经度:</span><span>-</span></div>
<div><span>纬度:</span><span>-</span></div>
@ -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 = `
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>
@ -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 = `
<div><span>x</span><span>${Number(result.points[0].x.toFixed(2))}</span></div>
@ -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 = `
// <span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
// <span>纬度:</span><span>${Number(position.lat.toFixed(6))}° </span>

View File

@ -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))}`
}
})

View File

@ -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 }