Compare commits
3 Commits
f52d928b9b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 94e5698f5a | |||
| 147b0bb43a | |||
| 90466a4799 |
@ -166,5 +166,15 @@ function close(sdk) {
|
|||||||
}
|
}
|
||||||
sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject)
|
sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject)
|
||||||
}
|
}
|
||||||
|
function destroy(sdk) {
|
||||||
|
if (mapx.viewer) {
|
||||||
|
if (mapx.viewer.entities) {
|
||||||
|
mapx.viewer.entities.removeAll()
|
||||||
|
}
|
||||||
|
mapx.viewer.destroy && mapx.viewer.destroy()
|
||||||
|
}
|
||||||
|
mapx = {}
|
||||||
|
sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject)
|
||||||
|
}
|
||||||
|
|
||||||
export { open, close }
|
export { open, close, destroy }
|
||||||
@ -68,6 +68,58 @@ const MouseCoordinate = (sdk, status) => {
|
|||||||
tmovement = { ...movement.endPosition }
|
tmovement = { ...movement.endPosition }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const posiToCoordinate = (coordinateSystem, position) => {
|
||||||
|
let type
|
||||||
|
switch (coordinateSystem) {
|
||||||
|
case 'EPSG:32601'://WGS84 通用横轴墨卡托投影
|
||||||
|
//带号 = ⌊(经度 + 180)/6⌋ + 1
|
||||||
|
var dh = Math.round((position.lng + 180) / 6 + 1)
|
||||||
|
|
||||||
|
if (position.lat > 0) {//北纬
|
||||||
|
type = 32600 + dh
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
} else {//南纬
|
||||||
|
type = 32700 + dh
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'EPSG:4534'://2000 坐标 3 度不带代号
|
||||||
|
//N = round(经度/3)
|
||||||
|
//EPSG = N - 25 + 4534
|
||||||
|
|
||||||
|
var dh3y = Math.round(position.lng / 3)
|
||||||
|
type = dh3y - 25 + 4534
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
case 'EPSG:4513'://2000 坐标 3 度带代号
|
||||||
|
//N = round(经度/3)
|
||||||
|
//EPSG = N - 25 + 4513
|
||||||
|
var dh3w = Math.round(position.lng / 3)
|
||||||
|
type = dh3w - 25 + 4513
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
case 'EPSG:4502'://2000 坐标 6 度不带代号
|
||||||
|
let zoneNumber = Math.floor(position.lng / 6) + 31
|
||||||
|
// 中国区域6度带带号范围为13-23
|
||||||
|
if (zoneNumber < 13) zoneNumber = 13;
|
||||||
|
if (zoneNumber > 23) zoneNumber = 23;
|
||||||
|
type = (zoneNumber - 13) + 4502
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
case 'EPSG:4491'://2000 坐标 6 度带代号
|
||||||
|
//N = floor(longitude/6) + 31
|
||||||
|
var dh6 = Math.floor(position.lng / 6) + 31
|
||||||
|
// 中国区域6度带带号范围为13-23
|
||||||
|
if (dh6 < 13) dh6 = 13;
|
||||||
|
if (dh6 > 23) dh6 = 23;
|
||||||
|
type = (dh6 - 13) + 4491
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return type
|
||||||
|
}
|
||||||
const getPosition = () => {
|
const getPosition = () => {
|
||||||
if (!targetSdk) {
|
if (!targetSdk) {
|
||||||
return
|
return
|
||||||
@ -142,7 +194,8 @@ const MouseCoordinate = (sdk, status) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', coordinateSystem)
|
// let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', coordinateSystem)
|
||||||
|
let result = tools.convert([{ x: degrees.lng, y: degrees.lat, z: degrees.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, degrees))
|
||||||
position = result.points[0]
|
position = result.points[0]
|
||||||
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:${position.x.toFixed(6)}</p><p style='margin: 0;'>y:${position.y.toFixed(6)}</p><p style='margin: 0;'>z:${position.z.toFixed(6)}</p></div>`
|
contentElm.innerHTML = `<div style='width: 150px;position: absolute; z-index: 777; color: #ff0000; font-size: 12px; left:${left + 20}px; top:${top + 10}px;'><p style='margin: 0;'>x:${position.x.toFixed(6)}</p><p style='margin: 0;'>y:${position.y.toFixed(6)}</p><p style='margin: 0;'>z:${position.z.toFixed(6)}</p></div>`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -230,14 +230,17 @@ function CesiumContainer(sdk, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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', coordinateSystem)
|
||||||
console.log(result, 'result12');
|
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
||||||
|
if (result.points.length) {
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
||||||
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
||||||
<span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span>
|
<span style="margin-left: 5px;">z:</span><span>${Number(result.points[0].z.toFixed(6))}</span>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -803,8 +806,8 @@ function setCoordinateSystem(sdk, epsg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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', coordinateSystem)
|
||||||
console.log(result, 'result')
|
let result = proj.convert([{ x: position.lng, y: position.lat, z: position.alt }], 'EPSG:4326', posiToCoordinate(coordinateSystem, position))
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
<span>x:</span><span>${Number(result.points[0].x.toFixed(6))}</span>
|
||||||
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
<span style="margin-left: 5px;">y:</span><span>${Number(result.points[0].y.toFixed(6))}</span>
|
||||||
@ -812,7 +815,58 @@ function setCoordinateSystem(sdk, epsg) {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function posiToCoordinate(coordinateSystem, position) {
|
||||||
|
let type
|
||||||
|
switch (coordinateSystem) {
|
||||||
|
case 'EPSG:32601'://WGS84 通用横轴墨卡托投影
|
||||||
|
//带号 = ⌊(经度 + 180)/6⌋ + 1
|
||||||
|
var dh = Math.floor((position.lng + 180) / 6 + 1)
|
||||||
|
|
||||||
|
if (position.lat > 0) {//北纬
|
||||||
|
type = 32600 + dh
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
} else {//南纬
|
||||||
|
type = 32700 + dh
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'EPSG:4534'://2000 坐标 3 度不带代号
|
||||||
|
//N = round(经度/3)
|
||||||
|
//EPSG = N - 25 + 4534
|
||||||
|
|
||||||
|
var dh3y = Math.round(position.lng / 3)
|
||||||
|
type = dh3y - 25 + 4534
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
case 'EPSG:4513'://2000 坐标 3 度带代号
|
||||||
|
//N = round(经度/3)
|
||||||
|
//EPSG = N - 25 + 4513
|
||||||
|
var dh3w = Math.round(position.lng / 3)
|
||||||
|
type = dh3w - 25 + 4513
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
case 'EPSG:4502'://2000 坐标 6 度不带代号
|
||||||
|
let zoneNumber = Math.floor(position.lng / 6) + 31
|
||||||
|
// 中国区域6度带带号范围为13-23
|
||||||
|
if (zoneNumber < 13) zoneNumber = 13;
|
||||||
|
if (zoneNumber > 23) zoneNumber = 23;
|
||||||
|
type = (zoneNumber - 13) + 4502
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
case 'EPSG:4491'://2000 坐标 6 度带代号
|
||||||
|
//N = floor(longitude/6) + 31
|
||||||
|
var dh6 = Math.floor(position.lng / 6) + 31
|
||||||
|
// 中国区域6度带带号范围为13-23
|
||||||
|
if (dh6 < 13) dh6 = 13;
|
||||||
|
if (dh6 > 23) dh6 = 23;
|
||||||
|
type = (dh6 - 13) + 4491
|
||||||
|
type = 'EPSG:' + type
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return type
|
||||||
|
}
|
||||||
function getDMS() {
|
function getDMS() {
|
||||||
return positionType
|
return positionType
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,11 +83,9 @@ class GeoJson extends Base {
|
|||||||
|
|
||||||
async on() {
|
async on() {
|
||||||
let url = ""
|
let url = ""
|
||||||
if (this.options.host.endsWith("yjearth4.0"))
|
this.options.host = this.options.host || getHost()
|
||||||
url = this.options.host + '/data/service/getFile'
|
url = this.options.host + '/fileInfo/previewLocal'
|
||||||
else
|
url += '?fileAbsolutePath=' + this.options.url
|
||||||
url = this.options.host + '/yjearth4.0/data/service/getFile'
|
|
||||||
url = url + '?path=' + encodeURIComponent(this.options.url)
|
|
||||||
let rsp = await fetch(url, {
|
let rsp = await fetch(url, {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@ -349,7 +349,7 @@ class Vector extends Base {
|
|||||||
let url = ''
|
let url = ''
|
||||||
that.options.host = that.options.host || getHost()
|
that.options.host = that.options.host || getHost()
|
||||||
url = that.options.host + '/fileInfo/previewLocal'
|
url = that.options.host + '/fileInfo/previewLocal'
|
||||||
url += '?path=' + that.options.path
|
url += '?fileAbsolutePath=' + that.options.path
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import {
|
|||||||
import { syncSplitData, setActiveId } from '../Global/SplitScreen'
|
import { syncSplitData, setActiveId } from '../Global/SplitScreen'
|
||||||
import { apiQueryGoodsList } from '../Tools/getGoodsList'
|
import { apiQueryGoodsList } from '../Tools/getGoodsList'
|
||||||
import YJColorPicker from "../Obj/Element/yj-color-picker";
|
import YJColorPicker from "../Obj/Element/yj-color-picker";
|
||||||
|
import { destroy as mapxDestroy } from "../Global/MapX";
|
||||||
// window.check = check
|
// window.check = check
|
||||||
|
|
||||||
class YJEarth {
|
class YJEarth {
|
||||||
@ -572,6 +573,7 @@ class YJEarth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.viewer) {
|
if (this.viewer) {
|
||||||
|
mapxDestroy(this)
|
||||||
if (this.viewer.entities) {
|
if (this.viewer.entities) {
|
||||||
this.viewer.entities.removeAll()
|
this.viewer.entities.removeAll()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3862,12 +3862,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#YJ-custom-message.success {
|
#YJ-custom-message.success {
|
||||||
background-color: #f0f9eb;
|
/* background-color: #f0f9eb; */
|
||||||
color: rgb(82, 196, 26);
|
/* color: rgb(82, 196, 26); */
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
|
||||||
|
linear-gradient(0deg, rgba(27, 248, 195, 0.5) 0%, rgba(27, 248, 195, 0) 100%);
|
||||||
|
font-size: 14px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
color: rgba(27, 248, 195, 1);
|
||||||
}
|
}
|
||||||
#YJ-custom-message.warning {
|
#YJ-custom-message.warning {
|
||||||
background-color: #fdf6ec;
|
/* background-color: #fdf6ec;
|
||||||
color: #e6a23c;
|
color: #e6a23c; */
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
|
||||||
|
linear-gradient(0deg, rgba(255, 161, 69, 0.5) 0%, rgba(255, 161, 69, 0) 100%);
|
||||||
|
font-size: 14px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
color: rgba(255, 161, 69, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 滑入动画 */
|
/* 滑入动画 */
|
||||||
|
|||||||
Reference in New Issue
Block a user