Compare commits

..

1 Commits

Author SHA1 Message Date
zh
90466a4799 提交 2025-10-23 18:01:47 +08:00
4 changed files with 17 additions and 7 deletions

View File

@ -166,5 +166,15 @@ function close(sdk) {
} }
sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject) sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject)
} }
function destroy(sdk) {
if (mapx.viewer) {
if (mapx.viewer.entities) {
mapx.viewer.entities.removeAll()
}
mapx.viewer.destroy && mapx.viewer.destroy()
}
mapx = {}
sdk.viewer.scene.preRender.removeEventListener(syncViewer, syncObject)
}
export { open, close } export { open, close, destroy }

View File

@ -83,11 +83,9 @@ class GeoJson extends Base {
async on() { async on() {
let url = "" let url = ""
if (this.options.host.endsWith("yjearth4.0")) this.options.host = this.options.host || getHost()
url = this.options.host + '/data/service/getFile' url = this.options.host + '/fileInfo/previewLocal'
else url += '?fileAbsolutePath=' + this.options.url
url = this.options.host + '/yjearth4.0/data/service/getFile'
url = url + '?path=' + encodeURIComponent(this.options.url)
let rsp = await fetch(url, { let rsp = await fetch(url, {
method: 'get', method: 'get',
headers: { headers: {

View File

@ -349,7 +349,7 @@ class Vector extends Base {
let url = '' let url = ''
that.options.host = that.options.host || getHost() that.options.host = that.options.host || getHost()
url = that.options.host + '/fileInfo/previewLocal' url = that.options.host + '/fileInfo/previewLocal'
url += '?path=' + that.options.path url += '?fileAbsolutePath=' + that.options.path
fetch(url, { fetch(url, {
method: 'get', method: 'get',
headers: { headers: {

View File

@ -27,6 +27,7 @@ import {
import { syncSplitData, setActiveId } from '../Global/SplitScreen' import { syncSplitData, setActiveId } from '../Global/SplitScreen'
import { apiQueryGoodsList } from '../Tools/getGoodsList' import { apiQueryGoodsList } from '../Tools/getGoodsList'
import YJColorPicker from "../Obj/Element/yj-color-picker"; import YJColorPicker from "../Obj/Element/yj-color-picker";
import { destroy as mapxDestroy } from "../Global/MapX";
// window.check = check // window.check = check
class YJEarth { class YJEarth {
@ -572,6 +573,7 @@ class YJEarth {
} }
if (this.viewer) { if (this.viewer) {
mapxDestroy(this)
if (this.viewer.entities) { if (this.viewer.entities) {
this.viewer.entities.removeAll() this.viewer.entities.removeAll()
} }