增加底图的二三维单独显示

This commit is contained in:
zh
2025-08-13 10:07:15 +08:00
parent ebaa10a79b
commit 20ae03cc5e
3 changed files with 74 additions and 5 deletions

View File

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

View File

@ -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 {
@ -27,6 +29,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)
}

View File

@ -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,6 +126,12 @@ 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) {
@ -141,9 +149,31 @@ class Base extends Tools {
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")
}