showView状态保存
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user