From 90466a479986ce364e9dc25d8dacebacb36b82e4 Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Thu, 23 Oct 2025 18:01:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Global/MapX/index.js | 12 +++++++++++- src/Obj/Base/GeoJson/index.js | 8 +++----- src/Obj/Base/Vector/index.js | 2 +- src/YJEarth/index.js | 2 ++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Global/MapX/index.js b/src/Global/MapX/index.js index d16f0cd..aab4ee6 100644 --- a/src/Global/MapX/index.js +++ b/src/Global/MapX/index.js @@ -166,5 +166,15 @@ function close(sdk) { } 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 } \ No newline at end of file +export { open, close, destroy } \ No newline at end of file diff --git a/src/Obj/Base/GeoJson/index.js b/src/Obj/Base/GeoJson/index.js index 02a0bbe..06e0f56 100644 --- a/src/Obj/Base/GeoJson/index.js +++ b/src/Obj/Base/GeoJson/index.js @@ -83,11 +83,9 @@ class GeoJson extends Base { async on() { let url = "" - if (this.options.host.endsWith("yjearth4.0")) - url = this.options.host + '/data/service/getFile' - else - url = this.options.host + '/yjearth4.0/data/service/getFile' - url = url + '?path=' + encodeURIComponent(this.options.url) + this.options.host = this.options.host || getHost() + url = this.options.host + '/fileInfo/previewLocal' + url += '?fileAbsolutePath=' + this.options.url let rsp = await fetch(url, { method: 'get', headers: { diff --git a/src/Obj/Base/Vector/index.js b/src/Obj/Base/Vector/index.js index 479c150..98d8425 100644 --- a/src/Obj/Base/Vector/index.js +++ b/src/Obj/Base/Vector/index.js @@ -349,7 +349,7 @@ class Vector extends Base { let url = '' that.options.host = that.options.host || getHost() url = that.options.host + '/fileInfo/previewLocal' - url += '?path=' + that.options.path + url += '?fileAbsolutePath=' + that.options.path fetch(url, { method: 'get', headers: { diff --git a/src/YJEarth/index.js b/src/YJEarth/index.js index 8428b43..814bbb4 100644 --- a/src/YJEarth/index.js +++ b/src/YJEarth/index.js @@ -27,6 +27,7 @@ import { import { syncSplitData, setActiveId } from '../Global/SplitScreen' import { apiQueryGoodsList } from '../Tools/getGoodsList' import YJColorPicker from "../Obj/Element/yj-color-picker"; +import { destroy as mapxDestroy } from "../Global/MapX"; // window.check = check class YJEarth { @@ -572,6 +573,7 @@ class YJEarth { } if (this.viewer) { + mapxDestroy(this) if (this.viewer.entities) { this.viewer.entities.removeAll() }