解决二三维快速切换贴地svg显隐报错的问题
This commit is contained in:
@ -108,12 +108,18 @@ class GroundSvg extends Base {
|
||||
this._isdrag = false
|
||||
this._EventBinding = new EventBinding()
|
||||
|
||||
if(this.sdk.entityMap.get(this.options.id)) {
|
||||
return
|
||||
}
|
||||
this.sdk.addIncetance(this.options.id, this)
|
||||
this.picking = true
|
||||
|
||||
|
||||
if (this.options.show) {
|
||||
setSplitDirection(0, this.options.id)
|
||||
}
|
||||
|
||||
this._entityArray = []
|
||||
|
||||
this.init()
|
||||
}
|
||||
@ -157,8 +163,6 @@ class GroundSvg extends Base {
|
||||
if (this.options.text && this.options.text.show && this.text) {
|
||||
this.text.show = v
|
||||
}
|
||||
syncData(this.sdk, this.options.id)
|
||||
syncSplitData(this.sdk, this.options.id)
|
||||
} else {
|
||||
console.error("参数必须为boolean")
|
||||
}
|
||||
@ -820,8 +824,13 @@ class GroundSvg extends Base {
|
||||
}
|
||||
for (let i = 0; i < this.hierarchys.length; i++) {
|
||||
for (let m = 0; m < this.hierarchys[i].length; m++) {
|
||||
let id = this.options.id + `-${i}_${m}}`
|
||||
let oldEntity = this.sdk.viewer.entities.getById(id)
|
||||
if(oldEntity) {
|
||||
this.sdk.viewer.entities.remove(oldEntity)
|
||||
}
|
||||
let entity = this.sdk.viewer.entities.add({
|
||||
id: this.options.id + `-${i}_${m}`,
|
||||
id: this.options.id + `-${i}_${m}}`,
|
||||
show: this.options.show,
|
||||
polygon: {
|
||||
hierarchy: new Cesium.CallbackProperty(() => {
|
||||
@ -854,6 +863,7 @@ class GroundSvg extends Base {
|
||||
color: this.geojson.features[i].properties.color
|
||||
}
|
||||
}
|
||||
this._entityArray.push(entity)
|
||||
this.entity.add(entity)
|
||||
}
|
||||
}
|
||||
@ -1991,6 +2001,8 @@ class GroundSvg extends Base {
|
||||
}
|
||||
|
||||
async remove() {
|
||||
this._worker.onmessage = (event) => {}
|
||||
await this.sdk.removeIncetance(this.options.id)
|
||||
if (!this.entity) {
|
||||
return
|
||||
}
|
||||
@ -2000,12 +2012,11 @@ class GroundSvg extends Base {
|
||||
for (let i = this.entity.values.length; i >= 0; i--) {
|
||||
this.sdk.viewer.entities.remove(this.entity.values[i])
|
||||
}
|
||||
this.entity = null
|
||||
if (this._DialogObject && !this._DialogObject.isDestroy) {
|
||||
this._DialogObject.close()
|
||||
this._DialogObject = null
|
||||
}
|
||||
await this.sdk.removeIncetance(this.options.id)
|
||||
|
||||
await syncData(this.sdk, this.options.id)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user