From 20ae03cc5ec41594e775d0d5e795baf60fefac83 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Wed, 13 Aug 2025 10:07:15 +0800
Subject: [PATCH 01/24] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=95=E5=9B=BE?=
=?UTF-8?q?=E7=9A=84=E4=BA=8C=E4=B8=89=E7=BB=B4=E5=8D=95=E7=8B=AC=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/MultiViewportMode/index.js | 17 +++++++++++-
src/Obj/Base/GeoJson/index.js | 24 +++++++++++++++++
src/Obj/Base/index.js | 38 ++++++++++++++++++++++++---
3 files changed, 74 insertions(+), 5 deletions(-)
diff --git a/src/Global/MultiViewportMode/index.js b/src/Global/MultiViewportMode/index.js
index 5d3c600..a05fd63 100644
--- a/src/Global/MultiViewportMode/index.js
+++ b/src/Global/MultiViewportMode/index.js
@@ -409,11 +409,25 @@ function syncImageryLayerRemoved(layer, index) {
sdk2D.viewer.imageryLayers.remove(layer2d)
}
function syncImageryLayerShownOrHidden(layer, index, state) {
+ return
let layer2d = sdk2D.viewer.imageryLayers._layers[index]
+ let layer3d = sdk3D.viewer.imageryLayers._layers[index]
+ console.log('layer2d', layer2d, sdk2D, layer3d)
+
if (!layer2d) {
return
}
- layer2d.show = state
+ if(layer3d._objectState) {
+ if(!layer3d._showView || layer3d._showView==2) {
+ layer2d.show = true
+ }
+ if(layer3d._showView==3) {
+ layer2d.show = false
+ }
+ }
+ else {
+ layer2d.show = state
+ }
}
async function syncPrimitives(primitive) {
@@ -543,6 +557,7 @@ function syncViewer() {
}
+
function get2DView() {
return sdk2D
}
diff --git a/src/Obj/Base/GeoJson/index.js b/src/Obj/Base/GeoJson/index.js
index 43e4b25..795785e 100644
--- a/src/Obj/Base/GeoJson/index.js
+++ b/src/Obj/Base/GeoJson/index.js
@@ -8,6 +8,8 @@
import { getHost, getToken } from "../../../on";
import Base from '../index'
import Tools from '../../../Tools'
+import { syncSplitData } from "../../../Global/SplitScreen";
+import { syncData } from '../../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
class GeoJson extends Base {
@@ -26,6 +28,7 @@ class GeoJson extends Base {
this.primitive = undefined
this.positions = []
+
this.loading = true
}
@@ -48,6 +51,26 @@ class GeoJson extends Base {
return this.options.show
}
+ // set show(status) {
+ // if (!this.isShowView) {
+ // this.options.show = status
+ // }
+ // if (this.entity) {
+ // if (!this.showView || this.showView == 3) {
+ // for (let i = 0; i < this.entity.entities.values.length; i++) {
+ // this.entity.entities.values[i].show = this.options.show
+ // }
+ // }
+ // else {
+ // for (let i = 0; i < this.entity.entities.values.length; i++) {
+ // this.entity.entities.values[i].show = false
+ // }
+ // }
+ // }
+ // syncData(this.sdk, this.options.id)
+ // syncSplitData(this.sdk, this.options.id)
+ // this.isShowView = false
+ // }
set show(status) {
this.options.show = status
if (this.entity) {
@@ -74,6 +97,7 @@ class GeoJson extends Base {
})
let json = await rsp.json()
this.geojson = json
+ // this.sdk.addIncetance(this.options.id, this)
return GeoJson.addDataToGlobe(this, json.features)
}
diff --git a/src/Obj/Base/index.js b/src/Obj/Base/index.js
index 28a6fcb..4cee908 100644
--- a/src/Obj/Base/index.js
+++ b/src/Obj/Base/index.js
@@ -62,9 +62,11 @@ class Base extends Tools {
}
set showView(v) {
+
+
let sdk2D = get2DSdk().sdkD
- if(!sdk2D) {
- v=0
+ if (!sdk2D) {
+ v = 0
}
if (!this.#_showView && !this.show) {
return
@@ -124,10 +126,16 @@ class Base extends Tools {
this.originalOptions.show = v
}
}
+ this.entity._showView = this.showView
+ if (this.type == 'layer') {
+ if (this.entity) {
+ this.entity._objectState = this.options.show
+ }
+ }
if (!this.showView || this.showView == 3) {
this.entity && (this.entity.show = this.options.show)
if (this.options.label && this.options.label.show && this.label) {
- this.label.show = this.options.show
+ this.label.show = this.options.show
}
}
else {
@@ -138,12 +146,34 @@ class Base extends Tools {
}
if (this._DialogObject && this._DialogObject.showBtn) {
- this._DialogObject.showBtn.checked = this.options.show
+ this._DialogObject.showBtn.checked = this.options.show
}
+
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
+
+ let { sdkP, sdkD } = get2DSdk()
+ if (this.type == 'layer' && sdkD) {
+ let layer2d = sdkD.viewer.imageryLayers._layers[this.layerIndex]
+ let layer3d = this.entity
+
+ if (!layer2d) {
+ return
+ }
+ if (layer3d._objectState) {
+ if (!layer3d._showView || layer3d._showView == 2) {
+ layer2d.show = true
+ }
+ if (layer3d._showView == 3) {
+ layer2d.show = false
+ }
+ }
+ else {
+ layer2d.show = this.options.show
+ }
+ }
} else {
console.error("参数必须为boolean")
}
From fff8041faa0fd764f830d9f839cc4cabe7a72fed Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Wed, 13 Aug 2025 11:51:39 +0800
Subject: [PATCH 02/24] =?UTF-8?q?showView=E7=8A=B6=E6=80=81=E4=BF=9D?=
=?UTF-8?q?=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/MultiViewportMode/index.js | 33 ++++++++++++++-----
src/Global/mouseRightMenu/index.js | 16 ++++-----
src/Obj/Base/CircleDiffuse/index.js | 12 ++++---
src/Obj/Base/GeoJson/index.js | 7 ++--
src/Obj/Base/ParticleEffects/Flame/index.js | 7 ++--
.../Base/ParticleEffects/Fountain/index.js | 7 ++--
src/Obj/Base/ParticleEffects/Smoke/index.js | 7 ++--
src/Obj/Base/ParticleEffects/Spout/index.js | 7 ++--
src/Obj/Base/RadarScan/index.js | 12 ++++---
src/Obj/Base/TrajectoryMotion/index.js | 29 +++++++++-------
src/Obj/Base/index.js | 6 ++--
11 files changed, 86 insertions(+), 57 deletions(-)
diff --git a/src/Global/MultiViewportMode/index.js b/src/Global/MultiViewportMode/index.js
index a05fd63..f5531be 100644
--- a/src/Global/MultiViewportMode/index.js
+++ b/src/Global/MultiViewportMode/index.js
@@ -50,6 +50,11 @@ async function init(sdk) {
for (let i = 0; i < imageryLayers.length; i++) {
let entity = sdk2D.viewer.imageryLayers.addImageryProvider(imageryLayers[i].imageryProvider, imageryLayers[i]._layerIndex)
entity.show = imageryLayers[i].show
+ if (imageryLayers[i]._objectState) {
+ if (imageryLayers[i]._showView == 3) {
+ entity.show = false
+ }
+ }
}
// sdk.viewer.entities.collectionChanged.addEventListener(syncEntities)
// sdk.viewer.dataSources.dataSourceAdded.addEventListener(syncDataSources)
@@ -61,6 +66,12 @@ async function init(sdk) {
JwwStatusSwitch(sdk2, true)
}
+ sdk.entityMap.forEach((item, key) => {
+ if (item.showView == 2) {
+ item.showView = 2
+ }
+ })
+
}
async function on(sdk) {
if (sdk2D) {
@@ -95,9 +106,10 @@ function off(sdk) {
syncObject = {}
}
sdk.entityMap.forEach((item, key) => {
- item.showView = undefined
+ if (item.showView) {
+ item.show = item.show
+ }
})
-
}
async function syncData2(sdk, id, entityId) {
@@ -123,10 +135,10 @@ async function syncData2(sdk, id, entityId) {
options.heightMode = 0
options.height = 0
}
-
+
if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) {
- if(that.showView==3) {
- options.show=false
+ if (that.showView == 3) {
+ options.show = false
}
let newObject = await new that.constructor(sdk2D, options)
newObject.onClick = that.onClick
@@ -216,6 +228,9 @@ async function syncData2(sdk, id, entityId) {
}
let options = syncObject.tools.deepCopyObj(obj.options)
if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer')) {
+ if (obj.showView == 3) {
+ options.show = false
+ }
let target = await new obj.constructor(sdk2D, options)
target.onClick = obj.onClick
target.onRightClick = obj.onRightClick
@@ -413,15 +428,15 @@ function syncImageryLayerShownOrHidden(layer, index, state) {
let layer2d = sdk2D.viewer.imageryLayers._layers[index]
let layer3d = sdk3D.viewer.imageryLayers._layers[index]
console.log('layer2d', layer2d, sdk2D, layer3d)
-
+
if (!layer2d) {
return
}
- if(layer3d._objectState) {
- if(!layer3d._showView || layer3d._showView==2) {
+ if (layer3d._objectState) {
+ if (!layer3d._showView || layer3d._showView == 2) {
layer2d.show = true
}
- if(layer3d._showView==3) {
+ if (layer3d._showView == 3) {
layer2d.show = false
}
}
diff --git a/src/Global/mouseRightMenu/index.js b/src/Global/mouseRightMenu/index.js
index 818271b..891623f 100644
--- a/src/Global/mouseRightMenu/index.js
+++ b/src/Global/mouseRightMenu/index.js
@@ -100,14 +100,14 @@ function MouseRightMenu(sdk, status, callBack) {
that = sdk.entityMap.get(entityId)
}
- if (that && that.picking) {
- addedMenu = `
-
-
- `
- }
+ // if (that && that.picking) {
+ // addedMenu = `
+ //
+ //
+ // `
+ // }
let position = tools.cartesian3Towgs84(cartesian, sdk.viewer)
menuElm = document.createElement('div')
menuElm.id = 'custom-menu'
diff --git a/src/Obj/Base/CircleDiffuse/index.js b/src/Obj/Base/CircleDiffuse/index.js
index d7fe430..36acfa4 100644
--- a/src/Obj/Base/CircleDiffuse/index.js
+++ b/src/Obj/Base/CircleDiffuse/index.js
@@ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding';
import richText from "../../Element/richText";
import MouseEvent from '../../../Event/index'
import LabelObject from '../LabelObject'
-import { syncData } from '../../../Global/MultiViewportMode'
+import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
import { legp } from '../../Element/datalist';
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
import MouseTip from '../../../MouseTip'
@@ -223,10 +223,11 @@ class CircleDiffuse extends Base {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DSdk().sdkD
+ if (!this.isShowView || !sdkD) {
this.options.show = v
}
- if (!this.showView || this.showView == 3) {
+ if (!this.showView || this.showView == 3 || !sdkD) {
this.entity.show = this.options.show
if (this.options.label.show) {
this.label.show = this.options.show
@@ -442,8 +443,9 @@ class CircleDiffuse extends Base {
return this.options.label.show
}
set labelShow(v) {
+ let sdkD = get2DSdk().sdkD
this.options.label.show = v
- if (this.show && (!this.showView || this.showView == 3)) {
+ if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
this.label.show = v
}
else {
@@ -1336,7 +1338,7 @@ class CircleDiffuse extends Base {
}
async remove() {
- this.label.remove()
+ this.label && this.label.remove()
this.entity && this.sdk.viewer.entities.remove(this.entity)
this.entity2 && this.sdk.viewer.entities.remove(this.entity2)
this.entity = null
diff --git a/src/Obj/Base/GeoJson/index.js b/src/Obj/Base/GeoJson/index.js
index 795785e..02a0bbe 100644
--- a/src/Obj/Base/GeoJson/index.js
+++ b/src/Obj/Base/GeoJson/index.js
@@ -9,7 +9,7 @@ import { getHost, getToken } from "../../../on";
import Base from '../index'
import Tools from '../../../Tools'
import { syncSplitData } from "../../../Global/SplitScreen";
-import { syncData } from '../../../Global/MultiViewportMode'
+import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
class GeoJson extends Base {
@@ -52,11 +52,12 @@ class GeoJson extends Base {
}
// set show(status) {
- // if (!this.isShowView) {
+ // let sdkD = get2DSdk().sdkD
+ // if (!this.isShowView || !sdkD) {
// this.options.show = status
// }
// if (this.entity) {
- // if (!this.showView || this.showView == 3) {
+ // if (!this.showView || this.showView == 3 || !sdkD) {
// for (let i = 0; i < this.entity.entities.values.length; i++) {
// this.entity.entities.values[i].show = this.options.show
// }
diff --git a/src/Obj/Base/ParticleEffects/Flame/index.js b/src/Obj/Base/ParticleEffects/Flame/index.js
index 77b66b8..08fe7bb 100644
--- a/src/Obj/Base/ParticleEffects/Flame/index.js
+++ b/src/Obj/Base/ParticleEffects/Flame/index.js
@@ -7,7 +7,7 @@ import EventBinding from './eventBinding'
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
import { syncPrimitives } from '../../../../Global/MultiViewportMode'
-import { syncData } from '../../../../Global/MultiViewportMode'
+import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
@@ -82,10 +82,11 @@ class Flame extends Base {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DSdk().sdkD
+ if (!this.isShowView || !sdkD) {
this.options.show = v
}
- if (!this.showView || this.showView == 3) {
+ if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
diff --git a/src/Obj/Base/ParticleEffects/Fountain/index.js b/src/Obj/Base/ParticleEffects/Fountain/index.js
index 7b2a2a0..893eb47 100644
--- a/src/Obj/Base/ParticleEffects/Fountain/index.js
+++ b/src/Obj/Base/ParticleEffects/Fountain/index.js
@@ -6,7 +6,7 @@ import { html } from "./_element";
import EventBinding from './eventBinding'
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
-import { syncData } from '../../../../Global/MultiViewportMode'
+import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
@@ -83,10 +83,11 @@ class Fountain extends Base {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DSdk().sdkD
+ if (!this.isShowView || !sdkD) {
this.options.show = v
}
- if (!this.showView || this.showView == 3) {
+ if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
diff --git a/src/Obj/Base/ParticleEffects/Smoke/index.js b/src/Obj/Base/ParticleEffects/Smoke/index.js
index f457661..3d367f7 100644
--- a/src/Obj/Base/ParticleEffects/Smoke/index.js
+++ b/src/Obj/Base/ParticleEffects/Smoke/index.js
@@ -6,7 +6,7 @@ import { html, css } from "./_element";
import EventBinding from './eventBinding'
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
-import { syncData } from '../../../../Global/MultiViewportMode'
+import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
@@ -81,10 +81,11 @@ class Smoke extends Base {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DSdk().sdkD
+ if (!this.isShowView || !sdkD) {
this.options.show = v
}
- if (!this.showView || this.showView == 3) {
+ if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
diff --git a/src/Obj/Base/ParticleEffects/Spout/index.js b/src/Obj/Base/ParticleEffects/Spout/index.js
index 9e78cd5..ed2863d 100644
--- a/src/Obj/Base/ParticleEffects/Spout/index.js
+++ b/src/Obj/Base/ParticleEffects/Spout/index.js
@@ -5,7 +5,7 @@ import Dialog from '../../../Element/Dialog';
import { html, css } from "./_element";
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
-import { syncData } from '../../../../Global/MultiViewportMode'
+import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global'
@@ -84,10 +84,11 @@ class Spout extends Base {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DSdk().sdkD
+ if (!this.isShowView || !sdkD) {
this.options.show = v
}
- if (!this.showView || this.showView == 3) {
+ if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
diff --git a/src/Obj/Base/RadarScan/index.js b/src/Obj/Base/RadarScan/index.js
index dd3ec65..3959c72 100644
--- a/src/Obj/Base/RadarScan/index.js
+++ b/src/Obj/Base/RadarScan/index.js
@@ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding';
import richText from "../../Element/richText";
import MouseEvent from '../../../Event/index'
import LabelObject from '../LabelObject'
-import { syncData } from '../../../Global/MultiViewportMode'
+import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
import { legp } from '../../Element/datalist';
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
import MouseTip from '../../../MouseTip'
@@ -246,10 +246,11 @@ class RadarScan extends Base {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DSdk().sdkD
+ if (!this.isShowView || !sdkD) {
this.options.show = v
}
- if (!this.showView || this.showView == 3) {
+ if (!this.showView || this.showView == 3 || !sdkD) {
this.entity.show = this.options.show
if (this.options.label.show && this.label) {
this.label.show = this.options.show
@@ -460,8 +461,9 @@ class RadarScan extends Base {
return this.options.label.show
}
set labelShow(v) {
+ let sdkD = get2DSdk().sdkD
this.options.label.show = v
- if (this.show && (!this.showView || this.showView == 3)) {
+ if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
this.label.show = v
}
else {
@@ -1386,7 +1388,7 @@ class RadarScan extends Base {
}
async remove() {
- this.label.remove()
+ this.label && this.label.remove()
this.entity && this.sdk.viewer.entities.remove(this.entity)
this.entity2 && this.sdk.viewer.entities.remove(this.entity2)
this.entity = null
diff --git a/src/Obj/Base/TrajectoryMotion/index.js b/src/Obj/Base/TrajectoryMotion/index.js
index 56a8c6e..f561a70 100644
--- a/src/Obj/Base/TrajectoryMotion/index.js
+++ b/src/Obj/Base/TrajectoryMotion/index.js
@@ -144,7 +144,8 @@ class TrajectoryMotion extends Base {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DView()
+ if (!this.isShowView || !sdkD) {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
@@ -155,10 +156,10 @@ class TrajectoryMotion extends Base {
this.model.show = false
}
else {
- this.model.show = (!this.showView || this.showView == 3) ? this.modelShow : false
+ this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.modelShow : false
}
- if ((!this.showView || this.showView == 3)) {
+ if ((!this.showView || this.showView == 3 || !sdkD)) {
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20,
@@ -174,17 +175,17 @@ class TrajectoryMotion extends Base {
})
}
for (let i = 0; i < this.keyPoints.length; i++) {
- this.keyPoints[i].show = (!this.showView || this.showView == 3) ? this.keyPointShow : false
+ this.keyPoints[i].show = (!this.showView || this.showView == 3 || !sdkD) ? this.keyPointShow : false
}
if (this.realTimeRoute) {
- this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3) ? true : false)
+ this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false)
}
- this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false)
+ this.label && (this.label.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.label.show : false)
}
else {
- this.model.show = (!this.showView || this.showView == 3) ? this.options.show : false
+ this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false
let show = this.options.show
- if ((!this.showView || this.showView == 3)) {
+ if ((!this.showView || this.showView == 3 || !sdkD)) {
show = this.options.show
}
else {
@@ -673,9 +674,10 @@ class TrajectoryMotion extends Base {
return this.options.model.show
}
set modelShow(v) {
+ let sdkD = get2DView()
this.options.model.show = v
let show = v
- if (this.show && (!this.showView || this.showView == 3)) {
+ if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
show = v
}
else {
@@ -749,7 +751,8 @@ class TrajectoryMotion extends Base {
}
this.options.line.show = v
let show = v
- if ((!this.showView || this.showView == 3)) {
+ let sdkD = get2DView()
+ if ((!this.showView || this.showView == 3 || !sdkD)) {
show = v
}
else {
@@ -973,6 +976,7 @@ class TrajectoryMotion extends Base {
set firstPersonView(v) {
// this.state = true
+ let sdkD = get2DView()
let splitSdk = getSdk()
if (get2DView() || splitSdk.sdkD || !this.show) {
v = false
@@ -1027,7 +1031,7 @@ class TrajectoryMotion extends Base {
CameraController(this.sdk, true)
if (this.model && this.modelShow && this.show) {
let show = true
- if (this.show && (!this.showView || this.showView == 3)) {
+ if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
show = true
}
else {
@@ -1155,8 +1159,9 @@ class TrajectoryMotion extends Base {
}
set labelShow(v) {
this.options.label.show = v
+ let sdkD = get2DView()
let show = v
- if (this.show && (!this.showView || this.showView == 3)) {
+ if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
show = v
}
else {
diff --git a/src/Obj/Base/index.js b/src/Obj/Base/index.js
index 4cee908..7439d37 100644
--- a/src/Obj/Base/index.js
+++ b/src/Obj/Base/index.js
@@ -120,7 +120,8 @@ class Base extends Tools {
set show(v) {
if (typeof v === "boolean") {
- if (!this.isShowView) {
+ let sdkD = get2DSdk().sdkD
+ if (!this.isShowView || !sdkD) {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
@@ -132,7 +133,7 @@ class Base extends Tools {
this.entity._objectState = this.options.show
}
}
- if (!this.showView || this.showView == 3) {
+ if (!this.showView || this.showView == 3 || !sdkD) {
this.entity && (this.entity.show = this.options.show)
if (this.options.label && this.options.label.show && this.label) {
this.label.show = this.options.show
@@ -154,7 +155,6 @@ class Base extends Tools {
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
- let { sdkP, sdkD } = get2DSdk()
if (this.type == 'layer' && sdkD) {
let layer2d = sdkD.viewer.imageryLayers._layers[this.layerIndex]
let layer3d = this.entity
From d17b03838877bd864dd8b7fbe32411d2f2496d6f Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Wed, 13 Aug 2025 21:56:07 +0800
Subject: [PATCH 03/24] =?UTF-8?q?=E8=B4=B4=E5=9C=B0=E5=9B=BE=E7=89=87?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AB=8B=E4=BD=93=E6=A8=A1=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/GroundImage/_element.js | 86 +-
src/Obj/Base/GroundImage/index.js | 1320 ++++++++++++++++++++++++--
2 files changed, 1340 insertions(+), 66 deletions(-)
diff --git a/src/Obj/Base/GroundImage/_element.js b/src/Obj/Base/GroundImage/_element.js
index 95acf9f..0edeb1e 100644
--- a/src/Obj/Base/GroundImage/_element.js
+++ b/src/Obj/Base/GroundImage/_element.js
@@ -1,5 +1,5 @@
function html() {
- return `
+ return `
@@ -7,14 +7,21 @@ function html() {
名称
-
-
-
+
-
+
+
+ 文字设置
+
`
diff --git a/src/Obj/Base/GroundImage/index.js b/src/Obj/Base/GroundImage/index.js
index df7f882..2544c4f 100644
--- a/src/Obj/Base/GroundImage/index.js
+++ b/src/Obj/Base/GroundImage/index.js
@@ -4,8 +4,11 @@ import { html } from "./_element";
import EventBinding from '../../Element/Dialog/eventBinding';
import Base from "../index";
import MouseEvent from '../../../Event/index'
+import { legp } from '../../Element/datalist'
import { syncData } from '../../../Global/MultiViewportMode'
+import { getGroundCover } from '../../../Global/global'
import MouseTip from '../../../MouseTip'
+import { getFontList, getFontFamily, getFontFamilyName } from '../../Element/fontSelect'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
@@ -36,11 +39,31 @@ class GroundImage extends Base {
this.options.angle = options.angle || 0
this.options.scale = (options.scale || options.scale === 0) ? options.scale : 1
this.options.position = options.position
- this.options.offset = options.offset || { x: 0.5, y: 0.5 }
+ this.options.offset = options.offset || { x: 0.5, y: 1 }
+ this.options.mode = this.options.mode ? 1 : 0
+ this.options.billboard = options.billboard || {}
+ this.options.billboard.scale = this.options.billboard.scale || 1
+ this.options.billboard.near = this.options.billboard.near || this.options.billboard.near === 0 ? this.options.billboard.near : 2000
+ this.options.billboard.far = this.options.billboard.far || this.options.billboard.far === 0 ? this.options.billboard.far : 100000
+ this.options.billboard.scaleByDistance = this.options.billboard.scaleByDistance ? true : false
+
+ options.label = options.label || {}
+ this.options.label = options.label || {}
+ this.options.label.text = options.label.text || this.options.name
+ this.options.name = this.options.label.text
+ this.options.label.show =
+ options.label.show || options.label.show === false
+ ? options.label.show
+ : true
+ this.options.label.fontFamily = options.label.fontFamily || 0
+ this.options.label.fontSize = options.label.fontSize || 39
+ this.options.label.color = options.label.color || '#00ffff'
this.options.flipe = options.flipe || {}
this.options.flipe.x = this.options.flipe.x || false
this.options.flipe.y = this.options.flipe.y || false
+ this.options.heightMode =
+ options.heightMode || options.heightMode == 0 ? options.heightMode : 3
this.entity = {
id: this.options.id
@@ -48,6 +71,7 @@ class GroundImage extends Base {
this._positionEditing = false
this.Dialog = _Dialog
this._elms = {};
+ this._proj = this.sdk.proj
this.previous = {
position: { ...this.options.position }
}
@@ -57,6 +81,123 @@ class GroundImage extends Base {
this.create()
}
+ get mode() {
+ return this.options.mode
+ }
+ set mode(v) {
+ this.options.mode = v ? 1 : 0
+ let modeData = [
+ {
+ name: '贴地',
+ value: '贴地',
+ key: 0
+ },
+ {
+ name: '立体',
+ value: '立体',
+ key: 1
+ }
+ ]
+ for (let i = 0; i < modeData.length; i++) {
+ if (modeData[i].key === this.options.mode) {
+ this._elms.mode && this._elms.mode.forEach((item) => {
+ item.value = modeData[i].value
+ })
+ break
+ }
+ }
+ let elms = this._DialogObject._element.body.getElementsByClassName('row')
+ let elms2 = this._DialogObject._element.foot.getElementsByTagName('button')
+ let elms3 = this._DialogObject._element.foot.getElementsByTagName('h4')
+ for (let i = 0; i < elms.length; i++) {
+ let mode = elms[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms[i].style.display = 'flex'
+ }
+ else {
+ elms[i].style.display = 'none'
+ }
+ }
+ }
+ for (let i = 0; i < elms2.length; i++) {
+ let mode = elms2[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms2[i].style.display = 'block'
+ }
+ else {
+ elms2[i].style.display = 'none'
+ }
+ }
+ }
+ for (let i = 0; i < elms3.length; i++) {
+ let mode = elms3[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms3[i].style.display = 'block'
+ }
+ else {
+ elms3[i].style.display = 'none'
+ }
+ }
+ }
+ const img = new Image();
+ img.crossOrigin = 'Anonymous';
+ img.src = this.replaceHost(this.options.url, this.options.host);
+ img.onload = () => {
+ const canvas = document.createElement('canvas');
+ const ctx = canvas.getContext('2d');
+
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
+
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ let canvas = this.entity.billboard.image.getValue()
+ let billboardH = canvas.height * (128 / canvas.width)
+ this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ this.entity.billboard.show = true
+ this.labelShow && (this.entity.label.show = true)
+ this.entity.rectangle.show = false
+ }
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
+
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
+ }
+ }
+ }
+
get offset() {
return this.options.offset
}
@@ -69,24 +210,52 @@ class GroundImage extends Base {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
- // 设置画布大小
- canvas.width = img.width * 2;
- canvas.height = img.height * 2;
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
- // 绘制图像
- if (this.flipeX) {
- ctx.scale(1, -1);
- ctx.translate(0, -canvas.height)
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ let canvas = this.entity.billboard.image.getValue()
+ let billboardH = canvas.height * (128 / canvas.width)
+ this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ this.entity.billboard.show = true
+ this.labelShow && (this.entity.label.show = true)
+ this.entity.rectangle.show = false
}
- if (this.flipeY) {
- ctx.scale(-1, 1);
- ctx.translate(-canvas.width, 0);
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
+
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
}
- ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
- this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
- image: canvas,
- transparent: true
- })
}
}
@@ -112,6 +281,70 @@ class GroundImage extends Base {
})
}
+ get billboardScale() {
+ return this.options.billboard.scale
+ }
+ set billboardScale(v) {
+ let billboardScale = Number(v.toFixed(2))
+ if (billboardScale > 99) {
+ billboardScale = 99
+ }
+ if (billboardScale < 0.1) {
+ billboardScale = 0.1
+ }
+ this.options.billboard.scale = billboardScale
+ this.renewPoint()
+ this._elms.billboardScale &&
+ this._elms.billboardScale.forEach(item => {
+ item.value = v
+ })
+ }
+
+ get billboardScaleByDistance() {
+ return this.options.billboard.scaleByDistance
+ }
+ set billboardScaleByDistance(v) {
+ this.options.billboard.scaleByDistance = v
+ this.renewPoint()
+ this._elms.billboardScaleByDistance &&
+ this._elms.billboardScaleByDistance.forEach(item => {
+ item.checked = v
+ })
+ }
+
+ get billboardNear() {
+ return this.options.billboard.near
+ }
+ set billboardNear(v) {
+ let near = v
+ if (near > this.billboardFar) {
+ near = this.billboardFar
+ }
+ this.options.billboard.near = near
+ this.renewPoint()
+ this._elms.billboardNear &&
+ this._elms.billboardNear.forEach(item => {
+ item.value = near
+ })
+ }
+
+ get billboardFar() {
+ return this.options.billboard.far
+ }
+ set billboardFar(v) {
+ let far = v
+ if (far < this.billboardNear) {
+ far = this.billboardNear
+ }
+ this.options.billboard.far = far
+ this.renewPoint()
+ this._elms.billboardFar &&
+ this._elms.billboardFar.forEach(item => {
+ item.value = far
+ })
+ }
+
+
get flipeY() {
return this.options.flipe.y
}
@@ -129,28 +362,47 @@ class GroundImage extends Base {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
- // 设置画布大小
- canvas.width = img.width * 2;
- canvas.height = img.height * 2;
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ // this.entity.billboard.show = true
+ // this.entity.rectangle.show = false
+ }
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
- // 绘制图像
- if (this.flipeX) {
- ctx.scale(1, -1);
- ctx.translate(0, -canvas.height)
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
}
- if (this.flipeY) {
- ctx.scale(-1, 1);
- ctx.translate(-canvas.width, 0);
- }
- ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
- this.entity && (this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
- image: canvas,
- transparent: true
- }))
- // this.offset = {
- // x: Math.abs(this.offset.x - 1),
- // y: this.offset.y,
- // }
}
} else {
console.error("参数必须为boolean")
@@ -173,24 +425,48 @@ class GroundImage extends Base {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
- // 设置画布大小
- canvas.width = img.width * 2;
- canvas.height = img.height * 2;
+ if (this.mode) {
+ // canvas.width = img.width
+ // canvas.height = img.height;
+ // let billboardH = img.height * (128 / img.width)
+ // if (this.flipeX) {
+ // ctx.scale(1, -1);
+ // ctx.translate(0, -canvas.height)
+ // }
+ // if (this.flipeY) {
+ // ctx.scale(-1, 1);
+ // ctx.translate(-canvas.width, 0);
+ // }
+ // ctx.drawImage(img, 0, 0, img.width, img.height)
+ // this.entity.billboard.image = canvas
+ // this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ // this.entity.billboard.show = true
+ // this.entity.rectangle.show = false
+ }
+ else {
+ // 设置画布大小
+ canvas.width = img.width * 2;
+ canvas.height = img.height * 2;
- // 绘制图像
- if (this.flipeX) {
- ctx.scale(1, -1);
- ctx.translate(0, -canvas.height)
+ // 绘制图像
+ if (this.flipeX) {
+ ctx.scale(1, -1);
+ ctx.translate(0, -canvas.height)
+ }
+ if (this.flipeY) {
+ ctx.scale(-1, 1);
+ ctx.translate(-canvas.width, 0);
+ }
+ ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+ this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
+ image: canvas,
+ transparent: true
+ })
+ this.entity.billboard.show = false
+ this.entity.label.show = false
+ this.entity.rectangle.show = true
}
- if (this.flipeY) {
- ctx.scale(-1, 1);
- ctx.translate(-canvas.width, 0);
- }
- ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
- this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
- image: canvas,
- transparent: true
- })
+
// this.offset = {
// x: this.offset.x,
// y: Math.abs(this.offset.y - 1),
@@ -201,6 +477,265 @@ class GroundImage extends Base {
}
}
+ get heightMode() {
+ return this.options.heightMode ? this.options.heightMode : 0
+ }
+ set heightMode(v) {
+ this.options.heightMode = v ? v : 0
+ this.options.heightMode = v || v == 0 ? v : 3
+ let heightMode
+ let heightModeName = ''
+ let altBoxElm
+ if (
+ this._DialogObject &&
+ this._DialogObject._element &&
+ this._DialogObject._element.content
+ ) {
+ altBoxElm = this._DialogObject._element.content.getElementsByClassName(
+ 'alt-box'
+ )[0]
+ }
+ let heightElm
+ if (this._elms.height) {
+ heightElm = this._elms.height.getElementsByClassName('input-number')[0]
+ }
+ switch (this.options.heightMode) {
+ case '0':
+ case 0:
+ altBoxElm &&
+ (altBoxElm.className = 'input-number input-number-unit-1 alt-box')
+ // this._elms.height && (this._elms.height.style.display = 'flex')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1')
+ heightMode = Cesium.HeightReference.NONE
+ heightModeName = '海拔高度'
+ break
+ case '1':
+ case 1:
+ altBoxElm &&
+ (altBoxElm.className = 'input-number input-number-unit-1 alt-box')
+ // this._elms.height && (this._elms.height.style.display = 'flex')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1')
+ heightMode = Cesium.HeightReference.NONE
+ heightModeName = '相对地表'
+ break
+ case '2':
+ case 2:
+ altBoxElm &&
+ (altBoxElm.className =
+ 'input-number input-number-unit-1 alt-box disabled')
+ heightModeName = '依附地表'
+ altBoxElm &&
+ (altBoxElm.className =
+ 'input-number input-number-unit-1 alt-box disabled')
+ heightModeName = '依附地表'
+ heightMode = Cesium.HeightReference.CLAMP_TO_GROUND
+ // this._elms.height && (this._elms.height.style.display = 'none')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1 disabled')
+ break
+ case '3':
+ case 3:
+ altBoxElm &&
+ (altBoxElm.className =
+ 'input-number input-number-unit-1 alt-box disabled')
+ // this._elms.height && (this._elms.height.style.display = 'none')
+ heightElm && (heightElm.className = 'input-number input-number-unit-1 disabled')
+ heightMode = Cesium.HeightReference.NONE
+ heightModeName = '依附模型'
+ break
+ }
+ if (this.entity && this.entity.billboard) {
+ this.entity.billboard.heightReference = heightMode
+ }
+ this._elms.heightMode && (this._elms.heightMode.value = heightModeName)
+ }
+
+ get coordinate() {
+ return this.options.coordinate
+ }
+ set coordinate(v) {
+ this.options.coordinate = v
+ // let position = this._proj.convert(
+ // [
+ // {
+ // x: this.options.position.lng,
+ // y: this.options.position.lat,
+ // z: this.options.position.alt
+ // }
+ // ],
+ // 'EPSG:4326',
+ // v
+ // ).points
+ // if (
+ // this._DialogObject &&
+ // this._DialogObject._element &&
+ // this._DialogObject._element.content &&
+ // position[0]
+ // ) {
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'convert-x'
+ // )[0].value = position[0].x
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'convert-y'
+ // )[0].value = position[0].y
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'convert-z'
+ // )[0].value = position[0].z
+ // }
+ // this._elms.coordinate &&
+ // this._elms.coordinate.forEach(item => {
+ // item.value = v
+ // })
+ }
+
+ get position() {
+ return this.options.position
+ }
+
+ set position(v) {
+ this.options.position = v
+
+ this.coordinate = this.options.coordinate
+
+ if (this._textToCenter) {
+ let point = turf.point([this.options.position.lng, this.options.position.lat])
+ let targetPoint = turf.destination(point, this._textToCenter.distance, this._textToCenter.angle, { units: 'kilometers' }).geometry.coordinates
+ this.getClampToHeight({ lng: targetPoint[0], lat: targetPoint[1] }).then((height) => {
+ let textPosition = [targetPoint[0], targetPoint[1], height]
+ this.options.text.position = { lng: targetPoint[0], lat: targetPoint[1], alt: height }
+ this.text && (this.text.position = textPosition)
+ })
+ }
+
+ this._elms.lng &&
+ this._elms.lng.forEach(item => {
+ item.value = this.options.position.lng
+ })
+ this._elms.lat &&
+ this._elms.lat.forEach(item => {
+ item.value = this.options.position.lat
+ })
+
+ if (this._elms.height) {
+ let heightElm = this._elms.height.getElementsByClassName('height')[0]
+ if (heightElm) {
+ switch (this._elms.heightMode.value) {
+ case '海拔高度':
+ heightElm.value = this.options.position.alt
+ break
+ case '相对地表':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ heightElm.value = Number(
+ (this.options.position.alt - position[0].height).toFixed(2)
+ )
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ })
+ } else {
+ heightElm.value = Number(
+ Number(this.options.position.alt).toFixed(2)
+ )
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ }
+ break
+ case '依附地表':
+ case '依附地表':
+ break
+ case '依附模型':
+ this.updateHeight()
+ break
+ }
+ }
+ }
+ }
+
+ get labelShow() {
+ return this.options.label.show
+ }
+ set labelShow(v) {
+ this.options.label.show = v
+ if (this.entity) {
+ if (this.mode == 1) {
+ this.entity.label.show = v
+ }
+ else {
+ this.entity.label.show = false
+ }
+ }
+
+ this._elms.labelShow &&
+ this._elms.labelShow.forEach(item => {
+ item.value = v
+ })
+ }
+
+ get labelFontFamily() {
+ return this.options.label.fontFamily
+ }
+
+ set labelFontFamily(v) {
+ this.options.label.fontFamily = v || 0
+ this.renewPoint()
+
+ let name = getFontFamilyName(this.labelFontFamily) || ''
+ this._elms.labelFontFamily &&
+ this._elms.labelFontFamily.forEach(item => {
+ item.value = name
+ })
+ }
+
+ get labelFontSize() {
+ return this.options.label.fontSize
+ }
+ set labelFontSize(v) {
+ this.options.label.fontSize = v
+ this.renewPoint()
+ this._elms.labelFontSize &&
+ this._elms.labelFontSize.forEach(item => {
+ item.value = v
+ })
+ }
+
+ get labelColor() {
+ return this.options.label.color
+ }
+ set labelColor(v) {
+ this.options.label.color = v || '#00ffff'
+ this.renewPoint()
+ if (this._elms.labelColor) {
+ this._elms.labelColor.forEach((item, i) => {
+ let colorPicker = new YJColorPicker({
+ el: item.el,
+ size: 'mini', //颜色box类型
+ alpha: true, //是否开启透明度
+ defaultColor: this.options.label.color,
+ disabled: false, //是否禁止打开颜色选择器
+ openPickerAni: 'opacity', //打开颜色选择器动画
+ sure: c => {
+ this.labelColor = c
+ }, //点击确认按钮事件回调
+ clear: () => {
+ this.labelColor = 'rgba(0,255,255,1)'
+ } //点击清空按钮事件回调
+ })
+ this._elms.labelColor[i] = colorPicker
+ })
+ }
+ }
+
async create() {
// let gap = Math.abs(Math.cos(Math.PI/180 * this.options.position.lat)) * (0.0001*this.options.scale)
// let fromDegreesArray = [
@@ -209,6 +744,15 @@ class GroundImage extends Base {
// this.options.position.lng + 0.05, this.options.position.lat + 0.05,
// this.options.position.lng - 0.05, this.options.position.lat + 0.05,
// ]
+ let _this = this
+ let heightMode
+ let font = getFontFamily(this.labelFontFamily) || 'Helvetica'
+ switch (this.options.heightMode) {
+ case 2:
+ case '2':
+ heightMode = Cesium.HeightReference.CLAMP_TO_GROUND
+ break
+ }
let response = await fetch(this.replaceHost(this.options.url, this.options.host), {
method: 'get',
headers: {
@@ -225,6 +769,13 @@ class GroundImage extends Base {
img.onload = () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
+ const canvas2 = document.createElement('canvas');
+ const ctx2 = canvas2.getContext('2d');
+ let width = img.width
+ let height = img.height
+ canvas2.width = width
+ canvas2.height = height;
+ ctx2.drawImage(img, 0, 0, width, height)
// 设置画布大小
canvas.width = img.width * 2;
@@ -240,10 +791,65 @@ class GroundImage extends Base {
}
ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
+
+ let billboardH = height * (128 / width)
+
this.entity = this.sdk.viewer.entities.add({
id: this.options.id,
show: this.options.show,
+ position: new Cesium.CallbackProperty(() => {
+ return Cesium.Cartesian3.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat,
+ this.options.position.alt || 0
+ )
+ }),
+ billboard: {
+ show: this.mode ? true : false,
+ image: canvas2,
+ scale: this.billboardScale,
+ disableDepthTestDistance: new Cesium.CallbackProperty(function () {
+ return getGroundCover() ? undefined : Number.POSITIVE_INFINITY
+ }, false),
+ heightReference: heightMode,
+ width: 128,
+ height: billboardH,
+ horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
+ verticalOrigin: Cesium.VerticalOrigin.TOP,
+ // pixelOffset: { x: -128 * this.billboardScale * (this.flipeY ? (1-this.options.offset.x) : this.options.offset.x), y: -billboardH * this.billboardScale * (this.flipeX ? (1-this.options.offset.y) : this.options.offset.y) }
+ pixelOffset: { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ },
+ label: {
+ show: this.mode ? _this.options.label.show : false,
+ text: _this.options.label.text,
+ disableDepthTestDistance: new Cesium.CallbackProperty(function () {
+ return getGroundCover() ? undefined : Number.POSITIVE_INFINITY
+ }, false),
+ heightReference: heightMode,
+ font: _this.options.label.fontSize + 'px ' + font,
+ fillColor: Cesium.Color.fromCssColorString(_this.options.label.color),
+ // verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
+ pixelOffset: new Cesium.CallbackProperty(function () {
+ if (_this.options.show) {
+ return new Cesium.Cartesian2(
+ 0,
+ -billboardH * _this.billboardScale -
+ _this.options.label.fontSize / 2 -
+ 5
+ )
+ } else {
+ return new Cesium.Cartesian2(
+ 0,
+ -_this.options.label.fontSize / 2 - 5
+ )
+ }
+ }, false),
+ outlineColor: Cesium.Color.BLACK,
+ outlineWidth: 1,
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE
+ },
rectangle: {
+ show: this.mode ? false : true,
coordinates: new Cesium.CallbackProperty(() => {
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.position.lat)) * (0.0001 * this.options.scale)
let offset = {
@@ -293,6 +899,8 @@ class GroundImage extends Base {
}, false)
},
})
+
+ this.renewPoint()
if (this.sdk.viewer._element.className === 'cesium-viewer 2d') {
this.entity.rectangle.height = 0
}
@@ -340,8 +948,8 @@ class GroundImage extends Base {
this.originalOptions = this.deepCopyObj(this.options)
this._DialogObject.close()
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
- syncData(this.sdk, this.options.id)
- syncSplitData(this.sdk, this.options.id)
+ // syncData(this.sdk, this.options.id)
+ // syncSplitData(this.sdk, this.options.id)
},
resetCallBack: () => {
this.reset()
@@ -357,7 +965,7 @@ class GroundImage extends Base {
// color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
// show: true,
// });
-
+
if (anchorSetDialogObject && anchorSetDialogObject.close) {
anchorSetDialogObject.close()
}
@@ -513,6 +1121,440 @@ class GroundImage extends Base {
}
}
+ // let coordinateData = []
+ // this.epsg_map.forEach((value, key) => {
+ // coordinateData.push({
+ // name: `${value.name}(${value.epsg})`,
+ // value: key
+ // })
+ // })
+ // let coordinateDataLegpObject = legp(
+ // this._DialogObject._element.content.getElementsByClassName(
+ // 'coordinate-select-box'
+ // )[0],
+ // '.coordinate-select'
+ // )
+ // if (coordinateDataLegpObject) {
+ // coordinateDataLegpObject.legp_search(coordinateData)
+ // let coordinateDataLegpElm = this._DialogObject._element.content
+ // .getElementsByClassName('coordinate-select')[0]
+ // .getElementsByTagName('input')[0]
+ // if (!this.coordinate) {
+ // this.coordinate = coordinateData[0].value
+ // } else {
+ // this.coordinate = this.coordinate
+ // }
+ // coordinateDataLegpElm.value = this.coordinate
+ // for (let i = 0; i < coordinateData.length; i++) {
+ // if (coordinateData[i].value === coordinateData.value) {
+ // coordinateDataLegpObject.legp_searchActive(
+ // coordinateData[i].value
+ // )
+ // break
+ // }
+ // }
+ // coordinateDataLegpElm.addEventListener('input', () => {
+ // for (let i = 0; i < coordinateData.length; i++) {
+ // if (coordinateData[i].value === coordinateDataLegpElm.value) {
+ // this.coordinate = coordinateData[i].value
+ // break
+ // }
+ // }
+ // })
+ // }
+
+ let elms = contentElm.getElementsByClassName('row')
+ let elms2 = contentElm.getElementsByTagName('h4')
+ for (let i = 0; i < elms.length; i++) {
+ let mode = elms[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms[i].style.display = 'flex'
+ }
+ else {
+ elms[i].style.display = 'none'
+ }
+ }
+ }
+ for (let i = 0; i < elms2.length; i++) {
+ let mode = elms2[i].getAttribute('mode')
+ if (mode !== null) {
+ if (mode == this.options.mode) {
+ elms2[i].style.display = 'block'
+ }
+ else {
+ elms2[i].style.display = 'none'
+ }
+ }
+ }
+
+ // let lng = contentElm.getElementsByClassName("lng")[0]
+ // let lat = contentElm.getElementsByClassName("lat")[0]
+ // let alt = contentElm.getElementsByClassName("alt")[0]
+ // lng.value = this.options.position.lng
+ // lat.value = this.options.position.lat
+ // alt.value = this.options.position.alt
+ // this._elms.lng = [lng]
+ // this._elms.lat = [lat]
+ // this._elms.alt = [alt]
+ // lng.addEventListener('blur', (e) => {
+ // let value = e.target.value
+ // if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ // value = Number(value)
+ // if ((e.target.max) && value > Number(e.target.max)) {
+ // value = Number(e.target.max)
+ // }
+ // if ((e.target.min) && value < Number(e.target.min)) {
+ // value = Number(e.target.min)
+ // }
+ // if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
+ // value = Number(e.target.dataset.min)
+ // }
+ // }
+ // // this.position = {
+ // // lng: value,
+ // // lat: this.position.lat,
+ // // alt: this.position.alt
+ // // }
+ // this.options.position.lng = value
+ // this.coordinate = this.options.coordinate
+ // })
+ // lat.addEventListener('blur', (e) => {
+ // let value = e.target.value
+ // if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ // value = Number(value)
+ // if ((e.target.max) && value > Number(e.target.max)) {
+ // value = Number(e.target.max)
+ // }
+ // if ((e.target.min) && value < Number(e.target.min)) {
+ // value = Number(e.target.min)
+ // }
+ // if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
+ // value = Number(e.target.dataset.min)
+ // }
+ // }
+ // // this.position = {
+ // // lng: this.position.lng,
+ // // lat: value,
+ // // alt: this.position.alt
+ // // }
+ // this.options.position.lat = value
+ // this.coordinate = this.options.coordinate
+ // })
+ // alt.addEventListener('blur', (e) => {
+ // let value = e.target.value
+ // if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ // value = Number(value)
+ // if ((e.target.max) && value > Number(e.target.max)) {
+ // value = Number(e.target.max)
+ // }
+ // if ((e.target.min) && value < Number(e.target.min)) {
+ // value = Number(e.target.min)
+ // }
+ // if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
+ // value = Number(e.target.dataset.min)
+ // }
+ // }
+ // // this.position = {
+ // // lng: this.position.lng,
+ // // lat: this.position.lat,
+ // // alt: value
+ // // }
+ // this.options.position.alt = value
+ // this.coordinate = this.options.coordinate
+ // })
+
+ let colorPicker = new YJColorPicker({
+ el: contentElm.getElementsByClassName('labelColor')[0],
+ size: 'mini', //颜色box类型
+ alpha: true, //是否开启透明度
+ defaultColor: this.labelColor,
+ disabled: false, //是否禁止打开颜色选择器
+ openPickerAni: 'opacity', //打开颜色选择器动画
+ sure: color => {
+ this.labelColor = color
+ }, //点击确认按钮事件回调
+ clear: () => {
+ this.labelColor = 'rgba(255,255,255,1)'
+ } //点击清空按钮事件回调
+ })
+ this._elms.labelColor = [colorPicker]
+
+ setTimeout(async () => {
+ let flipeOverXBtn = this._DialogObject._element.foot.getElementsByClassName('flipe-over-x')[0]
+ let flipeOverYBtn = this._DialogObject._element.foot.getElementsByClassName('flipe-over-y')[0]
+ flipeOverXBtn.setAttribute('mode', 0)
+ flipeOverYBtn.setAttribute('mode', 0)
+ if (this.options.mode) {
+ flipeOverXBtn.style.display = 'none'
+ flipeOverYBtn.style.display = 'none'
+ }
+ else {
+ flipeOverXBtn.style.display = 'block'
+ flipeOverYBtn.style.display = 'block'
+ }
+ let modeData = [
+ {
+ name: '贴地',
+ value: '贴地',
+ key: 0
+ },
+ {
+ name: '立体',
+ value: '立体',
+ key: 1
+ }
+ ]
+ let modeDataLegpObject = legp(
+ this._DialogObject._element.content.getElementsByClassName(
+ 'mode-box'
+ )[0],
+ '.mode'
+ )
+ if (modeDataLegpObject) {
+ modeDataLegpObject.legp_search(modeData)
+ let modeDataLegpElm = this._DialogObject._element.content
+ .getElementsByClassName('mode')[0]
+ .getElementsByTagName('input')[0]
+ modeDataLegpElm.value = this.mode
+ for (let i = 0; i < modeData.length; i++) {
+ if (modeData[i].key === this.mode) {
+ modeDataLegpElm.value = modeData[i].value
+ modeDataLegpObject.legp_searchActive(modeData[i].value)
+ break
+ }
+ }
+ modeDataLegpElm.addEventListener('input', () => {
+ for (let i = 0; i < modeData.length; i++) {
+ if (modeData[i].value === modeDataLegpElm.value) {
+ this.mode = modeData[i].key
+ break
+ }
+ }
+ })
+ this._elms.mode = [modeDataLegpElm]
+ }
+
+
+ let heightBoxElm = this._DialogObject._element.content.getElementsByClassName('height-box')[0]
+ let heightElm = heightBoxElm.getElementsByClassName('height')[0]
+ let heightModeData = [
+ {
+ name: '海拔高度',
+ value: '海拔高度',
+ key: '0'
+ },
+ {
+ name: '相对地表',
+ value: '相对地表',
+ key: '1'
+ },
+ {
+ name: '依附地表',
+ value: '依附地表',
+ key: '2'
+ },
+ {
+ name: '依附模型',
+ value: '依附模型',
+ key: '3'
+ }
+ ]
+ let heightMode = this.heightMode
+
+ switch (heightMode) {
+ case 0:
+ case '0':
+ heightElm.value = this.options.position.alt
+ break
+ case 1:
+ case '1':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ heightElm.value = Number(
+ (this.options.position.alt - Number(position[0].height.toFixed(2))).toFixed(2)
+ )
+ })
+ } else {
+ heightElm.value = Number(this.options.position.alt.toFixed(2))
+ }
+ break
+ case 2:
+ case '2':
+ case 3:
+ case '3':
+ let objectsToExclude = []
+ for (let [key, value] of this.sdk.entityMap) {
+ if (value.type === 'RadarScanStereoscopic' && value.entity) {
+ objectsToExclude.push(value.entity)
+ }
+ }
+ this.getClampToHeight(this.options.position, objectsToExclude).then(h => {
+ this.options.position.alt = Number(h.toFixed(2))
+ this.coordinate = this.options.coordinate
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ heightElm.value = this.options.position.alt
+ })
+ break
+ }
+ let heightModeObject = legp(
+ this._DialogObject._element.content.getElementsByClassName(
+ 'height-mode-box'
+ )[0],
+ '.height-mode'
+ )
+ if (heightModeObject) {
+ heightModeObject.legp_search(heightModeData)
+ let heightModeDataLegpElm = this._DialogObject._element.content
+ .getElementsByClassName('height-mode')[0]
+ .getElementsByTagName('input')[0]
+ heightModeDataLegpElm.value = heightModeData[this.heightMode].value
+ for (let i = 0; i < heightModeData.length; i++) {
+ if (heightModeData[i].value == heightModeDataLegpElm.value) {
+ heightModeObject.legp_searchActive(heightModeData[i].value)
+ break
+ }
+ }
+ heightModeDataLegpElm.addEventListener('input', () => {
+ for (let i = 0; i < heightModeData.length; i++) {
+ if (heightModeData[i].value === heightModeDataLegpElm.value) {
+ heightMode = heightModeData[i].key
+ switch (heightMode) {
+ case 0:
+ case '0':
+ this.options.position.alt = Number(heightElm.value)
+ this.heightMode = 0
+ // this.position = this.options.position
+ break
+ case 1:
+ case '1':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ this.options.position.alt =
+ Number(heightElm.value) +
+ Number(position[0].height.toFixed(2))
+ // this.position = this.options.position
+ })
+ } else {
+ this.options.position.alt = Number(heightElm.value)
+ // this.position = this.options.position
+ }
+ this.heightMode = 1
+ break
+ case 2:
+ case '2':
+ this.heightMode = 2
+ break
+ case 3:
+ case '3':
+ let objectsToExclude = []
+ for (let [key, value] of this.sdk.entityMap) {
+ if (value.type === 'RadarScanStereoscopic' && value.entity) {
+ objectsToExclude.push(value.entity)
+ }
+ }
+ this.getClampToHeight(this.options.position, objectsToExclude).then(h => {
+ this.options.position.alt = Number(h.toFixed(2))
+ // this.position = this.options.position
+ })
+ this.heightMode = 3
+ break
+ }
+ this.position = this.options.position
+ break
+ }
+ }
+ })
+
+ heightElm.addEventListener('blur', async () => {
+ switch (heightMode) {
+ case 0:
+ case '0':
+ this.options.position.alt = Number(
+ Number(heightElm.value).toFixed(2)
+ )
+ break
+ case 1:
+ case '1':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ let position = await Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ )
+ this.options.position.alt =
+ Number(heightElm.value) +
+ Number(position[0].height.toFixed(2))
+ } else {
+ this.options.position.alt = Number(heightElm.value)
+
+ }
+ break
+ case 2:
+ case '2':
+ break
+ }
+ this.position = this.options.position
+ })
+ this._elms.height = heightBoxElm
+ this._elms.heightMode = heightModeDataLegpElm
+
+ this.heightMode = this.heightMode
+ }
+
+ let fontData = getFontList()
+ let fontObject = legp(
+ this._DialogObject._element.content.getElementsByClassName(
+ 'font-select-box'
+ )[0],
+ '.font-select'
+ )
+ if (fontObject) {
+ fontObject.legp_search(fontData)
+ let fontDataLegpElm = this._DialogObject._element.content
+ .getElementsByClassName('font-select')[0]
+ .getElementsByTagName('input')[0]
+ fontDataLegpElm.value = fontData[this.labelFontFamily].value
+ for (let i = 0; i < fontData.length; i++) {
+ if (fontData[i].value == fontDataLegpElm.value) {
+ fontObject.legp_searchActive(fontData[i].value)
+ break
+ }
+ }
+ fontDataLegpElm.addEventListener('input', () => {
+ for (let i = 0; i < fontData.length; i++) {
+ if (fontData[i].value === fontDataLegpElm.value) {
+ this.labelFontFamily = fontData[i].key
+ break
+ }
+ }
+ })
+ this._elms.labelFontFamily = [fontDataLegpElm]
+ }
+ }, 0);
} else {
if (this._DialogObject && this._DialogObject.remove) {
@@ -610,12 +1652,7 @@ class GroundImage extends Base {
position: { ...this.options.position }
}
}
- else {
- this.options.position.lng = this.previous.position.lng
- this.options.position.lat = this.previous.position.lat
- this.options.position.alt = this.previous.position.alt
- }
-
+ this.position = { ...this.previous.position }
}
}
@@ -727,6 +1764,167 @@ class GroundImage extends Base {
}
}
+ async updateHeight() {
+ let height
+ let height2
+ let point1 = new Cesium.Cartesian3.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat,
+ 0
+ )
+ let point2 = new Cesium.Cartesian3.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat,
+ 10000000000000
+ )
+
+ let objectsToExclude = []
+ for (let [key, value] of this.sdk.entityMap) {
+ if (value.type === 'RadarScanStereoscopic' && value.entity) {
+ objectsToExclude.push(value.entity)
+ }
+ }
+ let updatedCartesians = await this.sdk.viewer.scene.clampToHeightMostDetailed([point1], objectsToExclude)
+ if (updatedCartesians && updatedCartesians[0]) {
+ height = this.cartesian3Towgs84(updatedCartesians[0], this.sdk.viewer).alt
+ }
+
+ let direction = Cesium.Cartesian3.subtract(
+ point1,
+ point2,
+ new Cesium.Cartesian3()
+ )
+ let c = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3())
+ let ray = new Cesium.Ray(point2, c)
+ let r = {}
+ let pickedObjects = this.sdk.viewer.scene.drillPickFromRay(ray)
+ for (let i = pickedObjects.length - 1; i >= 0; i--) {
+ if (pickedObjects[i].position) {
+ r = pickedObjects[i]
+ break
+ }
+ }
+ if (r && r.position) {
+ height2 = this.cartesian3Towgs84(r.position, this.sdk.viewer).alt
+ }
+ let promise
+ try {
+ promise = await Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ )
+ } catch (error) { }
+
+ if ((height2 === void 0 || height2 < promise[0].height) && promise) {
+ height2 = promise[0].height
+ }
+ if (height === void 0 || height < height2) {
+ height = height2
+ }
+ if (height !== undefined) {
+ this.options.position.alt = Number(Number(height).toFixed(2))
+ this._elms.alt &&
+ this._elms.alt.forEach(item => {
+ item.value = this.options.position.alt
+ })
+ this.coordinate = this.options.coordinate
+
+ if (this._elms.height) {
+ let heightElm = this._elms.height.getElementsByClassName('height')[0]
+ if (heightElm) {
+ switch (this._elms.heightMode.value) {
+ case '海拔高度':
+ heightElm.value = this.options.position.alt
+ break
+ case '相对地表':
+ if (this.sdk.viewer.scene.terrainProvider.availability) {
+ Cesium.sampleTerrainMostDetailed(
+ this.sdk.viewer.scene.terrainProvider,
+ [
+ Cesium.Cartographic.fromDegrees(
+ this.options.position.lng,
+ this.options.position.lat
+ )
+ ]
+ ).then(position => {
+ heightElm.value = Number(
+ (this.options.position.alt - position[0].height).toFixed(2)
+ )
+ })
+ } else {
+ heightElm.value = this.options.position.alt
+ }
+ break
+ case '依附地表':
+ break
+ case '依附模型':
+ heightElm.value = this.options.position.alt
+ break
+ }
+ }
+ }
+ }
+
+ // if (!this.entity.values) {
+ // this.entity.position = Cesium.Cartesian3.fromDegrees(
+ // this.options.position.lng,
+ // this.options.position.lat,
+ // this.options.position.alt
+ // )
+ // }
+ }
+
+ renewPoint() {
+ if (!this.entity.values && this.entity.billboard) {
+ let font = getFontFamily(this.labelFontFamily) || 'Helvetica'
+ this.entity.billboard.scale = this.billboardScale
+ if (this.billboardScaleByDistance) {
+ this.entity.billboard.scaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ this.entity.billboard.pixelOffsetScaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ this.entity.label.scaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ this.entity.label.pixelOffsetScaleByDistance = new Cesium.NearFarScalar(
+ this.billboardNear,
+ 1,
+ this.billboardFar,
+ 0
+ )
+ } else {
+ this.entity.billboard.scaleByDistance = undefined
+ this.entity.billboard.pixelOffsetScaleByDistance = undefined
+ this.entity.label.scaleByDistance = undefined
+ this.entity.label.pixelOffsetScaleByDistance = undefined
+ }
+ this.entity.label.font = this.options.label.fontSize + 'px ' + font
+ this.entity.label.fillColor = Cesium.Color.fromCssColorString(
+ this.options.label.color
+ )
+ let canvas = this.entity.billboard.image.getValue()
+ let billboardH = canvas.height * (128 / canvas.width)
+ this.entity.billboard.pixelOffset = { x: -128 * this.billboardScale * this.options.offset.x, y: -billboardH * this.billboardScale * this.options.offset.y }
+ // this.entity.billboard.pixelOffset = { x: -width * this.billboardScale * (this.flipeY ? (1 - this.options.offset.x) : this.options.offset.x), y: -height * this.billboardScale * (this.flipeX ? (1 - this.options.offset.y) : this.options.offset.y) }
+ }
+ }
+
reset() {
if (!this.entity) {
return
From a6fb1af6f9e8560f6b25409e1045f043c5817ce6 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Wed, 13 Aug 2025 21:56:53 +0800
Subject: [PATCH 04/24] =?UTF-8?q?=E4=BA=8C=E4=B8=89=E7=BB=B4=E5=8D=95?=
=?UTF-8?q?=E7=8B=AC=E6=98=BE=E7=A4=BA=E7=8A=B6=E6=80=81=E4=BF=9D=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/PolygonObject/index.js | 1 -
src/Obj/Base/PolyhedronObject/eventBinding.js | 2 +-
src/Obj/Base/WallRealStereoscopic/eventBinding.js | 2 +-
src/Obj/Base/WallStereoscopic/eventBinding.js | 2 +-
src/Obj/Base/index.js | 11 ++++++++++-
static/custom/css/index.css | 2 +-
6 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/Obj/Base/PolygonObject/index.js b/src/Obj/Base/PolygonObject/index.js
index dbaafdf..ca87983 100644
--- a/src/Obj/Base/PolygonObject/index.js
+++ b/src/Obj/Base/PolygonObject/index.js
@@ -1216,7 +1216,6 @@ class PolygonObject extends Base {
alt: this.label.position[2]
}
this.originalOptions = this.deepCopyObj(this.options)
- console.log('000000000000',this.options.label.scaleByDistance)
this._DialogObject.close()
this.Dialog.confirmCallBack &&
this.Dialog.confirmCallBack(this.originalOptions)
diff --git a/src/Obj/Base/PolyhedronObject/eventBinding.js b/src/Obj/Base/PolyhedronObject/eventBinding.js
index 6e7380d..87fa67f 100644
--- a/src/Obj/Base/PolyhedronObject/eventBinding.js
+++ b/src/Obj/Base/PolyhedronObject/eventBinding.js
@@ -61,7 +61,7 @@ class eventBinding {
})
blurEvent = (e) => {
let value = e.target.value
- if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
diff --git a/src/Obj/Base/WallRealStereoscopic/eventBinding.js b/src/Obj/Base/WallRealStereoscopic/eventBinding.js
index 60f6829..22136c8 100644
--- a/src/Obj/Base/WallRealStereoscopic/eventBinding.js
+++ b/src/Obj/Base/WallRealStereoscopic/eventBinding.js
@@ -57,7 +57,7 @@ class eventBinding {
})
blurEvent = (e) => {
let value = e.target.value
- if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
diff --git a/src/Obj/Base/WallStereoscopic/eventBinding.js b/src/Obj/Base/WallStereoscopic/eventBinding.js
index 52240e6..4a2f708 100644
--- a/src/Obj/Base/WallStereoscopic/eventBinding.js
+++ b/src/Obj/Base/WallStereoscopic/eventBinding.js
@@ -54,7 +54,7 @@ class eventBinding {
})
blurEvent = (e) => {
let value = e.target.value
- if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
+ if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
diff --git a/src/Obj/Base/index.js b/src/Obj/Base/index.js
index 7439d37..3f16db4 100644
--- a/src/Obj/Base/index.js
+++ b/src/Obj/Base/index.js
@@ -31,6 +31,7 @@ class Base extends Tools {
this.rightClickCallBack = null
this.picking = true
this.options.host = this.options.host || getHost()
+ // this.#_showView = this.options.showView || 0
this.setDefaultValue()
// this.sdk.addIncetance(this.options.id, this)
@@ -66,7 +67,15 @@ class Base extends Tools {
let sdk2D = get2DSdk().sdkD
if (!sdk2D) {
- v = 0
+ this.#_showView = v
+ if(this.entity) {
+ this.entity._showView = v
+ }
+ return
+ }
+ if (this.sdk === sdk2D) {
+ this.#_showView = 0
+ return
}
if (!this.#_showView && !this.show) {
return
diff --git a/static/custom/css/index.css b/static/custom/css/index.css
index f7ce847..f78718f 100644
--- a/static/custom/css/index.css
+++ b/static/custom/css/index.css
@@ -3096,7 +3096,7 @@
/* 贴地图片 */
.YJ-custom-base-dialog.ground-image>.content {
- width: 500px;
+ width: 560px;
}
/* 模型 */
From d7ecd6d865cd6cbf02891d16f7c75d14c7f3ab17 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Thu, 14 Aug 2025 00:15:55 +0800
Subject: [PATCH 05/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=8C=E4=B8=89?=
=?UTF-8?q?=E7=BB=B4=E5=88=87=E6=8D=A2=E6=97=B6=E5=87=BA=E7=8E=B0=E7=9A=84?=
=?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/GroundSvg/index.js | 5 ++++-
src/Obj/Base/LabelObject/index.js | 2 +-
src/Obj/Base/TrajectoryMotion/index.js | 4 ++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/Obj/Base/GroundSvg/index.js b/src/Obj/Base/GroundSvg/index.js
index d94cce8..5f74f8d 100644
--- a/src/Obj/Base/GroundSvg/index.js
+++ b/src/Obj/Base/GroundSvg/index.js
@@ -1212,7 +1212,7 @@ class GroundSvg extends Base {
* @param {boolean} status=false 状态
*/
drag(status, cd) {
- if (!this.#loaded) {
+ if (!this.#loaded || !this.sdk || !this.sdk.viewer) {
return
}
this.ismove = false
@@ -2020,6 +2020,9 @@ class GroundSvg extends Base {
return
}
this.drag(false)
+ if(!this.sdk || !this.sdk.viewer) {
+ return
+ }
this.sdk.viewer.entities.remove(this.entity)
this.text && this.text.remove()
for (let i = this.entity.values.length; i >= 0; i--) {
diff --git a/src/Obj/Base/LabelObject/index.js b/src/Obj/Base/LabelObject/index.js
index dfd9dc1..5b127cd 100644
--- a/src/Obj/Base/LabelObject/index.js
+++ b/src/Obj/Base/LabelObject/index.js
@@ -441,7 +441,7 @@ class LabelObject extends Base {
clearTimeout(this.#updateBillboardImageTimeout)
this.#updateBillboardImageTimeout = setTimeout(() => {
clearTimeout(this.#updateBillboardImageTimeout)
- this.entity.billboard.image = this.getcanvas()
+ this.entity && (this.entity.billboard.image = this.getcanvas())
}, 500)
}
get lineColor() {
diff --git a/src/Obj/Base/TrajectoryMotion/index.js b/src/Obj/Base/TrajectoryMotion/index.js
index f561a70..e02a63a 100644
--- a/src/Obj/Base/TrajectoryMotion/index.js
+++ b/src/Obj/Base/TrajectoryMotion/index.js
@@ -655,7 +655,7 @@ class TrajectoryMotion extends Base {
})
this.TweenAnimate.pause()
setTimeout(() => {
- _this.model.isMove = false
+ _this.model && (_this.model.isMove = false)
}, 200);
}
}
@@ -1531,7 +1531,7 @@ class TrajectoryMotion extends Base {
else {
setPosition(startDistance)
setTimeout(() => {
- _this.model.isMove = false
+ _this.model && (_this.model.isMove = false)
}, 500);
From e022aa5ef190b7e656ed1ca82384935abe3a2497 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Thu, 14 Aug 2025 15:54:14 +0800
Subject: [PATCH 06/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B4=B4=E5=9C=B0?=
=?UTF-8?q?=E5=9B=BE=E7=89=87=E4=BF=AE=E6=94=B9=E6=96=87=E5=AD=97=E4=B8=8D?=
=?UTF-8?q?=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/GroundImage/index.js | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/Obj/Base/GroundImage/index.js b/src/Obj/Base/GroundImage/index.js
index 2544c4f..969ccc5 100644
--- a/src/Obj/Base/GroundImage/index.js
+++ b/src/Obj/Base/GroundImage/index.js
@@ -81,6 +81,16 @@ class GroundImage extends Base {
this.create()
}
+ get name() {
+ return this.options.name
+ }
+
+ set name(v) {
+ super.name = v
+ this.options.label.text = this.options.name
+ this.entity && (this.entity.label.text = this.options.label.text)
+ }
+
get mode() {
return this.options.mode
}
From 22f9693957cdfaf89e13299537783395ca1494a3 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Thu, 14 Aug 2025 15:55:52 +0800
Subject: [PATCH 07/24] =?UTF-8?q?=E4=BA=8C=E4=B8=89=E7=BB=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/MultiViewportMode/index.js | 6 +++++-
src/Obj/Base/GroundSvg/index.js | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/Global/MultiViewportMode/index.js b/src/Global/MultiViewportMode/index.js
index f5531be..53ec9c0 100644
--- a/src/Global/MultiViewportMode/index.js
+++ b/src/Global/MultiViewportMode/index.js
@@ -231,7 +231,11 @@ async function syncData2(sdk, id, entityId) {
if (obj.showView == 3) {
options.show = false
}
- let target = await new obj.constructor(sdk2D, options)
+ let target = await sdk2D.entityMap.get(options.id)
+ if(target) {
+ await target.remove()
+ }
+ target = await new obj.constructor(sdk2D, options)
target.onClick = obj.onClick
target.onRightClick = obj.onRightClick
target.onMouseMove = obj.onMouseMove
diff --git a/src/Obj/Base/GroundSvg/index.js b/src/Obj/Base/GroundSvg/index.js
index 5f74f8d..198aa89 100644
--- a/src/Obj/Base/GroundSvg/index.js
+++ b/src/Obj/Base/GroundSvg/index.js
@@ -1526,6 +1526,9 @@ class GroundSvg extends Base {
controlPoints[9] = turf.destination(point, wh, 0 + angle, options).geometry.coordinates
this.controlPoints = controlPoints
+ if(!this.sdk || !this.sdk.viewer) {
+ return
+ }
for (let i = 0; i < this.controlPoints.length; i++) {
let color = '#00ff0a'
if (i === 5) {
From 9f35d752c2ba55ab881342bf61613fa039e48591 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Thu, 14 Aug 2025 15:56:34 +0800
Subject: [PATCH 08/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=87=E5=BD=A2?=
=?UTF-8?q?=E4=BA=8C=E6=AC=A1=E7=BC=96=E8=BE=91=E6=97=B6=E6=A0=87=E6=B3=A8?=
=?UTF-8?q?=E6=9C=AA=E8=B4=B4=E5=90=88=E5=AE=9E=E4=BD=93=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/SectorObject/index.js | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/Obj/Base/SectorObject/index.js b/src/Obj/Base/SectorObject/index.js
index 6d306bc..66e9c1e 100644
--- a/src/Obj/Base/SectorObject/index.js
+++ b/src/Obj/Base/SectorObject/index.js
@@ -293,7 +293,7 @@ class SectorObject extends Base {
return this.options.line.width
}
set lineWidth(v) {
- this.options.line.width = ((v || v === 0) ? v : 3)
+ this.options.line.width = ((v || v === 0) ? v : 3)
this.entity.polyline.width = this.options.line.width
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
item.value = this.options.line.width
@@ -1560,7 +1560,7 @@ class SectorObject extends Base {
_addRr() {
if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) {
this.options.attribute.vr.content.push({
- name: '全景图' ,
+ name: '全景图',
url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value
})
this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = ''
@@ -1573,7 +1573,7 @@ class SectorObject extends Base {
addAttributeRr(vr) {
this.options.attribute.vr.content.push({
- name: '全景图' ,
+ name: '全景图',
url: vr
})
this.attributeVr = this.options.attribute.vr.content
@@ -1922,6 +1922,19 @@ class SectorObject extends Base {
that.cartesian3Towgs84(positions[1], that.sdk.viewer),
that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer)
]
+ let objectsToExclude = [...that.sdk.viewer.entities.values]
+ that
+ .getClampToHeight({
+ lng: that.options.center.lng,
+ lat: that.options.center.lat
+ }, objectsToExclude)
+ .then(height => {
+ that.label.position = [
+ that.options.center.lng,
+ that.options.center.lat,
+ height
+ ]
+ })
setTimeout(() => {
createNodePoints(positions[1], 'sector-start')
createNodePoints(positions[positions.length - 4], 'sector-end')
From eec0ca44c00211a40860a1cd9d17191916a9c508 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 10:00:38 +0800
Subject: [PATCH 09/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=9B=86=E7=BB=93?=
=?UTF-8?q?=E5=9C=B0=E7=82=B9=E4=BD=8D=E7=BB=8F=E5=BA=A6=E8=B6=8A=E8=BF=87?=
=?UTF-8?q?180=C2=B0=E6=97=B6=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Draw/drawAssemble.js | 3 +++
src/Tools/index.js | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/Draw/drawAssemble.js b/src/Draw/drawAssemble.js
index 8f1a321..6cc8605 100644
--- a/src/Draw/drawAssemble.js
+++ b/src/Draw/drawAssemble.js
@@ -124,6 +124,9 @@ class DrawAssemble extends Draw {
if (this.points_ids.length === 1) {
let pnts = new Array();
this.positions.forEach((item) => {
+ if(item.lng<=0) {
+ item.lng += 360
+ }
pnts.push([item.lng, item.lat]);
});
diff --git a/src/Tools/index.js b/src/Tools/index.js
index 0674a47..1156611 100644
--- a/src/Tools/index.js
+++ b/src/Tools/index.js
@@ -503,6 +503,9 @@ class Tools {
let points = positions.length;
let pnts = new Array();
positions.forEach((item) => {
+ if(item.lng<=0) {
+ item.lng += 360
+ }
pnts.push([item.lng, item.lat]);
});
//console.log("pnts6666",pnts);
From 08bdd515a9433ccd07addfa38608875c87a07e92 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 10:16:05 +0800
Subject: [PATCH 10/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=9B=86=E7=BB=93?=
=?UTF-8?q?=E5=9C=B0=E7=82=B9=E4=BD=8D=E7=BB=8F=E5=BA=A6=E8=B6=8A=E8=BF=87?=
=?UTF-8?q?180=C2=B0=E6=97=B6=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Draw/drawAssemble.js | 2 +-
src/Tools/index.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Draw/drawAssemble.js b/src/Draw/drawAssemble.js
index 6cc8605..6c7a9f8 100644
--- a/src/Draw/drawAssemble.js
+++ b/src/Draw/drawAssemble.js
@@ -124,7 +124,7 @@ class DrawAssemble extends Draw {
if (this.points_ids.length === 1) {
let pnts = new Array();
this.positions.forEach((item) => {
- if(item.lng<=0) {
+ if(item.lng<-90) {
item.lng += 360
}
pnts.push([item.lng, item.lat]);
diff --git a/src/Tools/index.js b/src/Tools/index.js
index 1156611..1e75b1c 100644
--- a/src/Tools/index.js
+++ b/src/Tools/index.js
@@ -503,7 +503,7 @@ class Tools {
let points = positions.length;
let pnts = new Array();
positions.forEach((item) => {
- if(item.lng<=0) {
+ if(item.lng<-90) {
item.lng += 360
}
pnts.push([item.lng, item.lat]);
From 7be9a6a41da6058d042c48f6c39fe7dc50c86169 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 16:18:27 +0800
Subject: [PATCH 11/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=8C=E4=B8=89?=
=?UTF-8?q?=E7=BB=B4=E6=A8=A1=E5=BC=8F=E4=B8=8BMouseCoordinate=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/MouseCoordinate/index.js | 83 +++++++++++++++++++++++++----
1 file changed, 72 insertions(+), 11 deletions(-)
diff --git a/src/Global/MouseCoordinate/index.js b/src/Global/MouseCoordinate/index.js
index 0189c67..147f96a 100644
--- a/src/Global/MouseCoordinate/index.js
+++ b/src/Global/MouseCoordinate/index.js
@@ -4,18 +4,38 @@
import Tools from "../../Tools";
import { getCoordinateSystem } from "../../Global/global";
import MouseEvent from '../../Event/index'
+import { getSdk as get2DSdk } from '../../Global/MultiViewportMode'
+import { getSdk as getSplitScreenSdk } from "../../Global/SplitScreen";
let event
+let event2
let MouseCoordinateElm
let requestAnimationFrameEventId
+let tmovement
+let targetSdk
+let sdkD
const MouseCoordinate = (sdk, status) => {
+ if (!sdk || !sdk.viewer) {
+ return
+ }
+ targetSdk = sdk
+ sdkD = get2DSdk().sdkD
+ if(!sdkD) {
+ sdkD = getSplitScreenSdk().sdkD
+ }
+
let tools = new Tools(sdk)
if (status) {
if (event) {
event.destroy()
}
+ if (event2) {
+ event2.destroy()
+ event2 = undefined
+ }
event = new MouseEvent(sdk)
+ tmovement = null
let position = {
x: '',
y: '',
@@ -40,22 +60,60 @@ const MouseCoordinate = (sdk, status) => {
contentElm.style['background-size'] = `200% 200%`;
MouseCoordinateElm = contentElm
}
- sdk.viewer._element.appendChild(contentElm)
- let tmovement
+ sdk.viewer.container.appendChild(contentElm)
+
event.mouse_move((movement, cartesian) => {
- tmovement = { ...movement }
+ targetSdk = sdk
+ tmovement = { ...movement.endPosition }
})
const getPosition = () => {
- if(!tmovement) {
+ if (!targetSdk) {
return
}
let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0]
- let left = tmovement.endPosition.x;
- let top = tmovement.endPosition.y;
- let cartesian = event.getcartesian(tmovement)
- contentElm.style['background-position-x'] = `${-canvas.width + left + 4}px`;
- contentElm.style['background-position-y'] = `${-canvas.height + top - 2}px`;
+ sdkD = get2DSdk().sdkD
+ if(!sdkD) {
+ sdkD = getSplitScreenSdk().sdkD
+ }
+ if (!event2 && sdkD) {
+ event2 = new MouseEvent(sdkD)
+ event2.mouse_move((movement, cartesian) => {
+ targetSdk = sdkD
+ tmovement = { x: movement.endPosition.x, y: movement.endPosition.y }
+ })
+ }
+ if (!tmovement) {
+ return
+ }
+ let left = tmovement.x;
+ let top = tmovement.y;
+ let cartesian
+ if (targetSdk.viewer.scene.mode === 2) {
+ left = left + canvas.width
+ cartesian = targetSdk.viewer.camera.pickEllipsoid(tmovement, targetSdk.viewer.scene.globe.ellipsoid)
+ }
+ else {
+ cartesian = targetSdk.viewer.scene.pickPosition(tmovement)
+ if (!cartesian) {
+ const ray = targetSdk.viewer.camera.getPickRay(position); //相交的射线
+ let pickedObjects = targetSdk.viewer.scene.drillPickFromRay(ray, 10);
+ let result = {}
+ for (let i = 0; i < pickedObjects.length; i++) {
+ if (pickedObjects[i].position) {
+ result = pickedObjects[i]
+ break
+ }
+ }
+ cartesian = result.position
+ if (!cartesian) {
+ cartesian = targetSdk.viewer.scene.globe.pick(ray, targetSdk.viewer.scene);
+ }
+ }
+ }
+ contentElm.style['background-position-x'] = `${-sdk.viewer.container.clientWidth + left + 4}px`;
+
+ contentElm.style['background-position-y'] = `${-sdk.viewer.container.clientHeight + top - 2}px`;
// this.entity.position = cartesian
if (cartesian) {
let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer)
@@ -97,10 +155,13 @@ const MouseCoordinate = (sdk, status) => {
else {
if (event) {
event.destroy()
- event = undefined
+ }
+ if (event2) {
+ event2.destroy()
+ event2 = undefined
}
if (MouseCoordinateElm) {
- sdk.viewer._element.removeChild(MouseCoordinateElm)
+ sdk.viewer.container.removeChild(MouseCoordinateElm)
MouseCoordinateElm = undefined
}
if (requestAnimationFrameEventId) {
From 6729b6080675bb2ba9e907def2d03c0a5e001e45 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 16:19:03 +0800
Subject: [PATCH 12/24] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B4=B4=E5=9C=B0svg?=
=?UTF-8?q?=E7=BC=96=E8=BE=91=E7=82=B9=E9=A2=9C=E8=89=B2=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/GroundSvg/index.js | 78 ++++++++++++++++++++++++++++++++-
1 file changed, 77 insertions(+), 1 deletion(-)
diff --git a/src/Obj/Base/GroundSvg/index.js b/src/Obj/Base/GroundSvg/index.js
index 198aa89..5a1e306 100644
--- a/src/Obj/Base/GroundSvg/index.js
+++ b/src/Obj/Base/GroundSvg/index.js
@@ -1279,6 +1279,9 @@ class GroundSvg extends Base {
// 中心点到鼠标的距离
let distance = turf.rhumbDistance(pointC, point2, options);
+ let flag = false
+ let flag2 = false
+
switch (this.pickPoint.id) {
case 'svg-control-points_0':
angle = bearing2_0 - bearing1
@@ -1290,12 +1293,39 @@ class GroundSvg extends Base {
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
angleW = bearing2 - bearingW
angleH = bearing2 - bearingH
-
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
+ flag=true
}
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
+ flag2=true
+ }
+ if(flag && flag2) {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ }
+ else {
+ if(flag) {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ }
+ else if(flag2) {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ }
+ else {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ }
}
radiansW = (Math.PI / 180) * angleW
@@ -1314,6 +1344,12 @@ class GroundSvg extends Base {
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
+ this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ }
+ else {
+ this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
radiansH = (Math.PI / 180) * angleH
@@ -1331,9 +1367,37 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
+ flag=true
}
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
+ flag2=true
+ }
+ if(flag && flag2) {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ }
+ else {
+ if(flag) {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ }
+ else if(flag2) {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ }
+ else {
+ this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ }
}
radiansW = (Math.PI / 180) * angleW
@@ -1351,6 +1415,12 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
+ this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ }
+ else {
+ this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
radiansW = (Math.PI / 180) * angleW
@@ -1381,6 +1451,12 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
+ this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
+ }
+ else {
+ this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
+ this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
radiansW = (Math.PI / 180) * angleW
From d1bcba6a1356863773b11dd151cb5dd7ea185425 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 16:29:18 +0800
Subject: [PATCH 13/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=98=E5=88=B6?=
=?UTF-8?q?=E7=AE=AD=E5=A4=B4=E9=9D=A2=E6=97=B6=E8=BF=9E=E7=BB=AD=E8=8E=B7?=
=?UTF-8?q?=E5=8F=96=E5=90=8C=E6=A0=B7=E7=9A=84=E5=9D=90=E6=A0=87=E6=97=B6?=
=?UTF-8?q?=E9=9D=A2=E5=9D=90=E6=A0=87=E8=AE=A1=E7=AE=97=E5=BC=82=E5=B8=B8?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Draw/drawAttackArrow.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/Draw/drawAttackArrow.js b/src/Draw/drawAttackArrow.js
index 0cd20a4..c9208e2 100644
--- a/src/Draw/drawAttackArrow.js
+++ b/src/Draw/drawAttackArrow.js
@@ -59,12 +59,17 @@ export default class DrawAttackArrow extends Draw {
return
}
into = '3D'
+ let pos84 = this.cartesian3Towgs84(cartesian, this.viewer)
+ let lastPos84 = cache_positions[cache_positions.length - 1]
+ if(lastPos84 && (lastPos84.lng === pos84.lng && lastPos84.lat === pos84.lat)) {
+ return
+ }
if (!this.entityHasCreated) {
let polyline_id = DrawAttackArrow.create_arrow_polygon(this)
this.points_ids.push(polyline_id)
}
this.points_ids.push(this.create_point(cartesian))
- cache_positions.push(this.cartesian3Towgs84(cartesian, this.viewer))
+ cache_positions.push(pos84)
isMove = false
})
this.event.mouse_right((movement, cartesian) => {
From 2e301cd0fcac672d27ff42968a69f88b6dc173da Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 16:48:36 +0800
Subject: [PATCH 14/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=98=E5=88=B6?=
=?UTF-8?q?=E7=AE=AD=E5=A4=B4=E9=9D=A2=E6=97=B6=E8=BF=9E=E7=BB=AD=E8=8E=B7?=
=?UTF-8?q?=E5=8F=96=E5=90=8C=E6=A0=B7=E7=9A=84=E5=9D=90=E6=A0=87=E6=97=B6?=
=?UTF-8?q?=E9=9D=A2=E5=9D=90=E6=A0=87=E8=AE=A1=E7=AE=97=E5=BC=82=E5=B8=B8?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/mouseRightMenu/index.js | 16 +++++++-------
src/Obj/Base/BillboardObject/index.js | 30 +++++++++++++--------------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/Global/mouseRightMenu/index.js b/src/Global/mouseRightMenu/index.js
index 891623f..818271b 100644
--- a/src/Global/mouseRightMenu/index.js
+++ b/src/Global/mouseRightMenu/index.js
@@ -100,14 +100,14 @@ function MouseRightMenu(sdk, status, callBack) {
that = sdk.entityMap.get(entityId)
}
- // if (that && that.picking) {
- // addedMenu = `
- //
- //
- // `
- // }
+ if (that && that.picking) {
+ addedMenu = `
+
+
+ `
+ }
let position = tools.cartesian3Towgs84(cartesian, sdk.viewer)
menuElm = document.createElement('div')
menuElm.id = 'custom-menu'
diff --git a/src/Obj/Base/BillboardObject/index.js b/src/Obj/Base/BillboardObject/index.js
index 3bd6bfc..efcbfe7 100644
--- a/src/Obj/Base/BillboardObject/index.js
+++ b/src/Obj/Base/BillboardObject/index.js
@@ -433,11 +433,11 @@ class BillboardObject extends Base {
value: '链接',
key: 'link'
},
- // {
- // name: 'IP摄像头',
- // value: 'IP摄像头',
- // key: 'camera'
- // },
+ {
+ name: 'IP摄像头',
+ value: 'IP摄像头',
+ key: 'camera'
+ },
// {
// name: 'ISC摄像头',
// value: 'ISC摄像头',
@@ -448,16 +448,16 @@ class BillboardObject extends Base {
// value: '传感器',
// key: 'sensor'
// },
- // {
- // name: '全景图',
- // value: '全景图',
- // key: 'vr'
- // },
- // {
- // name: '物资',
- // value: '物资',
- // key: 'goods'
- // }
+ {
+ name: '全景图',
+ value: '全景图',
+ key: 'vr'
+ },
+ {
+ name: '物资',
+ value: '物资',
+ key: 'goods'
+ }
]
}
From 04ccdc73ca63e99800705cbe4851bbde71d58b87 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 16:58:15 +0800
Subject: [PATCH 15/24] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=B9=B0=E7=9C=BC?=
=?UTF-8?q?=E5=9B=BE=E8=8C=83=E5=9B=B4=E6=98=BE=E7=A4=BA=E9=AB=98=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/MapX/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Global/MapX/index.js b/src/Global/MapX/index.js
index a96b34f..d16f0cd 100644
--- a/src/Global/MapX/index.js
+++ b/src/Global/MapX/index.js
@@ -124,7 +124,7 @@ function syncViewer() {
if (height > 9000000) {
height = 9000000
}
- if (height < 100000) {
+ if (height < 400000) {
this.entity.billboard.show = true
this.entity.rectangle.show = false
}
From 23420762ca074c6bd747f5e4aa3d339d142a135f Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 15 Aug 2025 17:18:17 +0800
Subject: [PATCH 16/24] =?UTF-8?q?=E5=9B=9E=E6=92=A4-=E8=A7=A3=E5=86=B3?=
=?UTF-8?q?=E9=9B=86=E7=BB=93=E5=9C=B0=E7=82=B9=E4=BD=8D=E7=BB=8F=E5=BA=A6?=
=?UTF-8?q?=E8=B6=8A=E8=BF=87180=C2=B0=E6=97=B6=E8=AE=A1=E7=AE=97=E9=94=99?=
=?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Draw/drawAssemble.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/Draw/drawAssemble.js b/src/Draw/drawAssemble.js
index 6c7a9f8..8f1a321 100644
--- a/src/Draw/drawAssemble.js
+++ b/src/Draw/drawAssemble.js
@@ -124,9 +124,6 @@ class DrawAssemble extends Draw {
if (this.points_ids.length === 1) {
let pnts = new Array();
this.positions.forEach((item) => {
- if(item.lng<-90) {
- item.lng += 360
- }
pnts.push([item.lng, item.lat]);
});
From a9594ccec27007dbfd856df09f16cc3253ff1b89 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Mon, 18 Aug 2025 13:42:26 +0800
Subject: [PATCH 17/24] =?UTF-8?q?=E5=9B=9E=E6=92=A4-=E8=A7=A3=E5=86=B3?=
=?UTF-8?q?=E9=9B=86=E7=BB=93=E5=9C=B0=E7=82=B9=E4=BD=8D=E7=BB=8F=E5=BA=A6?=
=?UTF-8?q?=E8=B6=8A=E8=BF=87180=C2=B0=E6=97=B6=E8=AE=A1=E7=AE=97=E9=94=99?=
=?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Tools/index.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/Tools/index.js b/src/Tools/index.js
index 1e75b1c..0674a47 100644
--- a/src/Tools/index.js
+++ b/src/Tools/index.js
@@ -503,9 +503,6 @@ class Tools {
let points = positions.length;
let pnts = new Array();
positions.forEach((item) => {
- if(item.lng<-90) {
- item.lng += 360
- }
pnts.push([item.lng, item.lat]);
});
//console.log("pnts6666",pnts);
From 1936a142b1ae308772a134a823466bad3f50fd15 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Tue, 19 Aug 2025 10:56:01 +0800
Subject: [PATCH 18/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3scale=E5=A4=AA=E5=B0=8F?=
=?UTF-8?q?=E6=97=B6flyto=E9=AB=98=E5=BA=A6=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/GroundSvg/index.js | 54 +++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/Obj/Base/GroundSvg/index.js b/src/Obj/Base/GroundSvg/index.js
index 5a1e306..3f1200c 100644
--- a/src/Obj/Base/GroundSvg/index.js
+++ b/src/Obj/Base/GroundSvg/index.js
@@ -10,6 +10,7 @@ import { FontLoader } from '../../../../static/3rdparty/three/jsm/loaders/FontLo
import { TextGeometry } from '../../../../static/3rdparty/three/jsm/geometries/TextGeometry.js';
import * as variable from '../../../../static/3rdparty/three/fonts/FZZongYi-M05S_regular.typeface.json'
import Base from "../index";
+import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
class GroundSvg extends Base {
@@ -2171,6 +2172,59 @@ class GroundSvg extends Base {
}
this._update()
}
+
+ async flyTo(options = {}) {
+ if (this._error) {
+ return
+ }
+ setActiveViewer(0)
+ closeRotateAround(this.sdk)
+ closeViewFollow(this.sdk)
+
+ if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
+ let orientation = {
+ heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0),
+ pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0),
+ roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0)
+ }
+
+ let lng = this.options.customView.relativePosition.lng
+ let lat = this.options.customView.relativePosition.lat
+ let alt = this.options.customView.relativePosition.alt
+ let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
+
+ let position = { ...this.options.position }
+ // 如果没有高度值,则获取紧贴高度计算
+ if (!position.hasOwnProperty('alt')) {
+ position.alt = await this.getClampToHeight(position)
+ }
+ lng = this.options.customView.relativePosition.lng + position.lng
+ lat = this.options.customView.relativePosition.lat + position.lat
+ alt = this.options.customView.relativePosition.alt + position.alt
+ destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
+ this.sdk.viewer.camera.flyTo({
+ destination: destination,
+ orientation: orientation
+ })
+ }
+ else {
+ let array = []
+ for (let i = 0; i < this.controlPoints.length; i++) {
+ let height = await this.getClampToHeight({lng: this.controlPoints[i][0], lat: this.controlPoints[i][1]})
+ let cartesian = Cesium.Cartesian3.fromDegrees(this.controlPoints[i][0], this.controlPoints[i][1], height)
+ array.push(cartesian.x, cartesian.y, cartesian.z)
+ }
+ let BoundingSphere = Cesium.BoundingSphere.fromVertices(array)
+
+ this.sdk.viewer.camera.flyToBoundingSphere(BoundingSphere, {
+ offset: options.orientation || {
+ heading: Cesium.Math.toRadians(0.0),
+ pitch: Cesium.Math.toRadians(-60.0),
+ roll: Cesium.Math.toRadians(0.0)
+ }
+ })
+ }
+ }
}
export default GroundSvg
\ No newline at end of file
From 9ecb3c72692356dd1e02095b6419c5b95a58b6dd Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Tue, 19 Aug 2025 10:56:10 +0800
Subject: [PATCH 19/24] =?UTF-8?q?=E9=99=90=E5=88=B6=E6=96=87=E5=AD=97?=
=?UTF-8?q?=E9=95=BF=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/GroundSvg/_element.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Obj/Base/GroundSvg/_element.js b/src/Obj/Base/GroundSvg/_element.js
index 1f16498..1766d91 100644
--- a/src/Obj/Base/GroundSvg/_element.js
+++ b/src/Obj/Base/GroundSvg/_element.js
@@ -54,7 +54,7 @@ function html(that) {
文字内容
-
+