This commit is contained in:
zh
2025-08-22 23:53:49 +08:00
parent 1d6b635f7a
commit 1a394336ff
23 changed files with 690 additions and 43 deletions

View File

@ -319,7 +319,7 @@ class AssembleObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -324,7 +324,7 @@ class AttackArrowObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show &&!this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -637,7 +637,7 @@ class Model extends BaseModel {
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label && (this.label.show = v)
}
else {

View File

@ -550,7 +550,7 @@ class Model2 extends BaseModel {
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -333,7 +333,7 @@ class CircleObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show && (!this.showView || this.showView == 3)) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -666,7 +666,7 @@ class CurvelineObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
setTimeout(() => {
this.label.position = [

View File

@ -347,7 +347,7 @@ class EllipseObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -1,7 +1,7 @@
import Dialog from '../../Element/Dialog';
import { html } from "./_element";
import EventBinding from '../../Element/Dialog/eventBinding';
import { syncData } from '../../../Global/MultiViewportMode'
import { syncData, getSdk } from '../../../Global/MultiViewportMode'
import LabelObject from '../LabelObject'
import DrawPoint from '../../../Draw/drawPoint.js'
import richText from '../../Element/richText'
@ -19,6 +19,7 @@ import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/S
class GroundSvg extends Base {
#_textPosPickDrawEvent = null
#_destroyed = false
/**
* @constructor
* @param sdk
@ -97,7 +98,7 @@ class GroundSvg extends Base {
}
this.options.offset = options.offset || { x: 0.5, y: 1 }
this.options.mode = this.options.mode ? 1 : 0
this.options.mode = this.options.mode || this.options.mode == undefined || this.options.mode == null ? 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
@ -1324,6 +1325,19 @@ class GroundSvg extends Base {
let _this = this
let heightMode
let font = getFontFamily(this.labelFontFamily) || 'Helvetica'
let { sdkP, sdkD } = getSdk()
let show = true
if (this.sdk === sdkP) {
if (this.showView == 2) {
show = false
}
}
else if (this.sdk === sdkD) {
if (this.showView == 3) {
show = false
}
}
if (this.entity) {
this.sdk.viewer.entities.remove(this.entity)
this.text && this.text.remove()
@ -1389,7 +1403,7 @@ class GroundSvg extends Base {
)
_this.entity = new Cesium.Entity({
show: _this.options.show,
show: show ? _this.options.show : false,
id: _this.options.id,
position: new Cesium.CallbackProperty(() => {
return Cesium.Cartesian3.fromDegrees(
@ -1454,6 +1468,7 @@ class GroundSvg extends Base {
}
else {
this.entity = new Cesium.EntityCollection()
this.entity.show = show ? this.options.show : false
let perPositionHeight = false
if (this.sdk.viewer._element.className === 'cesium-viewer 2d') {
perPositionHeight = true
@ -1462,7 +1477,6 @@ class GroundSvg extends Base {
for (let m = 0; m < this.hierarchys[i].length; m++) {
let entity = this.sdk.viewer.entities.add({
id: this.options.id + `-${i}_${m}`,
show: this.options.show,
polygon: {
hierarchy: new Cesium.CallbackProperty(() => {
let hierarchy = this.hierarchys[i][m]
@ -1838,15 +1852,44 @@ class GroundSvg extends Base {
}
})
labelOffsetXElm.addEventListener('input', (e) => {
this.labelOffset = {
x: Number(e.target.value),
y: this.labelOffset.y
let value = e.target.value
value = Number(value)
if (e.data != '-' || e.target.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.labelOffset = {
x: value,
y: this.labelOffset.y
}
}
})
labelOffsetYElm.addEventListener('input', (e) => {
this.labelOffset = {
x: this.labelOffset.x,
y: Number(e.target.value)
if (e.target.value || e.target.value === 0) {
let value = e.target.value
value = Number(value)
if (e.data != '-' || e.target.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.labelOffset = {
x: this.labelOffset.x,
y: Number(value)
}
}
}
})
@ -1890,8 +1933,6 @@ class GroundSvg extends Base {
}
}
this.attributeLink = this.options.attribute.link.content
let tagData = this.attributeSelect
let attributeElm = this._DialogObject._element.content.getElementsByClassName(
@ -2274,9 +2315,10 @@ class GroundSvg extends Base {
* 重置
*/
reset() {
if (!this.#loaded) {
if (!this.#loaded || this.#_destroyed) {
return
}
this.options = this.deepCopyObj(this.originalOptions)
this.position = this.originalOptions.position
this.name = this.originalOptions.name
@ -2303,7 +2345,7 @@ class GroundSvg extends Base {
* @param {boolean} status=false 状态
*/
drag(status, cd) {
if (!this.#loaded || !this.sdk || !this.sdk.viewer) {
if (!this.#loaded || !this.sdk || !this.sdk.viewer || !this.entity || !this.entity.values || this.entity.values.length == 0) {
return
}
let greenImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA+0lEQVR4AZSTPQ7CMAyFk0jAFYCRCbgEbHAKBqRyKCoYOAVs5RLAQseKKxQkwntWVCltJdzK+bO/59ZW6kztGX6mi/F7dhiV0ydWzxH2B8ZquIkSAN47bzNAW2vtBKtY2G8ZIyPOMFUJxuX8DF+C8c+SwAonCSSr9SvxaCawogHrQl2aNwOPLKHWoa5N5O5woNZ575cdNBFKrQsdjgLaA7XSRK2gjWMJeVtA40MJOUvgxdHwDQYlZO5r/akRUTqoda/e4wo+xehqKbXSxKJ/3xlvL+oMYEUDgSTAaorBbY1V8yVpYIGb+G9kVtTFi3Vkh4XAFPZHxsjAVdkPAAD//0PYov0AAAAGSURBVAMA5pZjby819WUAAAAASUVORK5CYII='
@ -3277,6 +3319,7 @@ class GroundSvg extends Base {
this.sdk.viewer.entities.remove(this.entity.values[i])
}
}
this.#_destroyed = true
if (this._DialogObject && !this._DialogObject.isDestroy) {
this._DialogObject.close()
this._DialogObject = null
@ -3467,7 +3510,7 @@ class GroundSvg extends Base {
128 * this.billboardScale * (0.5 - this.options.offset.x) + this.options.label.offset.x,
-billboardH * this.billboardScale -
this.options.label.fontSize / 2 -
5 + this.options.label.offset.y
5 + this.options.label.offset.y + ((1 - this.options.offset.y) * 128 * this.billboardScale)
)
this.entity.label.pixelOffset = lablePixelOffset
}

View File

@ -334,7 +334,7 @@ class PincerArrowObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -355,7 +355,7 @@ class PolygonObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
} else {
this.label.show = false

View File

@ -517,7 +517,7 @@ class PolyhedronObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -701,7 +701,7 @@ class PolylineObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
setTimeout(() => {
this.label.position = [

View File

@ -424,7 +424,7 @@ class RadarScanStereoscopic extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -344,7 +344,7 @@ class SectorObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -321,7 +321,7 @@ class StraightArrowObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -253,7 +253,7 @@ class WallRealStereoscopic extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -195,7 +195,7 @@ class WallStereoscopic extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && !this.showView || this.showView == 3) {
this.label.show = v
}
else {

View File

@ -9,6 +9,7 @@ import Tools from "../../Tools";
import { getHost, getToken } from "../../on";
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
import { regLeftClickCallback as regLeftClickCallback3, regRightClickCallback as regRightClickCallback3, regMoveCallback as regMoveCallback3 } from "../../Global/MultiViewportMode/ClickCallback";
import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen";
import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global'
@ -68,7 +69,7 @@ class Base extends Tools {
let sdk2D = get2DSdk().sdkD
if (!sdk2D) {
this.#_showView = v
if(this.entity) {
if (this.entity) {
this.entity._showView = v
}
return
@ -361,12 +362,17 @@ class Base extends Tools {
console.error('val:', val, '不是一个function')
} else {
let sdkD = getSdk().sdkD
let sdk2D = get2DSdk().sdkD
if (sdkD && this.sdk === sdkD) {
if (this.clickCallBack == null && this.options && this.options.id) {
regLeftClickCallback2(this.options.id, this.leftClickCB, this)
}
}
else {
else if (sdk2D && this.sdk === sdk2D) {
if (this.clickCallBack == null && this.options && this.options.id) {
regLeftClickCallback3(this.options.id, this.leftClickCB, this)
}
} else {
if (this.clickCallBack == null && this.options && this.options.id) {
regLeftClickCallback(this.options.id, this.leftClickCB, this)
}
@ -384,12 +390,17 @@ class Base extends Tools {
console.error('val:', val, '不是一个function')
} else {
let sdkD = getSdk().sdkD
let sdk2D = get2DSdk().sdkD
if (sdkD && this.sdk === sdkD) {
if (this.rightClickCallBack == null && this.entity && this.entity.id) {
regRightClickCallback2(this.entity.id, this.rightClickCB, this)
}
}
else {
else if (sdk2D && this.sdk === sdk2D) {
if (this.clickCallBack == null && this.options && this.options.id) {
regRightClickCallback3(this.options.id, this.leftClickCB, this)
}
} else {
if (this.rightClickCallBack == null && this.entity && this.entity.id) {
regRightClickCallback(this.entity.id, this.rightClickCB, this)
}
@ -407,12 +418,17 @@ class Base extends Tools {
console.error('val:', val, '不是一个function')
} else {
let sdkD = getSdk().sdkD
let sdk2D = get2DSdk().sdkD
if (sdkD && this.sdk === sdkD) {
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
regMoveCallback2(this.entity.id, this.mouseMoveCB, this)
}
}
else {
else if (sdk2D && this.sdk === sdk2D) {
if (this.clickCallBack == null && this.options && this.options.id) {
regMoveCallback3(this.options.id, this.leftClickCB, this)
}
} else {
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
regMoveCallback(this.entity.id, this.mouseMoveCB, this)
}