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") }