@soonspacejs/plugin-tiles 2.14.34 → 2.14.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,37 +1,38 @@
1
- import _ from "soonspacejs";
2
- import { TilesRenderer as u } from "um-3d-tiles-renderer";
3
- import { GLTFLoader as C } from "three/examples/jsm/loaders/GLTFLoader.js";
4
- import { MathUtils as c, MeshBasicMaterial as R, Color as v, Box3 as I, Sphere as x, MeshStandardMaterial as N, ShaderMaterial as P } from "three";
5
- import { TilesFadePlugin as O, UpdateOnChangePlugin as T, QuantizedMeshPlugin as M, ImageOverlayPlugin as E, XYZTilesOverlay as b, ReorientationPlugin as w, GeoJSONOverlay as k, CesiumIonOverlay as U, TMSTilesOverlay as F, UrlTemplateTilesOverlay as A, WMSTilesOverlay as G, WMTSCapabilitiesLoader as D, WMTSTilesOverlay as W, CesiumIonAuthPlugin as L } from "um-3d-tiles-renderer/plugins";
6
- class Q {
1
+ import ee from "soonspacejs";
2
+ import { TilesRenderer as R } from "um-3d-tiles-renderer";
3
+ import { GLTFLoader as pe } from "three/examples/jsm/loaders/GLTFLoader.js";
4
+ import { MathUtils as C, MeshBasicMaterial as Me, Color as z, Vector3 as _e, Box3 as Oe, Sphere as Te, MeshStandardMaterial as we, ShaderMaterial as ue } from "three";
5
+ import { TilesFadePlugin as te, UpdateOnChangePlugin as se, QuantizedMeshPlugin as q, ImageOverlayPlugin as me, XYZTilesOverlay as ye, ReorientationPlugin as re, GeoJSONOverlay as Pe, CesiumIonOverlay as Se, TMSTilesOverlay as Ce, UrlTemplateTilesOverlay as Le, WMSTilesOverlay as Ee, WMTSCapabilitiesLoader as Ie, WMTSTilesOverlay as be, CesiumIonAuthPlugin as fe } from "um-3d-tiles-renderer/plugins";
6
+ import { PlotOverlay as Re } from "um-3d-tiles-renderer/three/plugins";
7
+ class xe {
7
8
  constructor(e) {
8
9
  this.parser = e, this.name = "KHR_texture_basisu_patch";
9
10
  }
10
11
  loadTexture(e) {
11
- const t = this.parser, r = t.json, s = r.textures[e].source, l = r.images[s];
12
- if (!l || l.mimeType !== "image/ktx2")
12
+ const t = this.parser, s = t.json, a = s.textures[e].source, n = s.images[a];
13
+ if (!n || n.mimeType !== "image/ktx2")
13
14
  return null;
14
15
  const o = t.options.ktx2Loader;
15
16
  if (!o)
16
- throw new Error(`${_.utils.consoleSspTitle}请使用 setModelKtx2DecoderPath 设置 ktx2 解压库路径`);
17
- return t.loadTextureImage(e, s, o);
17
+ throw new Error(`${ee.utils.consoleSspTitle}请使用 setModelKtx2DecoderPath 设置 ktx2 解压库路径`);
18
+ return t.loadTextureImage(e, a, o);
18
19
  }
19
20
  }
20
- class se {
21
+ class gt {
21
22
  constructor(e) {
22
23
  this.ssp = e;
23
- const { controls: t, viewport: r } = e;
24
- this._tilesCamera = r.camera, t.addEventListener("transitionstart", () => {
25
- this.cameraTransitionStart = !0, r.state.useFreq = 1;
24
+ const { controls: t, viewport: s } = e;
25
+ this._tilesCamera = s.camera, t.addEventListener("transitionstart", () => {
26
+ this.cameraTransitionStart = !0, s.state.useFreq = 1;
26
27
  }), t.addEventListener("rest", () => {
27
- this.cameraTransitionStart = !1, this.needsUpdate = !0, r.state.useFreq = 60;
28
+ this.cameraTransitionStart = !1, this.needsUpdate = !0, s.state.useFreq = 60;
28
29
  }), e.signals.beforeRender.add(() => {
29
- this.needsUpdate && (this.needsUpdate = !1, e.viewport.camera.updateMatrixWorld(), this.tilesMap.forEach((i) => {
30
- i.group.updateMatrixWorld(), i.update();
30
+ this.needsUpdate && (this.needsUpdate = !1, e.viewport.camera.updateMatrixWorld(), this.tilesMap.forEach((r) => {
31
+ r.group.updateMatrixWorld(), r.update();
31
32
  }));
32
33
  }), e.signals.cameraObjectChange.add(() => {
33
- this.tilesMap.forEach((i) => {
34
- i.deleteCamera(this._tilesCamera), i.setCamera(e.viewport.camera), i.setResolutionFromRenderer(e.viewport.camera, e.viewport.renderer);
34
+ this.tilesMap.forEach((r) => {
35
+ r.deleteCamera(this._tilesCamera), r.setCamera(e.viewport.camera), r.setResolutionFromRenderer(e.viewport.camera, e.viewport.renderer);
35
36
  }), this._tilesCamera = e.viewport.camera;
36
37
  });
37
38
  }
@@ -44,21 +45,21 @@ class se {
44
45
  downloadQueue = null;
45
46
  async loadTiles(e) {
46
47
  if (this.tilesMap.has(e)) {
47
- _.utils.warn(`${e} already loaded`);
48
+ ee.utils.warn(`${e} already loaded`);
48
49
  return;
49
50
  }
50
- const { ssp: t, ssp: { viewport: r } } = this, i = new u(e);
51
- this.lruCache === null ? this.lruCache = i.lruCache : i.lruCache = this.lruCache, this.parseQueue === null ? this.parseQueue = i.parseQueue : i.parseQueue = this.parseQueue, this.downloadQueue === null ? this.downloadQueue = i.downloadQueue : i.downloadQueue = this.downloadQueue;
52
- const s = new C(i.manager);
53
- s.register((p) => new Q(p));
54
- const { dracoLoader: l, ktx2Loader: o, meshoptDecoder: d } = t.manager.store.modelManager.gltfLoader;
55
- l && s.setDRACOLoader(l), o && s.setKTX2Loader(o), d && s.setMeshoptDecoder(d), i.manager.addHandler(/\.gltf$/, s), this.tilesMap.set(e, i), i.setCamera(this._tilesCamera), i.setResolutionFromRenderer(this._tilesCamera, r.renderer), i.lruCache.maxSize = 600, i.lruCache.minSize = 300, i.lruCache.unloadPercent = 0.8, t.addObject(i.group);
56
- const S = () => {
51
+ const { ssp: t, ssp: { viewport: s } } = this, r = new R(e);
52
+ this.lruCache === null ? this.lruCache = r.lruCache : r.lruCache = this.lruCache, this.parseQueue === null ? this.parseQueue = r.parseQueue : r.parseQueue = this.parseQueue, this.downloadQueue === null ? this.downloadQueue = r.downloadQueue : r.downloadQueue = this.downloadQueue;
53
+ const a = new pe(r.manager);
54
+ a.register((d) => new xe(d));
55
+ const { dracoLoader: n, ktx2Loader: o, meshoptDecoder: h } = t.manager.store.modelManager.gltfLoader;
56
+ n && a.setDRACOLoader(n), o && a.setKTX2Loader(o), h && a.setMeshoptDecoder(h), r.manager.addHandler(/\.gltf$/, a), this.tilesMap.set(e, r), r.setCamera(this._tilesCamera), r.setResolutionFromRenderer(this._tilesCamera, s.renderer), r.lruCache.maxSize = 600, r.lruCache.minSize = 300, r.lruCache.unloadPercent = 0.8, t.addObject(r.group);
57
+ const u = () => {
57
58
  this.cameraTransitionStart || (this.needsUpdate = !0, t.render());
58
59
  };
59
- return i.addEventListener("load-model", S), new Promise((p) => {
60
- i.addEventListener("load-tile-set", () => {
61
- S(), p(i);
60
+ return r.addEventListener("load-model", u), new Promise((d) => {
61
+ r.addEventListener("load-tile-set", () => {
62
+ u(), d(r);
62
63
  });
63
64
  });
64
65
  }
@@ -67,31 +68,31 @@ class se {
67
68
  return t ? (t.dispose(), this.tilesMap.delete(e), this.ssp.removeObject(t.group), !0) : !1;
68
69
  }
69
70
  }
70
- let j = class {
71
+ let ke = class {
71
72
  priority = -999;
72
73
  processTileModel(e) {
73
74
  e.traverse((t) => {
74
- t.material && (t.material = new R());
75
+ t.material && (t.material = new Me());
75
76
  });
76
77
  }
77
78
  };
78
- const J = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/";
79
- class ne {
79
+ const De = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/";
80
+ class mt {
80
81
  constructor(e) {
81
- this.ssp = e, this.tiles = new u(J), this.tiles.fetchData = async (t, r) => {
82
+ this.ssp = e, this.tiles = new R(De), this.tiles.fetchData = async (t, s) => {
82
83
  if (/layer\.json$/.test(t)) {
83
- const i = await fetch(t, r).then((s) => s.json());
84
- return i.metadataAvailability = -1, new Response(JSON.stringify(i));
84
+ const r = await fetch(t, s).then((a) => a.json());
85
+ return r.metadataAvailability = -1, new Response(JSON.stringify(r));
85
86
  }
86
- return fetch(t, r);
87
- }, this.tilesFadePlugin = new O({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new T(), this.quantizedPlugin = new M({}), this.customMaterialPlugin = new j(), this.imageOverlayPlugin = new E({
87
+ return fetch(t, s);
88
+ }, this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), this.quantizedPlugin = new q({}), this.customMaterialPlugin = new ke(), this.imageOverlayPlugin = new me({
88
89
  renderer: e.viewport.renderer,
89
90
  overlays: [
90
- new b({
91
+ new ye({
91
92
  url: "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
92
93
  })
93
94
  ]
94
- }), this.reorientationPlugin = new w({
95
+ }), this.reorientationPlugin = new re({
95
96
  lon: 120,
96
97
  lat: 30,
97
98
  height: 0.1
@@ -120,18 +121,18 @@ class ne {
120
121
  disable() {
121
122
  this.ssp.removeObject(this.tiles.group), this.ssp.signals.beforeRender.remove(this.beforeRenderHandler);
122
123
  }
123
- invalidate(e, t, r) {
124
- const i = () => {
125
- const l = c.degToRad(t), o = c.degToRad(e);
124
+ invalidate(e, t, s) {
125
+ const r = () => {
126
+ const n = C.degToRad(t), o = C.degToRad(e);
126
127
  this.reorientationPlugin.transformLatLonHeightToOrigin(
127
- l,
128
+ n,
128
129
  o,
129
- r
130
- ), this.ssp.render(), s();
131
- }, s = () => {
132
- this.tiles.removeEventListener("load-root-tileset", i), this.loedTilesSets.delete(i);
130
+ s
131
+ ), this.ssp.render(), a();
132
+ }, a = () => {
133
+ this.tiles.removeEventListener("load-root-tileset", r), this.loedTilesSets.delete(r);
133
134
  };
134
- return this.tiles.addEventListener("load-root-tileset", i), this.loedTilesSets.add(i), this.tiles.root && i(), s;
135
+ return this.tiles.addEventListener("load-root-tileset", r), this.loedTilesSets.add(r), this.tiles.root && r(), a;
135
136
  }
136
137
  dispose() {
137
138
  this.disable(), this.loedTilesSets.forEach(
@@ -139,7 +140,7 @@ class ne {
139
140
  ), this.loedTilesSets.clear(), this.tiles.removeEventListener("needs-render", this.render), this.tiles.removeEventListener("needs-update", this.render), this.tiles.dispose();
140
141
  }
141
142
  }
142
- class H {
143
+ class Ne {
143
144
  // 使用较低的 priority 确保在 ImageOverlayPlugin 之后执行
144
145
  // ImageOverlayPlugin 默认 priority 是 -1
145
146
  priority = -10;
@@ -159,8 +160,8 @@ class H {
159
160
  */
160
161
  updateAllLoadedModels(e) {
161
162
  e.forEachLoadedModel((t) => {
162
- t.traverse((r) => {
163
- r.material && this._applyToMaterial(r.material);
163
+ t.traverse((s) => {
164
+ s.material && this._applyToMaterial(s.material);
164
165
  });
165
166
  });
166
167
  }
@@ -182,8 +183,8 @@ class H {
182
183
  e.needsUpdate = !0;
183
184
  }
184
185
  }
185
- var a = /* @__PURE__ */ ((n) => (n.GEOJSON = "geojson", n.CESIUM_ION = "cesiumIon", n.TMS = "tms", n.XYZ = "xyz", n.WMS = "wms", n.WMTS = "wmts", n.URL_TEMPLATE = "urlTemplate", n))(a || {}), g = /* @__PURE__ */ ((n) => (n.QUANTIZED_MESH = "quantizedMesh", n.CESIUM_ION = "cesiumIon", n))(g || {});
186
- class B {
186
+ var l = /* @__PURE__ */ ((i) => (i.GEOJSON = "geojson", i.CESIUM_ION = "cesiumIon", i.TMS = "tms", i.XYZ = "xyz", i.WMS = "wms", i.WMTS = "wmts", i.URL_TEMPLATE = "urlTemplate", i.PLOT = "plot", i))(l || {}), U = /* @__PURE__ */ ((i) => (i.QUANTIZED_MESH = "quantizedMesh", i.CESIUM_ION = "cesiumIon", i))(U || {});
187
+ class Ae {
187
188
  constructor(e, t) {
188
189
  this.imageOverlayPlugin = e, this.resourceManager = t;
189
190
  }
@@ -202,54 +203,54 @@ class B {
202
203
  strokeStyle: e.strokeStyle,
203
204
  strokeWidth: e.strokeWidth
204
205
  };
205
- e.color && (t.color = new v(e.color));
206
- const r = new k(t);
207
- return this.imageOverlayPlugin.addOverlay(r, e.order), this._instances.set(e.id, {
206
+ e.color && (t.color = new z(e.color));
207
+ const s = new Pe(t);
208
+ return this.imageOverlayPlugin.addOverlay(s, e.order), this._instances.set(e.id, {
208
209
  id: e.id,
209
- type: a.GEOJSON,
210
- instance: r
210
+ type: l.GEOJSON,
211
+ instance: s
211
212
  }), this.resourceManager?.addOverlay({
212
213
  id: e.id,
213
- type: a.GEOJSON,
214
+ type: l.GEOJSON,
214
215
  options: e
215
- }), r;
216
+ }), s;
216
217
  }
217
218
  updateGeoJSONColor(e, t) {
218
- const r = this._instances.get(e);
219
- if (!r || r.type !== a.GEOJSON) return !1;
220
- const i = r.instance;
221
- return i.color.set(t), i.redraw(), this.resourceManager?.updateOverlay(e, { color: t }), !0;
219
+ const s = this._instances.get(e);
220
+ if (!s || s.type !== l.GEOJSON) return !1;
221
+ const r = s.instance;
222
+ return r.color.set(t), r.redraw(), this.resourceManager?.updateOverlay(e, { color: t }), !0;
222
223
  }
223
224
  updateGeoJSONStrokeStyle(e, t) {
224
- const r = this._instances.get(e);
225
- if (!r || r.type !== a.GEOJSON) return !1;
226
- const i = r.instance;
227
- return i.strokeStyle = t, i.redraw(), this.resourceManager?.updateOverlay(e, { strokeStyle: t }), !0;
225
+ const s = this._instances.get(e);
226
+ if (!s || s.type !== l.GEOJSON) return !1;
227
+ const r = s.instance;
228
+ return r.strokeStyle = t, r.redraw(), this.resourceManager?.updateOverlay(e, { strokeStyle: t }), !0;
228
229
  }
229
230
  updateGeoJSONStrokeWidth(e, t) {
230
- const r = this._instances.get(e);
231
- if (!r || r.type !== a.GEOJSON) return !1;
232
- const i = r.instance;
233
- return i.strokeWidth = t, i.redraw(), this.resourceManager?.updateOverlay(e, { strokeWidth: t }), !0;
231
+ const s = this._instances.get(e);
232
+ if (!s || s.type !== l.GEOJSON) return !1;
233
+ const r = s.instance;
234
+ return r.strokeWidth = t, r.redraw(), this.resourceManager?.updateOverlay(e, { strokeWidth: t }), !0;
234
235
  }
235
236
  updateGeoJSONFillStyle(e, t) {
236
- const r = this._instances.get(e);
237
- if (!r || r.type !== a.GEOJSON) return !1;
238
- const i = r.instance;
239
- return i.fillStyle = t, i.redraw(), this.resourceManager?.updateOverlay(e, { fillStyle: t }), !0;
237
+ const s = this._instances.get(e);
238
+ if (!s || s.type !== l.GEOJSON) return !1;
239
+ const r = s.instance;
240
+ return r.fillStyle = t, r.redraw(), this.resourceManager?.updateOverlay(e, { fillStyle: t }), !0;
240
241
  }
241
242
  updateGeoJSONMode(e, t) {
242
- const r = this._instances.get(e);
243
- if (!r || r.type !== a.GEOJSON) return !1;
244
- const i = r.instance;
245
- return i.alphaInvert = !1, i.alphaMask = !1, i.fillStyle = "rgba( 255, 255, 255, 0.5 )", t === "mask" ? (i.alphaMask = !0, i.fillStyle = "white") : t === "invertMask" && (i.alphaInvert = !0, i.alphaMask = !0, i.fillStyle = "white"), i.redraw(), !0;
243
+ const s = this._instances.get(e);
244
+ if (!s || s.type !== l.GEOJSON) return !1;
245
+ const r = s.instance;
246
+ return r.alphaInvert = !1, r.alphaMask = !1, r.fillStyle = "rgba( 255, 255, 255, 0.5 )", t === "mask" ? (r.alphaMask = !0, r.fillStyle = "white") : t === "invertMask" && (r.alphaInvert = !0, r.alphaMask = !0, r.fillStyle = "white"), r.redraw(), !0;
246
247
  }
247
248
  // =============== Cesium Ion ===============
248
249
  addCesiumIon(e) {
249
250
  if (!this.imageOverlayPlugin) return null;
250
251
  if (this._instances.has(e.id))
251
252
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
252
- const t = new U({
253
+ const t = new Se({
253
254
  assetId: e.assetId,
254
255
  apiToken: e.apiToken,
255
256
  autoRefreshToken: e.autoRefreshToken ?? !0,
@@ -258,11 +259,11 @@ class B {
258
259
  });
259
260
  return this.imageOverlayPlugin.addOverlay(t, e.order), this._instances.set(e.id, {
260
261
  id: e.id,
261
- type: a.CESIUM_ION,
262
+ type: l.CESIUM_ION,
262
263
  instance: t
263
264
  }), this.resourceManager?.addOverlay({
264
265
  id: e.id,
265
- type: a.CESIUM_ION,
266
+ type: l.CESIUM_ION,
266
267
  options: e
267
268
  }), t;
268
269
  }
@@ -271,18 +272,18 @@ class B {
271
272
  if (!this.imageOverlayPlugin) return null;
272
273
  if (this._instances.has(e.id))
273
274
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
274
- const t = new F({
275
+ const t = new Ce({
275
276
  url: e.url,
276
277
  color: typeof e.color == "number" ? e.color : 16777215,
277
278
  opacity: e.opacity ?? 1
278
279
  });
279
280
  return this.imageOverlayPlugin.addOverlay(t, e.order), this._instances.set(e.id, {
280
281
  id: e.id,
281
- type: a.TMS,
282
+ type: l.TMS,
282
283
  instance: t
283
284
  }), this.resourceManager?.addOverlay({
284
285
  id: e.id,
285
- type: a.TMS,
286
+ type: l.TMS,
286
287
  options: e
287
288
  }), t;
288
289
  }
@@ -291,18 +292,18 @@ class B {
291
292
  if (!this.imageOverlayPlugin) return null;
292
293
  if (this._instances.has(e.id))
293
294
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
294
- const t = new b({
295
+ const t = new ye({
295
296
  url: e.url,
296
297
  color: typeof e.color == "number" ? e.color : 16777215,
297
298
  opacity: e.opacity ?? 1
298
299
  });
299
300
  return this.imageOverlayPlugin.addOverlay(t, e.order), this._instances.set(e.id, {
300
301
  id: e.id,
301
- type: a.XYZ,
302
+ type: l.XYZ,
302
303
  instance: t
303
304
  }), this.resourceManager?.addOverlay({
304
305
  id: e.id,
305
- type: a.XYZ,
306
+ type: l.XYZ,
306
307
  options: e
307
308
  }), t;
308
309
  }
@@ -342,7 +343,7 @@ class B {
342
343
  if (!this.imageOverlayPlugin) return null;
343
344
  if (this._instances.has(e.id))
344
345
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
345
- const t = new A({
346
+ const t = new Le({
346
347
  url: e.url,
347
348
  subdomains: e.subdomains,
348
349
  levels: e.levels,
@@ -355,11 +356,11 @@ class B {
355
356
  });
356
357
  return this.imageOverlayPlugin.addOverlay(t, e.order), this._instances.set(e.id, {
357
358
  id: e.id,
358
- type: a.URL_TEMPLATE,
359
+ type: l.URL_TEMPLATE,
359
360
  instance: t
360
361
  }), this.resourceManager?.addOverlay({
361
362
  id: e.id,
362
- type: a.URL_TEMPLATE,
363
+ type: l.URL_TEMPLATE,
363
364
  options: e
364
365
  }), t;
365
366
  }
@@ -374,55 +375,55 @@ class B {
374
375
  crs: e.crs || "EPSG:4326",
375
376
  format: e.format || "image/png",
376
377
  tileDimension: e.tileDimension || 256
377
- }, r = new G({
378
+ }, s = new Ee({
378
379
  url: e.url,
379
380
  layer: t.layer,
380
381
  crs: t.crs,
381
382
  format: t.format,
382
383
  tileDimension: t.tileDimension,
383
384
  styles: t.styles,
384
- color: new v(typeof e.color == "number" ? e.color : 16777215),
385
+ color: new z(typeof e.color == "number" ? e.color : 16777215),
385
386
  opacity: e.opacity ?? 1
386
387
  });
387
- return this.imageOverlayPlugin.addOverlay(r, e.order), this._instances.set(e.id, {
388
+ return this.imageOverlayPlugin.addOverlay(s, e.order), this._instances.set(e.id, {
388
389
  id: e.id,
389
- type: a.WMS,
390
- instance: r
390
+ type: l.WMS,
391
+ instance: s
391
392
  }), this.resourceManager?.addOverlay({
392
393
  id: e.id,
393
- type: a.WMS,
394
+ type: l.WMS,
394
395
  options: e
395
- }), r;
396
+ }), s;
396
397
  }
397
398
  // =============== WMTS ===============
398
399
  async addWMTS(e) {
399
400
  if (!this.imageOverlayPlugin) return null;
400
401
  if (this._instances.has(e.id))
401
402
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
402
- const t = await new D().loadAsync(e.url), r = ["EPSG:4326", "EPSG:3857"];
403
- let i = e.layer || "";
404
- t.layers.find((l) => l.identifier === i) || (i = t.layers.find(
405
- (l) => l?.tileMatrixSets?.some((o) => r.includes(o.supportedCRS))
403
+ const t = await new Ie().loadAsync(e.url), s = ["EPSG:4326", "EPSG:3857"];
404
+ let r = e.layer || "";
405
+ t.layers.find((n) => n.identifier === r) || (r = t.layers.find(
406
+ (n) => n?.tileMatrixSets?.some((o) => s.includes(o.supportedCRS))
406
407
  )?.identifier || t.layers[0].identifier);
407
- const s = new W({
408
+ const a = new be({
408
409
  capabilities: t,
409
- layer: i,
410
+ layer: r,
410
411
  dimensions: e.dimensions || null,
411
412
  style: e.style || void 0,
412
413
  tileMatrixSet: e.tileMatrixSet || null,
413
414
  planar: !1,
414
- color: new v(typeof e.color == "number" ? e.color : 16777215),
415
+ color: new z(typeof e.color == "number" ? e.color : 16777215),
415
416
  opacity: e.opacity ?? 1
416
417
  });
417
- return this.imageOverlayPlugin.addOverlay(s, e.order), this._instances.set(e.id, {
418
+ return this.imageOverlayPlugin.addOverlay(a, e.order), this._instances.set(e.id, {
418
419
  id: e.id,
419
- type: a.WMTS,
420
- instance: s
420
+ type: l.WMTS,
421
+ instance: a
421
422
  }), this.resourceManager?.addOverlay({
422
423
  id: e.id,
423
- type: a.WMTS,
424
+ type: l.WMTS,
424
425
  options: e
425
- }), s;
426
+ }), a;
426
427
  }
427
428
  // =============== 通用方法 ===============
428
429
  /**
@@ -431,12 +432,12 @@ class B {
431
432
  remove(e) {
432
433
  const t = this._instances.get(e);
433
434
  return t ? [
434
- a.XYZ,
435
- a.TMS,
436
- a.WMS,
437
- a.WMTS,
438
- a.CESIUM_ION,
439
- a.URL_TEMPLATE
435
+ l.XYZ,
436
+ l.TMS,
437
+ l.WMS,
438
+ l.WMTS,
439
+ l.CESIUM_ION,
440
+ l.URL_TEMPLATE
440
441
  ].includes(t.type) && (this.resourceManager?.getImageryOverlayCount() ?? this._getLocalImageryCount()) <= 1 ? (console.warn("OverlayManager: Cannot remove overlay - at least one imagery overlay must remain"), !1) : (this.imageOverlayPlugin?.deleteOverlay(t.instance), this._instances.delete(e), this.resourceManager?.removeOverlay(e), !0) : (console.warn(`OverlayManager: Overlay "${e}" not found`), !1);
441
442
  }
442
443
  /**
@@ -455,23 +456,23 @@ class B {
455
456
  * 设置 overlay 可见性
456
457
  */
457
458
  setVisible(e, t) {
458
- const r = this._instances.get(e);
459
- return r && "opacity" in r.instance ? (r.instance.opacity = t ? 1 : 0, this.resourceManager?.updateOverlay(e, { opacity: t ? 1 : 0 }), !0) : !1;
459
+ const s = this._instances.get(e);
460
+ return s && "opacity" in s.instance ? (s.instance.opacity = t ? 1 : 0, this.resourceManager?.updateOverlay(e, { opacity: t ? 1 : 0 }), !0) : !1;
460
461
  }
461
462
  /**
462
463
  * 设置 overlay 透明度
463
464
  */
464
465
  setOpacity(e, t) {
465
- const r = this._instances.get(e);
466
- return r && "opacity" in r.instance ? (r.instance.opacity = t, this.resourceManager?.updateOverlay(e, { opacity: t }), r.instance.redraw?.(), !0) : !1;
466
+ const s = this._instances.get(e);
467
+ return s && "opacity" in s.instance ? (s.instance.opacity = t, this.resourceManager?.updateOverlay(e, { opacity: t }), s.instance.redraw?.(), !0) : !1;
467
468
  }
468
469
  /**
469
470
  * 设置 overlay 层级
470
471
  */
471
472
  setOrder(e, t) {
472
473
  if (!this.imageOverlayPlugin) return !1;
473
- const r = this._instances.get(e);
474
- return r ? (this.imageOverlayPlugin.setOverlayOrder(r.instance, t), this.resourceManager?.updateOverlay(e, { order: t }), !0) : !1;
474
+ const s = this._instances.get(e);
475
+ return s ? (this.imageOverlayPlugin.setOverlayOrder(s.instance, t), this.resourceManager?.updateOverlay(e, { order: t }), !0) : !1;
475
476
  }
476
477
  /**
477
478
  * 获取 overlay 层级
@@ -488,11 +489,11 @@ class B {
488
489
  if (!this.imageOverlayPlugin) return !1;
489
490
  const t = this._instances.get(e);
490
491
  if (!t) return !1;
491
- const r = this.imageOverlayPlugin.overlayInfo;
492
- let i = 0;
493
- return r.forEach((s) => {
494
- s.order > i && (i = s.order);
495
- }), this.imageOverlayPlugin.setOverlayOrder(t.instance, i + 1), this.resourceManager?.updateOverlay(e, { order: i + 1 }), !0;
492
+ const s = this.imageOverlayPlugin.overlayInfo;
493
+ let r = 0;
494
+ return s.forEach((a) => {
495
+ a.order > r && (r = a.order);
496
+ }), this.imageOverlayPlugin.setOverlayOrder(t.instance, r + 1), this.resourceManager?.updateOverlay(e, { order: r + 1 }), !0;
496
497
  }
497
498
  /**
498
499
  * 将 overlay 移到最底层
@@ -501,11 +502,11 @@ class B {
501
502
  if (!this.imageOverlayPlugin) return !1;
502
503
  const t = this._instances.get(e);
503
504
  if (!t) return !1;
504
- const r = this.imageOverlayPlugin.overlayInfo;
505
- let i = 1 / 0;
506
- return r.forEach((s) => {
507
- s.order < i && (i = s.order);
508
- }), this.imageOverlayPlugin.setOverlayOrder(t.instance, i - 1), this.resourceManager?.updateOverlay(e, { order: i - 1 }), !0;
505
+ const s = this.imageOverlayPlugin.overlayInfo;
506
+ let r = 1 / 0;
507
+ return s.forEach((a) => {
508
+ a.order < r && (r = a.order);
509
+ }), this.imageOverlayPlugin.setOverlayOrder(t.instance, r - 1), this.resourceManager?.updateOverlay(e, { order: r - 1 }), !0;
509
510
  }
510
511
  // =============== 资源恢复 ===============
511
512
  /**
@@ -523,25 +524,25 @@ class B {
523
524
  _createOverlayFromResource(e) {
524
525
  const t = this.resourceManager;
525
526
  switch (this.resourceManager = void 0, e.type) {
526
- case a.GEOJSON:
527
+ case l.GEOJSON:
527
528
  this.addGeoJSON(e.options);
528
529
  break;
529
- case a.CESIUM_ION:
530
+ case l.CESIUM_ION:
530
531
  this.addCesiumIon(e.options);
531
532
  break;
532
- case a.TMS:
533
+ case l.TMS:
533
534
  this.addTMS(e.options);
534
535
  break;
535
- case a.XYZ:
536
+ case l.XYZ:
536
537
  this.addXYZ(e.options);
537
538
  break;
538
- case a.WMS:
539
+ case l.WMS:
539
540
  this.addWMS(e.options);
540
541
  break;
541
- case a.WMTS:
542
+ case l.WMTS:
542
543
  this.addWMTS(e.options);
543
544
  break;
544
- case a.URL_TEMPLATE:
545
+ case l.URL_TEMPLATE:
545
546
  this.addUrlTemplate(e.options);
546
547
  break;
547
548
  }
@@ -566,14 +567,14 @@ class B {
566
567
  _getLocalImageryCount() {
567
568
  let e = 0;
568
569
  return this._instances.forEach((t) => {
569
- [a.XYZ, a.TMS, a.WMS, a.WMTS, a.CESIUM_ION, a.URL_TEMPLATE].includes(t.type) && e++;
570
+ [l.XYZ, l.TMS, l.WMS, l.WMTS, l.CESIUM_ION, l.URL_TEMPLATE].includes(t.type) && e++;
570
571
  }), e;
571
572
  }
572
573
  /**
573
574
  * 只清理实例(保留 ResourceManager 中的配置)
574
575
  */
575
576
  disposeInstances() {
576
- this._instances.forEach((e) => {
577
+ console.log("disposeInstances"), console.log(this._instances), this._instances.forEach((e) => {
577
578
  this.imageOverlayPlugin?.deleteOverlay(e.instance);
578
579
  }), this._instances.clear();
579
580
  }
@@ -584,7 +585,7 @@ class B {
584
585
  this.disposeInstances(), this.resourceManager?.clear();
585
586
  }
586
587
  }
587
- class z {
588
+ class Fe {
588
589
  /** Overlay 资源配置 */
589
590
  _overlays = /* @__PURE__ */ new Map();
590
591
  // =============== Overlay 资源管理 ===============
@@ -642,15 +643,15 @@ class z {
642
643
  getImageryOverlayCount() {
643
644
  let e = 0;
644
645
  return this._overlays.forEach((t) => {
645
- (t.type === a.XYZ || t.type === a.TMS || t.type === a.WMS || t.type === a.WMTS || t.type === a.CESIUM_ION || t.type === a.URL_TEMPLATE) && e++;
646
+ (t.type === l.XYZ || t.type === l.TMS || t.type === l.WMS || t.type === l.WMTS || t.type === l.CESIUM_ION || t.type === l.URL_TEMPLATE) && e++;
646
647
  }), e;
647
648
  }
648
649
  /**
649
650
  * 更新 Overlay 配置
650
651
  */
651
652
  updateOverlay(e, t) {
652
- const r = this._overlays.get(e);
653
- return r ? (r.options = { ...r.options, ...t }, !0) : !1;
653
+ const s = this._overlays.get(e);
654
+ return s ? (s.options = { ...s.options, ...t }, !0) : !1;
654
655
  }
655
656
  // =============== 工具方法 ===============
656
657
  /**
@@ -674,7 +675,7 @@ class z {
674
675
  e.overlays && (this._overlays.clear(), e.overlays.forEach((t) => this._overlays.set(t.id, { ...t })));
675
676
  }
676
677
  }
677
- class $ {
678
+ class Ge {
678
679
  /** 地形配置映射表 */
679
680
  _terrains = /* @__PURE__ */ new Map();
680
681
  /** 当前激活的地形 ID */
@@ -763,24 +764,570 @@ class $ {
763
764
  this.clear();
764
765
  }
765
766
  }
766
- const Z = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/", X = "https://c.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
767
- class le {
767
+ let Ue = 1;
768
+ class S {
769
+ id;
770
+ category = "";
771
+ options;
772
+ constructor(e) {
773
+ this.id = String(Ue++), this.category = "", this.options = { ...e }, this.options.points && (this.options.points = this.options.points.map((t) => [t[0], t[1]]));
774
+ }
775
+ /**
776
+ * 合并更新 `options`(不可变风格:整表替换为新对象)。
777
+ * 子类应覆盖为 `Partial<具体Options>`,以便类型提示包含各类型专有字段。
778
+ */
779
+ update(e) {
780
+ this.options = { ...this.options, ...e };
781
+ }
782
+ /**
783
+ * 浅拷贝快照:`options` 为一层展开新对象,`points` 与内部仍为同一数组引用。
784
+ * {@link GroundDecalManager.getItem} 默认使用此方法。
785
+ */
786
+ getSnapshot() {
787
+ return { type: this.category, options: { ...this.options } };
788
+ }
789
+ /**
790
+ * 深拷贝快照:`points` 中每个顶点为新数组,修改返回值不会影响标绘内部状态。
791
+ * 需独立副本时请用 {@link GroundDecalManager.getItemDeep} 或本方法。
792
+ */
793
+ getSnapshotDeep() {
794
+ const e = { ...this.options };
795
+ return e.points && (e.points = e.points.map((t) => [...t])), { type: this.category, options: e };
796
+ }
797
+ /** 用于计算 ENU 参考中心的坐标点 */
798
+ getCenterPoints() {
799
+ return this.options.points || [];
800
+ }
801
+ /** 用于计算最大空间范围的坐标点(子类可覆盖以扩展半径等) */
802
+ getExtentPoints() {
803
+ return this.options.points || [];
804
+ }
805
+ }
806
+ class We extends S {
807
+ category = "point";
808
+ constructor(e) {
809
+ super(e);
810
+ }
811
+ update(e) {
812
+ this.options = { ...this.options, ...e };
813
+ }
814
+ getCenterPoints() {
815
+ const e = this.options.points;
816
+ return e && e.length > 0 ? [e[0]] : [];
817
+ }
818
+ getExtentPoints() {
819
+ return this.getCenterPoints();
820
+ }
821
+ }
822
+ class Qe extends S {
823
+ category = "line";
824
+ constructor(e) {
825
+ super(e);
826
+ }
827
+ update(e) {
828
+ this.options = { ...this.options, ...e };
829
+ }
830
+ }
831
+ class je extends S {
832
+ category = "polygon";
833
+ constructor(e) {
834
+ super(e);
835
+ }
836
+ update(e) {
837
+ this.options = { ...this.options, ...e };
838
+ }
839
+ }
840
+ const ie = C.DEG2RAD;
841
+ new _e();
842
+ class He extends S {
843
+ category = "rectangle";
844
+ constructor(e) {
845
+ super(e);
846
+ }
847
+ update(e) {
848
+ this.options = { ...this.options, ...e };
849
+ }
850
+ getExtentPoints() {
851
+ const e = this.options.points;
852
+ if (!e || e.length === 0) return [];
853
+ const t = e[0][0], s = e[0][1], r = (this.options.width || 0) / 2, a = (this.options.height || 0) / 2, n = r / (111320 * Math.cos(s * ie)), o = a / 111320;
854
+ return [
855
+ [t, s],
856
+ [t - n, s - o],
857
+ [t + n, s + o]
858
+ ];
859
+ }
860
+ }
861
+ class Be extends S {
862
+ category = "sector";
863
+ constructor(e) {
864
+ super(e);
865
+ }
866
+ update(e) {
867
+ this.options = { ...this.options, ...e };
868
+ }
869
+ getExtentPoints() {
870
+ const e = this.options.points;
871
+ if (!e || e.length === 0) return [];
872
+ const t = e[0][0], s = e[0][1], r = this.options.radius || 0, a = r / (111320 * Math.cos(s * ie)), n = r / 111320;
873
+ return [
874
+ [t - a, s - n],
875
+ [t + a, s + n]
876
+ ];
877
+ }
878
+ }
879
+ const ce = 100, ae = 1e-4;
880
+ function T(i, e) {
881
+ return Math.sqrt((i[0] - e[0]) ** 2 + (i[1] - e[1]) ** 2);
882
+ }
883
+ function ne(i) {
884
+ let e = 0;
885
+ for (let t = 0; t < i.length - 1; t++)
886
+ e += T(i[t], i[t + 1]);
887
+ return e;
888
+ }
889
+ function Q(i) {
890
+ return ne(i) ** 0.99;
891
+ }
892
+ function oe(i, e) {
893
+ return [(i[0] + e[0]) / 2, (i[1] + e[1]) / 2];
894
+ }
895
+ function Z(i, e) {
896
+ const t = Math.asin(
897
+ Math.abs(e[1] - i[1]) / T(i, e)
898
+ );
899
+ return e[1] >= i[1] && e[0] >= i[0] ? t + Math.PI : e[1] >= i[1] && e[0] < i[0] ? Math.PI * 2 - t : e[1] < i[1] && e[0] < i[0] ? t : Math.PI - t;
900
+ }
901
+ function Je(i, e, t) {
902
+ const s = Z(e, i) - Z(e, t);
903
+ return s < 0 ? s + Math.PI * 2 : s;
904
+ }
905
+ function ve(i, e, t) {
906
+ return (t[1] - i[1]) * (e[0] - i[0]) > (e[1] - i[1]) * (t[0] - i[0]);
907
+ }
908
+ function y(i, e, t, s, r) {
909
+ const a = Z(i, e), n = r ? a + t : a - t;
910
+ return [e[0] + s * Math.cos(n), e[1] + s * Math.sin(n)];
911
+ }
912
+ function le(i, e, t) {
913
+ let s = i[0] - e[0], r = i[1] - e[1];
914
+ const a = Math.sqrt(s * s + r * r);
915
+ s /= a, r /= a;
916
+ let n = t[0] - e[0], o = t[1] - e[1];
917
+ const h = Math.sqrt(n * n + o * o);
918
+ return n /= h, o /= h, [s + n, r + o];
919
+ }
920
+ function he(i, e, t, s) {
921
+ const r = le(e, t, s), a = Math.sqrt(r[0] ** 2 + r[1] ** 2), n = T(e, t), o = T(t, s);
922
+ let h, u;
923
+ if (a > ae) {
924
+ const d = r[0] / a, c = r[1] / a;
925
+ ve(e, t, s) ? (h = [t[0] - i * n * c, t[1] + i * n * d], u = [t[0] + i * o * c, t[1] - i * o * d]) : (h = [t[0] + i * n * c, t[1] - i * n * d], u = [t[0] - i * o * c, t[1] + i * o * d]);
926
+ } else
927
+ h = [t[0] + i * (e[0] - t[0]), t[1] + i * (e[1] - t[1])], u = [t[0] + i * (s[0] - t[0]), t[1] + i * (s[1] - t[1])];
928
+ return [h, u];
929
+ }
930
+ function ze(i, e) {
931
+ const [t, s, r] = [i[0], i[1], i[2]], n = he(0, t, s, r)[0], o = le(t, s, r);
932
+ if (Math.sqrt(o[0] ** 2 + o[1] ** 2) > ae) {
933
+ const u = oe(t, s), d = t[0] - u[0], c = t[1] - u[1], g = 2 / T(t, s), m = -g * c, p = g * d, f = m * m - p * p, M = 2 * m * p, _ = p * p - m * m, w = n[0] - u[0], P = n[1] - u[1];
934
+ return [u[0] + f * w + M * P, u[1] + M * w + _ * P];
935
+ }
936
+ return [t[0] + e * (s[0] - t[0]), t[1] + e * (s[1] - t[1])];
937
+ }
938
+ function Xe(i, e) {
939
+ const t = i.length, [s, r, a] = [i[t - 3], i[t - 2], i[t - 1]], o = he(0, s, r, a)[1], h = le(s, r, a);
940
+ if (Math.sqrt(h[0] ** 2 + h[1] ** 2) > ae) {
941
+ const d = oe(r, a), c = a[0] - d[0], g = a[1] - d[1], m = 2 / T(r, a), p = -m * g, f = m * c, M = p * p - f * f, _ = 2 * p * f, w = f * f - p * p, P = o[0] - d[0], L = o[1] - d[1];
942
+ return [d[0] + M * P + _ * L, d[1] + _ * P + w * L];
943
+ }
944
+ return [a[0] + e * (r[0] - a[0]), a[1] + e * (r[1] - a[1])];
945
+ }
946
+ function Ye(i, e) {
947
+ let s = [ze(e, i)];
948
+ for (let n = 0; n < e.length - 2; n++) {
949
+ const o = he(i, e[n], e[n + 1], e[n + 2]);
950
+ s = s.concat(o);
951
+ }
952
+ const r = Xe(e, i);
953
+ r && s.push(r);
954
+ const a = [];
955
+ for (let n = 0; n < e.length - 1; n++) {
956
+ const o = e[n], h = e[n + 1];
957
+ a.push(o);
958
+ for (let u = 0; u < ce; u++) {
959
+ const d = u / ce, c = 1 - d, g = d * d, m = g * d, p = c * c, f = p * c, M = s[n * 2], _ = s[n * 2 + 1];
960
+ a.push([
961
+ f * o[0] + 3 * p * d * M[0] + 3 * c * g * _[0] + m * h[0],
962
+ f * o[1] + 3 * p * d * M[1] + 3 * c * g * _[1] + m * h[1]
963
+ ]);
964
+ }
965
+ a.push(h);
966
+ }
967
+ return a;
968
+ }
969
+ function $e(i, e) {
970
+ return i === 0 ? (e - 1) ** 2 / 2 : i === 1 ? (-2 * e ** 2 + 2 * e + 1) / 2 : i === 2 ? e ** 2 / 2 : 0;
971
+ }
972
+ function ge(i) {
973
+ if (i.length <= 2) return i;
974
+ const e = [i[0]], t = i.length - 3;
975
+ for (let s = 0; s <= t; s++)
976
+ for (let r = 0; r <= 1; r += 0.05) {
977
+ let a = 0, n = 0;
978
+ for (let o = 0; o <= 2; o++) {
979
+ const h = $e(o, r);
980
+ a += h * i[s + o][0], n += h * i[s + o][1];
981
+ }
982
+ e.push([a, n]);
983
+ }
984
+ return e.push(i[i.length - 1]), e;
985
+ }
986
+ function V(i, e) {
987
+ const t = Q([i, e]), s = t * 0.1, r = t * 0.2, a = t * 0.25, n = Math.PI / 8.5, o = Math.PI / 13, h = y(e, i, Math.PI / 2, s, !0), u = y(e, i, Math.PI / 2, s, !1), d = y(i, e, n, a, !1), c = y(i, e, n, a, !0), g = y(i, e, o, r, !1), m = y(i, e, o, r, !0);
988
+ return [h, g, d, e, c, m, u, i];
989
+ }
990
+ function K(i, e) {
991
+ if (i.length <= e) return i;
992
+ const t = [i[0]], s = (i.length - 1) / (e - 1);
993
+ for (let r = 1; r < e - 1; r++)
994
+ t.push(i[Math.round(r * s)]);
995
+ return t.push(i[i.length - 1]), t;
996
+ }
997
+ function qe(i) {
998
+ if (i.length === 2)
999
+ return V(i[0], i[1]);
1000
+ const e = Ye(0.3, i), t = K(e, 25), s = ne(t), r = 0.08, a = 0.12, n = 0.2, o = Math.PI / 8.5, h = Math.PI / 13, u = 0.15, d = s * r, c = s * u, g = [], m = [];
1001
+ let p = 0;
1002
+ const f = s - c;
1003
+ for (let v = 0; v < t.length && (v > 0 && (p += T(t[v - 1], t[v])), !(p > f)); v++) {
1004
+ const H = f > 0 ? p / f : 0, D = d * (1 - H * 0.5), N = v > 0 ? t[v - 1] : t[0], W = v < t.length - 1 ? t[v + 1] : t[v], A = W[0] - N[0], E = W[1] - N[1], F = Math.sqrt(A * A + E * E) || 1, G = -E / F, I = A / F;
1005
+ g.push([t[v][0] + G * D, t[v][1] + I * D]), m.push([t[v][0] - G * D, t[v][1] - I * D]);
1006
+ }
1007
+ const M = t[t.length - 1], _ = t[t.length - 2], w = s * a, P = s * n, L = y(_, M, h, w, !1), x = y(_, M, h, w, !0), k = y(_, M, o, P, !1), j = y(_, M, o, P, !0);
1008
+ return [...g, L, k, M, j, x, ...m.reverse()];
1009
+ }
1010
+ function Ze(i) {
1011
+ let e = i[0], t = i[1];
1012
+ ve(i[0], i[1], i[2]) && (e = i[1], t = i[0]);
1013
+ const r = [oe(e, t), ...i.slice(2)], a = 0.18, n = 0.3, o = 0.85, h = 0.15, u = 0.8;
1014
+ let d = Q(r), c = d * a;
1015
+ const g = r[r.length - 1];
1016
+ d = T(g, r[r.length - 2]);
1017
+ const m = T(e, t);
1018
+ c > m * u && (c = m * u);
1019
+ const p = c * n, f = c * h;
1020
+ c = Math.min(c, d);
1021
+ const M = c * o, _ = y(r[r.length - 2], g, 0, c, !0), w = y(r[r.length - 2], g, 0, M, !0), P = y(g, _, Math.PI / 2, p, !1), L = y(g, _, Math.PI / 2, p, !0), x = y(g, w, Math.PI / 2, f, !1), k = y(g, w, Math.PI / 2, f, !0), j = [x, P, g, L, k], v = m / Q(r), H = ne(r), N = Q(r) * v, W = T(x, k), A = (N - W) / 2;
1022
+ let E = 0;
1023
+ const F = [], G = [];
1024
+ for (let O = 1; O < r.length - 1; O++) {
1025
+ const J = Je(r[O - 1], r[O], r[O + 1]) / 2;
1026
+ E += T(r[O - 1], r[O]);
1027
+ const de = (N / 2 - E / H * A) / Math.sin(J);
1028
+ F.push(y(r[O - 1], r[O], Math.PI - J, de, !0)), G.push(y(r[O - 1], r[O], J, de, !1));
1029
+ }
1030
+ let I = [e, ...F, x], B = [t, ...G, k];
1031
+ return I = K(ge(I), 25), B = K(ge(B), 25), [...I, ...j, ...B.reverse()];
1032
+ }
1033
+ class Ve extends S {
1034
+ category = "arrow";
1035
+ /** `generateCoords()` 填充的闭合多边形顶点 */
1036
+ generatedCoords = [];
1037
+ constructor(e) {
1038
+ super(e);
1039
+ }
1040
+ update(e) {
1041
+ this.options = { ...this.options, ...e };
1042
+ }
1043
+ /**
1044
+ * 按 `arrowType` 与控制点生成闭合多边形顶点(供 GroundDecalManager / PlotOverlay 重建几何)。
1045
+ */
1046
+ generateCoords() {
1047
+ const e = this.options.points;
1048
+ if (!e || e.length < 2)
1049
+ return this.generatedCoords = [], [];
1050
+ const t = this.options.arrowType || "straight";
1051
+ return t === "fine" ? this.generatedCoords = V(e[0], e[1]) : t === "curved" ? this.generatedCoords = qe(e) : t === "attack" && e.length >= 3 ? this.generatedCoords = Ze(e) : this.generatedCoords = V(e[0], e[e.length - 1]), this.generatedCoords;
1052
+ }
1053
+ /** 浅拷贝:`options`、`generatedCoords` 与内部共享引用(顶点数组仍与 `options.points` 规则一致)。 */
1054
+ getSnapshot() {
1055
+ return {
1056
+ type: this.category,
1057
+ options: { ...this.options },
1058
+ generatedCoords: this.generatedCoords
1059
+ };
1060
+ }
1061
+ /** 深拷贝:`options.points` 与 `generatedCoords` 均为新数组。 */
1062
+ getSnapshotDeep() {
1063
+ const e = super.getSnapshotDeep();
1064
+ return {
1065
+ type: e.type,
1066
+ options: e.options,
1067
+ generatedCoords: this.generatedCoords.map((t) => [...t])
1068
+ };
1069
+ }
1070
+ }
1071
+ class Ke extends S {
1072
+ category = "text";
1073
+ constructor(e) {
1074
+ super(e);
1075
+ }
1076
+ update(e) {
1077
+ this.options = { ...this.options, ...e };
1078
+ }
1079
+ getCenterPoints() {
1080
+ const e = this.options.points;
1081
+ return e && e.length > 0 ? [e[0]] : [];
1082
+ }
1083
+ getExtentPoints() {
1084
+ return this.getCenterPoints();
1085
+ }
1086
+ }
1087
+ class et extends S {
1088
+ category = "circle";
1089
+ constructor(e) {
1090
+ super(e);
1091
+ }
1092
+ update(e) {
1093
+ this.options = { ...this.options, ...e };
1094
+ }
1095
+ getExtentPoints() {
1096
+ const e = this.options.points;
1097
+ if (!e || e.length === 0) return [];
1098
+ const t = e[0][0], s = e[0][1], r = this.options.radius || 0, a = r / (111320 * Math.cos(s * ie)), n = r / 111320;
1099
+ return [
1100
+ [t - a, s - n],
1101
+ [t + a, s + n]
1102
+ ];
1103
+ }
1104
+ }
1105
+ class tt {
1106
+ /** 标绘 id → 实例;与 `PlotOverlay.imageSource.shapes` 共用同一引用 */
1107
+ _items = /* @__PURE__ */ new Map();
1108
+ /** 标绘 id */
1109
+ id = "GROUND_DECAL_PLOT";
1110
+ /** 标绘 overlay */
1111
+ _overlay;
1112
+ /** SoonSpace 实例 */
1113
+ ssp;
1114
+ /** 传入的 ImageOverlayPlugin,用于在有图形时自动注册 overlay */
1115
+ _imageOverlayPlugin;
1116
+ /** overlay 是否已注册到 ImageOverlayPlugin */
1117
+ _overlayAttached = !1;
1118
+ /** 合并同一帧内多次 `_markDirty`,值为 `requestAnimationFrame` 句柄 */
1119
+ _redrawTimer = null;
1120
+ constructor(e) {
1121
+ this.ssp = e.ssp, this._imageOverlayPlugin = e.imageOverlayPlugin, this._overlay = new Re(), this._overlay.imageSource.shapes = this._items, this._overlay.imageSource.setRenderer(e.ssp.viewport.renderer);
1122
+ }
1123
+ /**
1124
+ * 内部使用的 `PlotOverlay` 实例。
1125
+ * 注册到 `ImageOverlayPlugin` 的 `overlays` 数组中,顺序靠后者通常绘制在上层。
1126
+ */
1127
+ get overlay() {
1128
+ return this._overlay;
1129
+ }
1130
+ /**
1131
+ * 绑定 / 更换 ImageOverlayPlugin(切换地形重建插件后调用)。
1132
+ * 如果当前已有图形,会在下一帧自动重新注册 overlay。
1133
+ */
1134
+ setImageOverlayPlugin(e) {
1135
+ this._imageOverlayPlugin = e, this._overlayAttached = !1, this._items.size > 0 && this._markDirty();
1136
+ }
1137
+ // ── 图形创建:返回字符串 id,可用于后续查询 / 更新 / 删除 ──
1138
+ /**
1139
+ * 添加标绘:由 `options.type` 决定实例化哪一类 `GisPlot*`(与各类 `*Options` 对应)。
1140
+ */
1141
+ addPlot(e) {
1142
+ let t;
1143
+ switch (e.type) {
1144
+ case "point": {
1145
+ const { type: s, ...r } = e;
1146
+ t = new We(r);
1147
+ break;
1148
+ }
1149
+ case "line": {
1150
+ const { type: s, ...r } = e;
1151
+ t = new Qe(r);
1152
+ break;
1153
+ }
1154
+ case "polygon": {
1155
+ const { type: s, ...r } = e;
1156
+ t = new je(r);
1157
+ break;
1158
+ }
1159
+ case "rectangle": {
1160
+ const { type: s, ...r } = e;
1161
+ t = new He(r);
1162
+ break;
1163
+ }
1164
+ case "circle": {
1165
+ const { type: s, ...r } = e;
1166
+ t = new et(r);
1167
+ break;
1168
+ }
1169
+ case "sector": {
1170
+ const { type: s, ...r } = e;
1171
+ t = new Be(r);
1172
+ break;
1173
+ }
1174
+ case "text": {
1175
+ const { type: s, ...r } = e;
1176
+ t = new Ke(r);
1177
+ break;
1178
+ }
1179
+ case "arrow": {
1180
+ const { type: s, ...r } = e;
1181
+ t = new Ve(r);
1182
+ break;
1183
+ }
1184
+ default:
1185
+ throw new Error("GroundDecalManager.addPlot: unknown type");
1186
+ }
1187
+ return this._items.set(t.id, t), this._markDirty(), t.id;
1188
+ }
1189
+ /** 按 id 移除标绘;存在并删除成功时触发重绘 */
1190
+ remove(e) {
1191
+ this._items.delete(e) && this._markDirty();
1192
+ }
1193
+ /** 清空全部标绘 */
1194
+ clear() {
1195
+ this._items.clear(), this._markDirty();
1196
+ }
1197
+ // ── 查询与修改 ──
1198
+ /**
1199
+ * 读取标绘快照(**浅拷贝**:`options` 为新对象,但 `points` 与内部仍为同一数组引用)。
1200
+ * 若需完全独立副本,请用 {@link getItemDeep}。
1201
+ */
1202
+ getItem(e) {
1203
+ const t = this._items.get(e);
1204
+ return t ? t.getSnapshot() : null;
1205
+ }
1206
+ /**
1207
+ * 深拷贝快照:`points` 等嵌套数组被复制,修改返回值不会影响内部状态。
1208
+ * 箭头类型额外深拷贝 `generatedCoords`。
1209
+ */
1210
+ getItemDeep(e) {
1211
+ const t = this._items.get(e);
1212
+ return t ? t.getSnapshotDeep() : null;
1213
+ }
1214
+ /**
1215
+ * 合并更新样式与几何字段(调用对应 `GisPlot*.update`)。
1216
+ * `patch` 形状需与该 id 下图元类型兼容。
1217
+ */
1218
+ setStyle(e, t) {
1219
+ const s = this._items.get(e);
1220
+ s && (s.update(t), this._markDirty());
1221
+ }
1222
+ /**
1223
+ * 将 **第一个顶点** 设为新的经纬度中心(适用于点、矩形中心、扇心、文字锚点等单中心语义)。
1224
+ */
1225
+ setCenter(e, t) {
1226
+ const s = this._items.get(e);
1227
+ !s || !s.options.points || s.options.points.length === 0 || (t.lon !== void 0 && (s.options.points[0][0] = t.lon), t.lat !== void 0 && (s.options.points[0][1] = t.lat), this._markDirty());
1228
+ }
1229
+ /** 整体替换顶点列表(每项为 `[lon, lat]`) */
1230
+ setCoords(e, t) {
1231
+ const s = this._items.get(e);
1232
+ s && (s.options.points = t.map((r) => [...r]), this._markDirty());
1233
+ }
1234
+ /** 修改指定下标顶点;`coord` 分量可为 `undefined` 表示不改该分量 */
1235
+ setCoord(e, t, s) {
1236
+ const r = this._items.get(e);
1237
+ !r || !r.options.points || t < 0 || t >= r.options.points.length || (s[0] !== void 0 && (r.options.points[t][0] = s[0]), s[1] !== void 0 && (r.options.points[t][1] = s[1]), this._markDirty());
1238
+ }
1239
+ /** 在 `index` 处插入一个顶点(可插在末尾,`index` 越界时钳位) */
1240
+ insertCoord(e, t, s) {
1241
+ const r = this._items.get(e);
1242
+ if (!r || !r.options.points) return;
1243
+ const a = Math.max(0, Math.min(t, r.options.points.length));
1244
+ r.options.points.splice(a, 0, [...s]), this._markDirty();
1245
+ }
1246
+ /**
1247
+ * 删除指定下标顶点。
1248
+ * 多边形至少保留 3 点,其余类型至少 2 点(与 `shape.category` 联动)。
1249
+ */
1250
+ removeCoord(e, t) {
1251
+ const s = this._items.get(e);
1252
+ if (!s || !s.options.points || t < 0 || t >= s.options.points.length) return;
1253
+ const r = s.category === "polygon" ? 3 : 2;
1254
+ s.options.points.length <= r || (s.options.points.splice(t, 1), this._markDirty());
1255
+ }
1256
+ /** 对所有顶点做经纬度平移(度) */
1257
+ translateCoords(e, t, s) {
1258
+ const r = this._items.get(e);
1259
+ if (!(!r || !r.options.points)) {
1260
+ for (const a of r.options.points)
1261
+ a[0] += t, a[1] += s;
1262
+ this._markDirty();
1263
+ }
1264
+ }
1265
+ /** 仅对 `category === 'text'` 的项更新 `options.content` */
1266
+ setText(e, t) {
1267
+ const s = this._items.get(e);
1268
+ !s || s.category !== "text" || (s.options.content = t, this._markDirty());
1269
+ }
1270
+ /** 设置整个 overlay 不透明度(0–1,具体语义以 `PlotOverlay` 为准) */
1271
+ setGlobalOpacity(e) {
1272
+ this._overlay.opacity = e, this._markDirty();
1273
+ }
1274
+ getCoordCount(e) {
1275
+ const t = this._items.get(e);
1276
+ return !t || !t.options.points ? 0 : t.options.points.length;
1277
+ }
1278
+ /**
1279
+ * 在经纬度平面上找离 `(lon, lat)` 最近的顶点下标(平方距离最小);
1280
+ * 无顶点时返回 `-1`。
1281
+ */
1282
+ findNearestCoord(e, t, s) {
1283
+ const r = this._items.get(e);
1284
+ if (!r || !r.options.points || r.options.points.length === 0) return -1;
1285
+ let a = 0, n = 1 / 0;
1286
+ for (let o = 0; o < r.options.points.length; o++) {
1287
+ const h = r.options.points[o][0] - t, u = r.options.points[o][1] - s, d = h * h + u * u;
1288
+ d < n && (n = d, a = o);
1289
+ }
1290
+ return a;
1291
+ }
1292
+ render = () => {
1293
+ this.ssp.render();
1294
+ };
1295
+ /**
1296
+ * 释放 overlay 内部 RTT / 纹理等资源。
1297
+ * `PlotImageSource` 的运行时实现含 `dispose`,类型声明可能未列出,故做断言。
1298
+ */
1299
+ dispose() {
1300
+ this._overlay.imageSource.dispose();
1301
+ }
1302
+ /**
1303
+ * 标记需要在下一帧重绘瓦片标绘层;同一帧内多次调用只会调度一次。
1304
+ * 首次有图形且尚未挂载时,先将 PlotOverlay 注册到 ImageOverlayPlugin(此时 shapes 已有数据,
1305
+ * `init()` → `hasContent` 能正确返回 true)。
1306
+ */
1307
+ _markDirty() {
1308
+ this._redrawTimer || (this._redrawTimer = requestAnimationFrame(() => {
1309
+ this._redrawTimer = null, !this._overlayAttached && this._items.size > 0 && this._imageOverlayPlugin ? (this._imageOverlayPlugin.addOverlay(this._overlay), this._overlayAttached = !0) : this._overlay.redraw(), this.render();
1310
+ }));
1311
+ }
1312
+ }
1313
+ const st = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/", rt = "https://c.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
1314
+ class yt {
768
1315
  constructor(e, t = {}) {
769
1316
  this.ssp = e, this.options = t;
770
- const r = t.baseUrl || Z;
771
- if (this.resourceManager = new z(), this.terrainManager = new $(), t.imageryUrl !== !1) {
772
- const i = t.imageryUrl || X;
1317
+ const s = t.baseUrl || st;
1318
+ if (this.resourceManager = new Fe(), this.terrainManager = new Ge(), t.imageryUrl !== !1) {
1319
+ const r = t.imageryUrl || rt;
773
1320
  this.resourceManager.addOverlay({
774
1321
  id: this.defaultImageryId,
775
- type: a.XYZ,
776
- options: { id: this.defaultImageryId, url: i }
1322
+ type: l.XYZ,
1323
+ options: { id: this.defaultImageryId, url: r }
777
1324
  });
778
1325
  }
779
- this._alphaClipMode = t.alphaClipMode ?? "alphaTest", this._currentTerrainConfig = {
1326
+ this.groundDecalManager = new tt({ ssp: this.ssp }), this._alphaClipMode = t.alphaClipMode ?? "alphaTest", this._currentTerrainConfig = {
780
1327
  id: this.defaultTerrainId,
781
- type: g.QUANTIZED_MESH,
782
- url: r
783
- }, this.terrainManager.add(this._currentTerrainConfig), this.terrainManager.setCurrentId(this._currentTerrainConfig.id), this.tiles = this._initTilesRenderer(this._currentTerrainConfig), this._initPlugins(this.tiles, this._currentTerrainConfig);
1328
+ type: U.QUANTIZED_MESH,
1329
+ url: s
1330
+ }, this.terrainManager.add(this._currentTerrainConfig), this.terrainManager.setCurrentId(this._currentTerrainConfig.id), this.tiles = this._initTilesRenderer(this._currentTerrainConfig), this._initPlugins(this.tiles, this._currentTerrainConfig), this.imageOverlayPlugin && this.groundDecalManager.setImageOverlayPlugin(this.imageOverlayPlugin);
784
1331
  }
785
1332
  defaultTerrainId = "__default_terrain__";
786
1333
  defaultImageryId = "__default_imagery__";
@@ -796,6 +1343,8 @@ class le {
796
1343
  terrainManager;
797
1344
  /** Overlay 管理器(管理实例) */
798
1345
  overlayManager;
1346
+ /** 标绘管理器(管理标绘实例) */
1347
+ groundDecalManager;
799
1348
  /** 当前地形配置 */
800
1349
  _currentTerrainConfig;
801
1350
  /** Alpha 裁剪模式 */
@@ -808,7 +1357,7 @@ class le {
808
1357
  * 是否使用 Cesium Ion 地形
809
1358
  */
810
1359
  get isCesiumIon() {
811
- return this._currentTerrainConfig.type === g.CESIUM_ION;
1360
+ return this._currentTerrainConfig.type === U.CESIUM_ION;
812
1361
  }
813
1362
  /**
814
1363
  * 获取当前地形配置
@@ -854,9 +1403,9 @@ class le {
854
1403
  this._alphaClipMode = e, this.customMaterialPlugin && (this.customMaterialPlugin.alphaClipMode = e), this._updateAlphaClipMode(), this.render();
855
1404
  }
856
1405
  _initTilesRenderer(e) {
857
- return e.type === g.CESIUM_ION ? new u() : (
1406
+ return e.type === U.CESIUM_ION ? new R() : (
858
1407
  // Cesium Ion 由插件设置 URL
859
- new u(e.url)
1408
+ new R(e.url)
860
1409
  );
861
1410
  }
862
1411
  /**
@@ -864,30 +1413,30 @@ class le {
864
1413
  * @param config 地形配置
865
1414
  */
866
1415
  _initPlugins(e, t) {
867
- if (this.tilesFadePlugin = new O({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new T(), e.registerPlugin(this.tilesFadePlugin), e.registerPlugin(this.updateOnChangePlugin), t.type === g.CESIUM_ION ? e.registerPlugin(new L({
1416
+ if (this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), e.registerPlugin(this.tilesFadePlugin), e.registerPlugin(this.updateOnChangePlugin), t.type === U.CESIUM_ION ? e.registerPlugin(new fe({
868
1417
  apiToken: t.apiToken,
869
1418
  assetId: t.assetId || "1",
870
1419
  autoRefreshToken: t.autoRefreshToken ?? !0,
871
- assetTypeHandler: (r, i) => {
872
- r === "TERRAIN" && i.getPluginByName("QUANTIZED_MESH_PLUGIN") === null && i.registerPlugin(new M({ useRecommendedSettings: !0 }));
1420
+ assetTypeHandler: (s, r) => {
1421
+ s === "TERRAIN" && r.getPluginByName("QUANTIZED_MESH_PLUGIN") === null && r.registerPlugin(new q({ useRecommendedSettings: !0 }));
873
1422
  }
874
- })) : (e.registerPlugin(new M({ useRecommendedSettings: !0 })), e.fetchData = async (r) => {
875
- const i = { method: "GET", mode: "cors" };
876
- if (/layer\.json$/.test(r)) {
877
- const s = await fetch(r, i).then((l) => l.json());
878
- return s.metadataAvailability = -1, new Response(JSON.stringify(s));
1423
+ })) : (e.registerPlugin(new q({ useRecommendedSettings: !0 })), e.fetchData = async (s) => {
1424
+ const r = { method: "GET", mode: "cors" };
1425
+ if (/layer\.json$/.test(s)) {
1426
+ const a = await fetch(s, r).then((n) => n.json());
1427
+ return a.metadataAvailability = -1, new Response(JSON.stringify(a));
879
1428
  }
880
- return fetch(r, i);
881
- }), this.options.useCustomMaterial !== !1 && (this.customMaterialPlugin = new H(), this.customMaterialPlugin.alphaClipMode = this._alphaClipMode, e.registerPlugin(this.customMaterialPlugin)), this.imageOverlayPlugin = new E({
1429
+ return fetch(s, r);
1430
+ }), this.options.useCustomMaterial !== !1 && (this.customMaterialPlugin = new Ne(), this.customMaterialPlugin.alphaClipMode = this._alphaClipMode, e.registerPlugin(this.customMaterialPlugin)), this.imageOverlayPlugin = new me({
882
1431
  renderer: this.ssp.viewport.renderer,
883
1432
  overlays: []
884
- }), e.registerPlugin(this.imageOverlayPlugin), this.overlayManager = new B(this.imageOverlayPlugin, this.resourceManager), this.overlayManager.restoreFromResourceManager(), this.options.reorientation !== !1) {
885
- const r = this.options.reorientation || { lon: 120, lat: 30 };
886
- this.reorientationPlugin = new w({
887
- lon: r.lon,
888
- lat: r.lat,
889
- height: r.height ?? 0.1
890
- }), e.registerPlugin(this.reorientationPlugin), this.invalidate(r.lon, r.lat, r.height ?? 0.1);
1433
+ }), e.registerPlugin(this.imageOverlayPlugin), this.overlayManager = new Ae(this.imageOverlayPlugin, this.resourceManager), this.overlayManager.restoreFromResourceManager(), this.options.reorientation !== !1) {
1434
+ const s = this.options.reorientation || { lon: 120, lat: 30 };
1435
+ this.reorientationPlugin = new re({
1436
+ lon: s.lon,
1437
+ lat: s.lat,
1438
+ height: s.height ?? 0.1
1439
+ }), e.registerPlugin(this.reorientationPlugin), this.invalidate(s.lon, s.lat, s.height ?? 0.1);
891
1440
  }
892
1441
  e.maxDepth = this.options.maxDepth ?? 20, e.errorTarget = this.options.errorTarget ?? 1, e.addEventListener("needs-render", this.render), e.addEventListener("needs-update", this.render);
893
1442
  }
@@ -924,7 +1473,7 @@ class le {
924
1473
  * })
925
1474
  */
926
1475
  setTerrain(e, t = void 0) {
927
- e.id !== this._currentTerrainConfig.id && (t && (this.options = { ...this.options, ...t }), this.terrainManager.has(e.id) || this.terrainManager.add(e), this.terrainManager.setCurrentId(e.id), this._disposeTilesRenderer(), this._currentTerrainConfig = e, this.tiles = this._initTilesRenderer(e), this._initPlugins(this.tiles, e), this._enabled && this.ssp.addObject(this.tiles.group), this.render());
1476
+ e.id !== this._currentTerrainConfig.id && (t && (this.options = { ...this.options, ...t }), this.terrainManager.has(e.id) || this.terrainManager.add(e), this.terrainManager.setCurrentId(e.id), this._disposeTilesRenderer(), this._currentTerrainConfig = e, this.tiles = this._initTilesRenderer(e), this._initPlugins(this.tiles, e), this.imageOverlayPlugin && this.groundDecalManager && this.groundDecalManager.setImageOverlayPlugin(this.imageOverlayPlugin), this._enabled && this.ssp.addObject(this.tiles.group), this.render());
928
1477
  }
929
1478
  // =============== Overlay 快捷方法 ===============
930
1479
  /**
@@ -1005,8 +1554,8 @@ class le {
1005
1554
  * 更新 GeoJSON 颜色
1006
1555
  */
1007
1556
  updateGeoJSONColor(e, t) {
1008
- const r = this.overlayManager.updateGeoJSONColor(e, t);
1009
- return r && this.render(), r;
1557
+ const s = this.overlayManager.updateGeoJSONColor(e, t);
1558
+ return s && this.render(), s;
1010
1559
  }
1011
1560
  /**
1012
1561
  * 更新 GeoJSON 模式
@@ -1015,29 +1564,29 @@ class le {
1015
1564
  * - invertMask: 只显示 GeoJSON 区域外的地形
1016
1565
  */
1017
1566
  updateGeoJSONMode(e, t) {
1018
- const r = this.overlayManager.updateGeoJSONMode(e, t);
1019
- return r && this.render(), r;
1567
+ const s = this.overlayManager.updateGeoJSONMode(e, t);
1568
+ return s && this.render(), s;
1020
1569
  }
1021
1570
  /**
1022
1571
  * 更新 GeoJSON 描边样式
1023
1572
  */
1024
1573
  updateGeoJSONStrokeStyle(e, t) {
1025
- const r = this.overlayManager.updateGeoJSONStrokeStyle(e, t);
1026
- return r && this.render(), r;
1574
+ const s = this.overlayManager.updateGeoJSONStrokeStyle(e, t);
1575
+ return s && this.render(), s;
1027
1576
  }
1028
1577
  /**
1029
1578
  * 更新 GeoJSON 描边宽度
1030
1579
  */
1031
1580
  updateGeoJSONStrokeWidth(e, t) {
1032
- const r = this.overlayManager.updateGeoJSONStrokeWidth(e, t);
1033
- return r && this.render(), r;
1581
+ const s = this.overlayManager.updateGeoJSONStrokeWidth(e, t);
1582
+ return s && this.render(), s;
1034
1583
  }
1035
1584
  /**
1036
1585
  * 更新 GeoJSON 填充样式
1037
1586
  */
1038
1587
  updateGeoJSONFillStyle(e, t) {
1039
- const r = this.overlayManager.updateGeoJSONFillStyle(e, t);
1040
- return r && this.render(), r;
1588
+ const s = this.overlayManager.updateGeoJSONFillStyle(e, t);
1589
+ return s && this.render(), s;
1041
1590
  }
1042
1591
  // =============== Overlay 层级控制 ===============
1043
1592
  /**
@@ -1073,15 +1622,15 @@ class le {
1073
1622
  * 设置 overlay 可见性
1074
1623
  */
1075
1624
  setOverlayVisible(e, t) {
1076
- const r = this.overlayManager.setVisible(e, t);
1077
- return r && this.render(), r;
1625
+ const s = this.overlayManager.setVisible(e, t);
1626
+ return s && this.render(), s;
1078
1627
  }
1079
1628
  /**
1080
1629
  * 设置 overlay 透明度
1081
1630
  */
1082
1631
  setOverlayOpacity(e, t) {
1083
- const r = this.overlayManager.setOpacity(e, t);
1084
- return r && this.render(), r;
1632
+ const s = this.overlayManager.setOpacity(e, t);
1633
+ return s && this.render(), s;
1085
1634
  }
1086
1635
  // =============== 生命周期 ===============
1087
1636
  render = () => {
@@ -1099,27 +1648,27 @@ class le {
1099
1648
  disable() {
1100
1649
  this._enabled = !1, this.ssp.removeObject(this.tiles.group), this.ssp.signals.beforeRender.remove(this.beforeRenderHandler);
1101
1650
  }
1102
- invalidate(e, t, r) {
1651
+ invalidate(e, t, s) {
1103
1652
  if (!this.reorientationPlugin)
1104
1653
  return console.warn("TilesRenderer: reorientationPlugin is not enabled, invalidate() will not work."), () => {
1105
1654
  };
1106
- const i = this.reorientationPlugin;
1655
+ const r = this.reorientationPlugin;
1107
1656
  this.options.reorientation = {
1108
1657
  lon: e,
1109
1658
  lat: t,
1110
- height: r
1659
+ height: s
1111
1660
  };
1112
- const s = () => {
1113
- const o = c.degToRad(t), d = c.degToRad(e);
1114
- i.transformLatLonHeightToOrigin(
1661
+ const a = () => {
1662
+ const o = C.degToRad(t), h = C.degToRad(e);
1663
+ r.transformLatLonHeightToOrigin(
1115
1664
  o,
1116
- d,
1117
- r
1118
- ), this.render(), l();
1119
- }, l = () => {
1120
- this.tiles.removeEventListener("load-root-tileset", s), this.loedTilesSets.delete(s);
1665
+ h,
1666
+ s
1667
+ ), this.render(), n();
1668
+ }, n = () => {
1669
+ this.tiles.removeEventListener("load-root-tileset", a), this.loedTilesSets.delete(a);
1121
1670
  };
1122
- return this.tiles.addEventListener("load-root-tileset", s), this.loedTilesSets.add(s), this.tiles.root && s(), l;
1671
+ return this.tiles.addEventListener("load-root-tileset", a), this.loedTilesSets.add(a), this.tiles.root && a(), n;
1123
1672
  }
1124
1673
  dispose() {
1125
1674
  this.disable(), this.terrainManager.dispose(), this.overlayManager.dispose(), this.loedTilesSets.forEach(
@@ -1127,12 +1676,12 @@ class le {
1127
1676
  ), this.loedTilesSets.clear(), this.tiles.removeEventListener("needs-render", this.render), this.tiles.removeEventListener("needs-update", this.render), this.tiles.dispose();
1128
1677
  }
1129
1678
  }
1130
- const h = {
1679
+ const b = {
1131
1680
  DEFAULT: 0,
1132
1681
  GRADIENT: 1,
1133
1682
  TOPOGRAPHIC_LINES: 2,
1134
1683
  LIGHTING: 3
1135
- }, Y = {
1684
+ }, it = {
1136
1685
  vertexShader: (
1137
1686
  /* glsl */
1138
1687
  `
@@ -1158,7 +1707,7 @@ const h = {
1158
1707
  }
1159
1708
  `
1160
1709
  )
1161
- }, V = {
1710
+ }, at = {
1162
1711
  vertexShader: (
1163
1712
  /* glsl */
1164
1713
  `
@@ -1204,10 +1753,10 @@ const h = {
1204
1753
  `
1205
1754
  )
1206
1755
  };
1207
- let m = null, y = null, f = null;
1208
- class q {
1756
+ let X = null, Y = null, $ = null;
1757
+ class nt {
1209
1758
  constructor(e, t) {
1210
- this.ssp = e, this.options = t, "url" in this.options ? this.tiles = new u(this.options.url) : (this.tiles = new u(), this._initCesiumIon(this.options)), this._initBasePlugins(this.options);
1759
+ this.ssp = e, this.options = t, "url" in this.options ? this.tiles = new R(this.options.url) : (this.tiles = new R(), this._initCesiumIon(this.options)), this._initBasePlugins(this.options);
1211
1760
  }
1212
1761
  tiles;
1213
1762
  tilesFadePlugin;
@@ -1215,10 +1764,10 @@ class q {
1215
1764
  reorientationPlugin;
1216
1765
  options;
1217
1766
  // 用于模型居中
1218
- _box = new I();
1219
- _sphere = new x();
1767
+ _box = new Oe();
1768
+ _sphere = new Te();
1220
1769
  // 当前材质类型
1221
- _materialType = h.DEFAULT;
1770
+ _materialType = b.DEFAULT;
1222
1771
  // 按需渲染标志
1223
1772
  _needsUpdate = !0;
1224
1773
  _cameraTransitionStart = !1;
@@ -1228,7 +1777,7 @@ class q {
1228
1777
  */
1229
1778
  _initCesiumIon(e) {
1230
1779
  this.tiles.registerPlugin(
1231
- new L({
1780
+ new fe({
1232
1781
  apiToken: e.apiToken,
1233
1782
  assetId: e.assetId,
1234
1783
  autoRefreshToken: e.autoRefreshToken ?? !0
@@ -1239,9 +1788,9 @@ class q {
1239
1788
  * 初始化基础插件
1240
1789
  */
1241
1790
  _initBasePlugins(e) {
1242
- if (e._managedByPlugin || (m === null ? m = this.tiles.lruCache : this.tiles.lruCache = m, y === null ? y = this.tiles.parseQueue : this.tiles.parseQueue = y, f === null ? f = this.tiles.downloadQueue : this.tiles.downloadQueue = f, this.tiles.lruCache.maxSize = 600, this.tiles.lruCache.minSize = 300, this.tiles.lruCache.unloadPercent = 0.8), this._setupGLTFLoader(), this.tilesFadePlugin = new O({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new T(), this.tiles.registerPlugin(this.tilesFadePlugin), this.tiles.registerPlugin(this.updateOnChangePlugin), this.tiles.maxDepth = e.maxDepth ?? 20, this.tiles.errorTarget = e.errorTarget ?? 2, this.options.reorientation) {
1791
+ if (e._managedByPlugin || (X === null ? X = this.tiles.lruCache : this.tiles.lruCache = X, Y === null ? Y = this.tiles.parseQueue : this.tiles.parseQueue = Y, $ === null ? $ = this.tiles.downloadQueue : this.tiles.downloadQueue = $, this.tiles.lruCache.maxSize = 600, this.tiles.lruCache.minSize = 300, this.tiles.lruCache.unloadPercent = 0.8), this._setupGLTFLoader(), this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), this.tiles.registerPlugin(this.tilesFadePlugin), this.tiles.registerPlugin(this.updateOnChangePlugin), this.tiles.maxDepth = e.maxDepth ?? 20, this.tiles.errorTarget = e.errorTarget ?? 2, this.options.reorientation) {
1243
1792
  const t = this.options.reorientation || { lon: 120, lat: 30 };
1244
- this.reorientationPlugin = new w({
1793
+ this.reorientationPlugin = new re({
1245
1794
  lon: t.lon,
1246
1795
  lat: t.lat,
1247
1796
  height: t.height ?? 0.1
@@ -1257,10 +1806,10 @@ class q {
1257
1806
  * 设置 GLTF Loader
1258
1807
  */
1259
1808
  _setupGLTFLoader() {
1260
- const e = new C(this.tiles.manager), t = this.ssp.manager?.store?.modelManager;
1809
+ const e = new pe(this.tiles.manager), t = this.ssp.manager?.store?.modelManager;
1261
1810
  if (t?.gltfLoader) {
1262
- const { dracoLoader: r, ktx2Loader: i, meshoptDecoder: s } = t.gltfLoader;
1263
- r && e.setDRACOLoader(r), i && e.setKTX2Loader(i), s && e.setMeshoptDecoder(s);
1811
+ const { dracoLoader: s, ktx2Loader: r, meshoptDecoder: a } = t.gltfLoader;
1812
+ s && e.setDRACOLoader(s), r && e.setKTX2Loader(r), a && e.setMeshoptDecoder(a);
1264
1813
  }
1265
1814
  this.tiles.manager.addHandler(/\.gltf$/, e);
1266
1815
  }
@@ -1301,29 +1850,29 @@ class q {
1301
1850
  onLoadModel = ({ scene: e }) => {
1302
1851
  e.traverse((t) => {
1303
1852
  t.isMesh && (t.originalMaterial = t.material);
1304
- }), this._materialType !== h.DEFAULT && this.updateMaterial(e);
1853
+ }), this._materialType !== b.DEFAULT && this.updateMaterial(e);
1305
1854
  };
1306
1855
  /**
1307
1856
  * 更新场景中所有网格的材质(参考 customMaterial.js)
1308
1857
  */
1309
1858
  updateMaterial = (e) => {
1310
1859
  const t = this._materialType;
1311
- e.traverse((r) => {
1312
- if (r.isMesh)
1313
- switch (r.material && r.material !== r.originalMaterial && r.material.dispose(), t) {
1314
- case h.DEFAULT:
1315
- r.material = r.originalMaterial, r.material && (r.material.side = 2), r.receiveShadow = !1, r.castShadow = !1;
1860
+ e.traverse((s) => {
1861
+ if (s.isMesh)
1862
+ switch (s.material && s.material !== s.originalMaterial && s.material.dispose(), t) {
1863
+ case b.DEFAULT:
1864
+ s.material = s.originalMaterial, s.material && (s.material.side = 2), s.receiveShadow = !1, s.castShadow = !1;
1316
1865
  break;
1317
- case h.GRADIENT:
1318
- r.material = new P(Y), r.material.side = 2, r.receiveShadow = !1, r.castShadow = !1;
1866
+ case b.GRADIENT:
1867
+ s.material = new ue(it), s.material.side = 2, s.receiveShadow = !1, s.castShadow = !1;
1319
1868
  break;
1320
- case h.TOPOGRAPHIC_LINES: {
1321
- const i = new P(V);
1322
- i.extensions = { derivatives: !0 }, i.side = 2, r.material = i, r.receiveShadow = !1, r.castShadow = !1;
1869
+ case b.TOPOGRAPHIC_LINES: {
1870
+ const r = new ue(at);
1871
+ r.extensions = { derivatives: !0 }, r.side = 2, s.material = r, s.receiveShadow = !1, s.castShadow = !1;
1323
1872
  break;
1324
1873
  }
1325
- case h.LIGHTING:
1326
- r.material = new N(), r.material.side = 2, r.receiveShadow = !0, r.castShadow = !0;
1874
+ case b.LIGHTING:
1875
+ s.material = new we(), s.material.side = 2, s.receiveShadow = !0, s.castShadow = !0;
1327
1876
  break;
1328
1877
  }
1329
1878
  });
@@ -1357,25 +1906,25 @@ class q {
1357
1906
  disable() {
1358
1907
  this.ssp.removeObject(this.tiles.group), this.ssp.signals.beforeRender.remove(this.beforeRenderHandler);
1359
1908
  }
1360
- invalidate(e, t, r) {
1909
+ invalidate(e, t, s) {
1361
1910
  if (!this.reorientationPlugin)
1362
1911
  return console.warn(
1363
1912
  "TilesRenderer: reorientationPlugin is not enabled, invalidate() will not work."
1364
1913
  ), () => {
1365
1914
  };
1366
- const i = this.reorientationPlugin;
1915
+ const r = this.reorientationPlugin;
1367
1916
  this.options.reorientation = {
1368
1917
  lon: e,
1369
1918
  lat: t,
1370
- height: r
1919
+ height: s
1371
1920
  };
1372
- const s = () => {
1373
- const o = c.degToRad(t), d = c.degToRad(e);
1374
- i.transformLatLonHeightToOrigin(o, d, r), this.render(), l();
1375
- }, l = () => {
1376
- this.tiles.removeEventListener("load-root-tileset", s), this.loedTilesSets.delete(s);
1921
+ const a = () => {
1922
+ const o = C.degToRad(t), h = C.degToRad(e);
1923
+ r.transformLatLonHeightToOrigin(o, h, s), this.render(), n();
1924
+ }, n = () => {
1925
+ this.tiles.removeEventListener("load-root-tileset", a), this.loedTilesSets.delete(a);
1377
1926
  };
1378
- return this.tiles.addEventListener("load-root-tileset", s), this.loedTilesSets.add(s), this.tiles.root && s(), l;
1927
+ return this.tiles.addEventListener("load-root-tileset", a), this.loedTilesSets.add(a), this.tiles.root && a(), n;
1379
1928
  }
1380
1929
  dispose() {
1381
1930
  this.disable(), this.loedTilesSets.forEach(
@@ -1383,14 +1932,14 @@ class q {
1383
1932
  ), this.loedTilesSets.clear(), this.tiles.removeEventListener("load-model", this.onLoadModel), this.tiles.removeEventListener("dispose-model", this.onDisposeModel), this.options._managedByPlugin || (this.tiles.removeEventListener("load-model", this._onNeedsRender), this.tiles.removeEventListener("needs-render", this._onNeedsRender), this.tiles.removeEventListener("needs-update", this._onNeedsRender)), this.tiles.dispose();
1384
1933
  }
1385
1934
  }
1386
- class oe {
1935
+ class ft {
1387
1936
  constructor(e) {
1388
1937
  this.ssp = e;
1389
- const { controls: t, viewport: r } = e;
1390
- this._tilesCamera = r.camera, t.addEventListener("transitionstart", () => {
1391
- this.cameraTransitionStart = !0, r.state.useFreq = 1;
1938
+ const { controls: t, viewport: s } = e;
1939
+ this._tilesCamera = s.camera, t.addEventListener("transitionstart", () => {
1940
+ this.cameraTransitionStart = !0, s.state.useFreq = 1;
1392
1941
  }), t.addEventListener("rest", () => {
1393
- this.cameraTransitionStart = !1, this.needsUpdate = !0, r.state.useFreq = 60;
1942
+ this.cameraTransitionStart = !1, this.needsUpdate = !0, s.state.useFreq = 60;
1394
1943
  }), e.signals.beforeRender.add(this._beforeRenderHandler), e.signals.cameraObjectChange.add(this._onCameraObjectChange);
1395
1944
  }
1396
1945
  /** 存储多个 tiles 实例,key 为 url */
@@ -1421,18 +1970,18 @@ class oe {
1421
1970
  async loadTiles(e) {
1422
1971
  const t = "url" in e ? e.url : e.assetId;
1423
1972
  if (this.tilesMap.has(t))
1424
- return _.utils.warn(`${t} already loaded`), this.tilesMap.get(t);
1425
- const { ssp: r } = this, i = new q(r, {
1973
+ return ee.utils.warn(`${t} already loaded`), this.tilesMap.get(t);
1974
+ const { ssp: s } = this, r = new nt(s, {
1426
1975
  ...e,
1427
1976
  _managedByPlugin: !0
1428
- }), { tiles: s } = i;
1429
- this._lruCache === null ? this._lruCache = s.lruCache : s.lruCache = this._lruCache, this._parseQueue === null ? this._parseQueue = s.parseQueue : s.parseQueue = this._parseQueue, this._downloadQueue === null ? this._downloadQueue = s.downloadQueue : s.downloadQueue = this._downloadQueue, s.lruCache.maxSize = 600, s.lruCache.minSize = 300, s.lruCache.unloadPercent = 0.8, this.tilesMap.set(t, i), s.setCamera(this._tilesCamera), s.setResolutionFromRenderer(this._tilesCamera, r.viewport.renderer), r.addObject(s.group);
1430
- const l = () => {
1431
- this.cameraTransitionStart || (this.needsUpdate = !0, r.render());
1977
+ }), { tiles: a } = r;
1978
+ this._lruCache === null ? this._lruCache = a.lruCache : a.lruCache = this._lruCache, this._parseQueue === null ? this._parseQueue = a.parseQueue : a.parseQueue = this._parseQueue, this._downloadQueue === null ? this._downloadQueue = a.downloadQueue : a.downloadQueue = this._downloadQueue, a.lruCache.maxSize = 600, a.lruCache.minSize = 300, a.lruCache.unloadPercent = 0.8, this.tilesMap.set(t, r), a.setCamera(this._tilesCamera), a.setResolutionFromRenderer(this._tilesCamera, s.viewport.renderer), s.addObject(a.group);
1979
+ const n = () => {
1980
+ this.cameraTransitionStart || (this.needsUpdate = !0, s.render());
1432
1981
  };
1433
- return s.addEventListener("load-model", l), new Promise((o) => {
1434
- s.addEventListener("load-tile-set", () => {
1435
- l(), o(i);
1982
+ return a.addEventListener("load-model", n), new Promise((o) => {
1983
+ a.addEventListener("load-tile-set", () => {
1984
+ n(), o(r);
1436
1985
  });
1437
1986
  });
1438
1987
  }
@@ -1465,9 +2014,9 @@ class oe {
1465
2014
  e.tiles.dispose(), this.ssp.removeObject(e.tiles.group);
1466
2015
  }), this.tilesMap.clear();
1467
2016
  }
1468
- invalidate(e, t, r) {
1469
- this.tilesMap.forEach((i) => {
1470
- i.invalidate(e, t, r);
2017
+ invalidate(e, t, s) {
2018
+ this.tilesMap.forEach((r) => {
2019
+ r.invalidate(e, t, s);
1471
2020
  });
1472
2021
  }
1473
2022
  /**
@@ -1478,14 +2027,24 @@ class oe {
1478
2027
  }
1479
2028
  }
1480
2029
  export {
1481
- ne as ArcgisTilesRenderer,
1482
- h as MaterialType,
1483
- B as OverlayManager,
1484
- a as OverlayType,
1485
- le as TerrainTilesRenderer,
1486
- g as TerrainType,
1487
- H as TileCustomMaterialPlugin,
1488
- q as TilesRenderer,
1489
- oe as TilesRendererManager,
1490
- se as default
2030
+ mt as ArcgisTilesRenderer,
2031
+ Ve as GisPlotArrow,
2032
+ S as GisPlotBase,
2033
+ et as GisPlotCircle,
2034
+ Qe as GisPlotLine,
2035
+ We as GisPlotPoint,
2036
+ je as GisPlotPolygon,
2037
+ He as GisPlotRectangle,
2038
+ Be as GisPlotSector,
2039
+ Ke as GisPlotText,
2040
+ tt as GroundDecalManager,
2041
+ b as MaterialType,
2042
+ Ae as OverlayManager,
2043
+ l as OverlayType,
2044
+ yt as TerrainTilesRenderer,
2045
+ U as TerrainType,
2046
+ Ne as TileCustomMaterialPlugin,
2047
+ nt as TilesRenderer,
2048
+ ft as TilesRendererManager,
2049
+ gt as default
1491
2050
  };