@soonspacejs/plugin-tiles 2.15.7 → 2.15.9

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,23 +1,25 @@
1
- import z from "soonspacejs";
2
- import { TilesRenderer as L } from "um-3d-tiles-renderer";
3
- import { GLTFLoader as me } from "three/examples/jsm/loaders/GLTFLoader.js";
4
- import { MathUtils as S, MeshBasicMaterial as ve, Color as q, Vector3 as Pe, Box3 as Ce, Sphere as _e, MeshStandardMaterial as Ie, ShaderMaterial as ge, Matrix4 as U } from "three";
5
- import { TilesFadePlugin as ie, UpdateOnChangePlugin as ae, QuantizedMeshPlugin as ee, ImageOverlayPlugin as Oe, XYZTilesOverlay as Me, ReorientationPlugin as ne, StyledGeoJSONOverlay as pe, CesiumIonOverlay as be, TMSTilesOverlay as Re, UrlTemplateTilesOverlay as Ee, WMSTilesOverlay as ke, WMTSCapabilitiesLoader as Le, WMTSTilesOverlay as xe, CesiumIonAuthPlugin as Se, PlotSdfPlugin as Ne } from "um-3d-tiles-renderer/plugins";
6
- class Fe {
1
+ import R from "soonspacejs";
2
+ import { TilesRenderer as x } from "um-3d-tiles-renderer";
3
+ import { GLTFLoader as ae } from "three/examples/jsm/loaders/GLTFLoader.js";
4
+ import { MathUtils as f, MeshBasicMaterial as oe, Color as L, PerspectiveCamera as q, Matrix4 as P, Vector3 as me, Box3 as ve, Sphere as le, MeshStandardMaterial as _e, ShaderMaterial as V } from "three";
5
+ import { TilesFadePlugin as z, UpdateOnChangePlugin as B, QuantizedMeshPlugin as U, ImageOverlayPlugin as de, XYZTilesOverlay as he, ReorientationPlugin as j, StyledGeoJSONOverlay as Z, CesiumIonOverlay as Oe, TMSTilesOverlay as Me, UrlTemplateTilesOverlay as Se, WMSTilesOverlay as we, WMTSCapabilitiesLoader as Ce, WMTSTilesOverlay as be, CesiumIonAuthPlugin as ue } from "um-3d-tiles-renderer/plugins";
6
+ import { CesiumGroundTextPrimitive as E, CesiumGroundPolylinePrimitive as I, CesiumGroundPolygonPrimitive as K, CesiumGroundCirclePrimitive as ee, CesiumGroundPointPrimitive as Te, initializeApproximateTerrainHeights as Pe, updateTerrainLogDepthUniforms as xe, CesiumGlobeDepth as ke, CESIUM_GROUND_NON_PICKABLE_LAYER as Ee } from "cesium-to-three/ground";
7
+ import { createFineArrow as W, createCurvedArrow as ce, createSwallowtailAttackArrow as pe, createAttackArrow as ge, createAssaultDirectionArrow as fe } from "cesium-to-three/arrow";
8
+ class Ie {
7
9
  constructor(e) {
8
10
  this.parser = e, this.name = "KHR_texture_basisu_patch";
9
11
  }
10
12
  loadTexture(e) {
11
- const t = this.parser, r = t.json, a = r.textures[e].source, n = r.images[a];
12
- if (!n || n.mimeType !== "image/ktx2")
13
+ const t = this.parser, r = t.json, n = r.textures[e].source, a = r.images[n];
14
+ if (!a || a.mimeType !== "image/ktx2")
13
15
  return null;
14
16
  const o = t.options.ktx2Loader;
15
17
  if (!o)
16
- throw new Error(`${z.utils.consoleSspTitle}请使用 setModelKtx2DecoderPath 设置 ktx2 解压库路径`);
17
- return t.loadTextureImage(e, a, o);
18
+ throw new Error(`${R.utils.consoleSspTitle}请使用 setModelKtx2DecoderPath 设置 ktx2 解压库路径`);
19
+ return t.loadTextureImage(e, n, o);
18
20
  }
19
21
  }
20
- class pt {
22
+ class _t {
21
23
  constructor(e) {
22
24
  this.ssp = e;
23
25
  const { controls: t, viewport: r } = e;
@@ -26,12 +28,12 @@ class pt {
26
28
  }), t.addEventListener("rest", () => {
27
29
  this.cameraTransitionStart = !1, this.needsUpdate = !0, r.state.useFreq = 60;
28
30
  }), e.signals.beforeRender.add(() => {
29
- this.needsUpdate && (this.needsUpdate = !1, e.viewport.camera.updateMatrixWorld(), this.tilesMap.forEach((s) => {
30
- s.group.updateMatrixWorld(), s.update();
31
+ this.needsUpdate && (this.needsUpdate = !1, e.viewport.camera.updateMatrixWorld(), this.tilesMap.forEach((i) => {
32
+ i.group.updateMatrixWorld(), i.update();
31
33
  }));
32
34
  }), e.signals.cameraObjectChange.add(() => {
33
- this.tilesMap.forEach((s) => {
34
- s.deleteCamera(this._tilesCamera), s.setCamera(e.viewport.camera), s.setResolutionFromRenderer(e.viewport.camera, e.viewport.renderer);
35
+ this.tilesMap.forEach((i) => {
36
+ i.deleteCamera(this._tilesCamera), i.setCamera(e.viewport.camera), i.setResolutionFromRenderer(e.viewport.camera, e.viewport.renderer);
35
37
  }), this._tilesCamera = e.viewport.camera;
36
38
  });
37
39
  }
@@ -44,21 +46,21 @@ class pt {
44
46
  downloadQueue = null;
45
47
  async loadTiles(e) {
46
48
  if (this.tilesMap.has(e)) {
47
- z.utils.warn(`${e} already loaded`);
49
+ R.utils.warn(`${e} already loaded`);
48
50
  return;
49
51
  }
50
- const { ssp: t, ssp: { viewport: r } } = this, s = new L(e);
51
- 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;
52
- const a = new me(s.manager);
53
- a.register((h) => new Fe(h));
54
- const { dracoLoader: n, ktx2Loader: o, meshoptDecoder: d } = t.manager.store.modelManager.gltfLoader;
55
- n && a.setDRACOLoader(n), o && a.setKTX2Loader(o), d && a.setMeshoptDecoder(d), s.manager.addHandler(/\.gltf$/, a), this.tilesMap.set(e, s), s.setCamera(this._tilesCamera), s.setResolutionFromRenderer(this._tilesCamera, r.renderer), s.lruCache.maxSize = 600, s.lruCache.minSize = 300, s.lruCache.unloadPercent = 0.8, t.addObject(s.group);
56
- const u = () => {
52
+ const { ssp: t, ssp: { viewport: r } } = this, i = new x(e);
53
+ 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;
54
+ const n = new ae(i.manager);
55
+ n.register((h) => new Ie(h));
56
+ const { dracoLoader: a, ktx2Loader: o, meshoptDecoder: d } = t.manager.store.modelManager.gltfLoader;
57
+ a && n.setDRACOLoader(a), o && n.setKTX2Loader(o), d && n.setMeshoptDecoder(d), i.manager.addHandler(/\.gltf$/, n), 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);
58
+ const l = () => {
57
59
  this.cameraTransitionStart || (this.needsUpdate = !0, t.render());
58
60
  };
59
- return s.addEventListener("load-model", u), new Promise((h) => {
60
- s.addEventListener("load-tile-set", () => {
61
- u(), h(s);
61
+ return i.addEventListener("load-model", l), new Promise((h) => {
62
+ i.addEventListener("load-tile-set", () => {
63
+ l(), h(i);
62
64
  });
63
65
  });
64
66
  }
@@ -67,31 +69,31 @@ class pt {
67
69
  return t ? (t.dispose(), this.tilesMap.delete(e), this.ssp.removeObject(t.group), !0) : !1;
68
70
  }
69
71
  }
70
- let Ge = class {
72
+ let Re = class {
71
73
  priority = -999;
72
74
  processTileModel(e) {
73
75
  e.traverse((t) => {
74
- t.material && (t.material = new ve());
76
+ t.material && (t.material = new oe());
75
77
  });
76
78
  }
77
79
  };
78
- const De = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/";
79
- class ft {
80
+ const Ne = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/";
81
+ class Mt {
80
82
  constructor(e) {
81
- this.ssp = e, this.tiles = new L(De), this.tiles.fetchData = async (t, r) => {
83
+ this.ssp = e, this.tiles = new x(Ne), this.tiles.fetchData = async (t, r) => {
82
84
  if (/layer\.json$/.test(t)) {
83
- const s = await fetch(t, r).then((a) => a.json());
84
- return s.metadataAvailability = -1, new Response(JSON.stringify(s));
85
+ const i = await fetch(t, r).then((n) => n.json());
86
+ return i.metadataAvailability = -1, new Response(JSON.stringify(i));
85
87
  }
86
88
  return fetch(t, r);
87
- }, this.tilesFadePlugin = new ie({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new ae(), this.quantizedPlugin = new ee({}), this.customMaterialPlugin = new Ge(), this.imageOverlayPlugin = new Oe({
89
+ }, this.tilesFadePlugin = new z({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new B(), this.quantizedPlugin = new U({}), this.customMaterialPlugin = new Re(), this.imageOverlayPlugin = new de({
88
90
  renderer: e.viewport.renderer,
89
91
  overlays: [
90
- new Me({
92
+ new he({
91
93
  url: "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
92
94
  })
93
95
  ]
94
- }), this.reorientationPlugin = new ne({
96
+ }), this.reorientationPlugin = new j({
95
97
  lon: 120,
96
98
  lat: 30,
97
99
  height: 0.1
@@ -121,17 +123,17 @@ class ft {
121
123
  this.ssp.removeObject(this.tiles.group), this.ssp.signals.beforeRender.remove(this.beforeRenderHandler);
122
124
  }
123
125
  invalidate(e, t, r) {
124
- const s = () => {
125
- const n = S.degToRad(t), o = S.degToRad(e);
126
+ const i = () => {
127
+ const a = f.degToRad(t), o = f.degToRad(e);
126
128
  this.reorientationPlugin.transformLatLonHeightToOrigin(
127
- n,
129
+ a,
128
130
  o,
129
131
  r
130
- ), this.ssp.render(), a();
131
- }, a = () => {
132
- this.tiles.removeEventListener("load-root-tileset", s), this.loedTilesSets.delete(s);
132
+ ), this.ssp.render(), n();
133
+ }, n = () => {
134
+ this.tiles.removeEventListener("load-root-tileset", i), this.loedTilesSets.delete(i);
133
135
  };
134
- return this.tiles.addEventListener("load-root-tileset", s), this.loedTilesSets.add(s), this.tiles.root && s(), a;
136
+ return this.tiles.addEventListener("load-root-tileset", i), this.loedTilesSets.add(i), this.tiles.root && i(), n;
135
137
  }
136
138
  dispose() {
137
139
  this.disable(), this.loedTilesSets.forEach(
@@ -150,7 +152,7 @@ class Ae {
150
152
  */
151
153
  processTileModel(e) {
152
154
  e.traverse((t) => {
153
- t.material && (t.material = new ve());
155
+ t.material && (t.material = new oe());
154
156
  });
155
157
  }
156
158
  /**
@@ -182,8 +184,8 @@ class Ae {
182
184
  e.needsUpdate = !0;
183
185
  }
184
186
  }
185
- 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 || {}), I = /* @__PURE__ */ ((i) => (i.QUANTIZED_MESH = "quantizedMesh", i.CESIUM_ION = "cesiumIon", i))(I || {});
186
- class Q {
187
+ var u = /* @__PURE__ */ ((s) => (s.GEOJSON = "geojson", s.CESIUM_ION = "cesiumIon", s.TMS = "tms", s.XYZ = "xyz", s.WMS = "wms", s.WMTS = "wmts", s.URL_TEMPLATE = "urlTemplate", s.PLOT = "plot", s))(u || {}), w = /* @__PURE__ */ ((s) => (s.QUANTIZED_MESH = "quantizedMesh", s.CESIUM_ION = "cesiumIon", s))(w || {});
188
+ class N {
187
189
  constructor(e, t) {
188
190
  this.imageOverlayPlugin = e, this.resourceManager = t;
189
191
  }
@@ -195,7 +197,7 @@ class Q {
195
197
  addGeoJSONOverlay(e) {
196
198
  const t = this._getImageOverlayPluginForAdd(e.id);
197
199
  if (!t) return null;
198
- const r = e.mode ?? "overlay", s = {
200
+ const r = e.mode ?? "overlay", i = {
199
201
  url: e.url,
200
202
  geojson: e.geojson,
201
203
  opacity: e.opacity ?? 1,
@@ -207,88 +209,88 @@ class Q {
207
209
  defaultStyle: this._buildGeoJSONDefaultStyle(e, r),
208
210
  ...this._getGeoJSONModeFlags(r)
209
211
  };
210
- e.color !== void 0 && (s.color = new q(e.color));
211
- const a = new pe(s);
212
- return t.addOverlay(a, e.order), this._instances.set(e.id, {
212
+ e.color !== void 0 && (i.color = new L(e.color));
213
+ const n = new Z(i);
214
+ return t.addOverlay(n, e.order), this._instances.set(e.id, {
213
215
  id: e.id,
214
216
  type: e.type,
215
- instance: a,
217
+ instance: n,
216
218
  options: { ...e, mode: r }
217
219
  }), this.resourceManager?.addOverlay({
218
220
  id: e.id,
219
221
  type: e.type,
220
222
  options: e
221
- }), a;
223
+ }), n;
222
224
  }
223
225
  updateGeoJSONColor(e, t) {
224
226
  const r = this._instances.get(e);
225
- if (!r || r.type !== l.GEOJSON) return !1;
226
- const s = r.instance;
227
- return s.color.set(t), s.requestUpdate?.(), this._updateOverlayOptions(e, { color: t }), !0;
227
+ if (!r || r.type !== u.GEOJSON) return !1;
228
+ const i = r.instance;
229
+ return i.color.set(t), i.requestUpdate?.(), this._updateOverlayOptions(e, { color: t }), !0;
228
230
  }
229
231
  updateGeoJSONDefaultStyle(e, t) {
230
232
  const r = this._instances.get(e);
231
- if (!r || r.type !== l.GEOJSON) return !1;
232
- const s = r.instance, a = r.options, n = {
233
- ...a.defaultStyle || {},
233
+ if (!r || r.type !== u.GEOJSON) return !1;
234
+ const i = r.instance, n = r.options, a = {
235
+ ...n.defaultStyle || {},
234
236
  ...t
235
237
  }, o = {
236
- ...a,
237
- defaultStyle: n
238
+ ...n,
239
+ defaultStyle: a
238
240
  };
239
- return s.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { defaultStyle: n }), !0;
241
+ return i.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { defaultStyle: a }), !0;
240
242
  }
241
243
  updateGeoJSONStrokeStyle(e, t) {
242
244
  const r = this._instances.get(e);
243
- if (!r || r.type !== l.GEOJSON) return !1;
244
- const s = r.instance, a = r.options, n = {
245
- ...a.defaultStyle || {},
245
+ if (!r || r.type !== u.GEOJSON) return !1;
246
+ const i = r.instance, n = r.options, a = {
247
+ ...n.defaultStyle || {},
246
248
  strokeStyle: t
247
249
  }, o = {
248
- ...a,
250
+ ...n,
249
251
  strokeStyle: t,
250
- defaultStyle: n
252
+ defaultStyle: a
251
253
  };
252
- return s.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { strokeStyle: t, defaultStyle: n }), !0;
254
+ return i.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { strokeStyle: t, defaultStyle: a }), !0;
253
255
  }
254
256
  updateGeoJSONStrokeWidth(e, t) {
255
257
  const r = this._instances.get(e);
256
- if (!r || r.type !== l.GEOJSON) return !1;
257
- const s = r.instance, a = r.options, n = {
258
- ...a.defaultStyle || {},
258
+ if (!r || r.type !== u.GEOJSON) return !1;
259
+ const i = r.instance, n = r.options, a = {
260
+ ...n.defaultStyle || {},
259
261
  strokeWidth: t
260
262
  }, o = {
261
- ...a,
263
+ ...n,
262
264
  strokeWidth: t,
263
- defaultStyle: n
265
+ defaultStyle: a
264
266
  };
265
- return s.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { strokeWidth: t, defaultStyle: n }), !0;
267
+ return i.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { strokeWidth: t, defaultStyle: a }), !0;
266
268
  }
267
269
  updateGeoJSONFillStyle(e, t) {
268
270
  const r = this._instances.get(e);
269
- if (!r || r.type !== l.GEOJSON) return !1;
270
- const s = r.instance, a = r.options, n = {
271
- ...a.defaultStyle || {},
271
+ if (!r || r.type !== u.GEOJSON) return !1;
272
+ const i = r.instance, n = r.options, a = {
273
+ ...n.defaultStyle || {},
272
274
  fillStyle: t
273
275
  }, o = {
274
- ...a,
276
+ ...n,
275
277
  fillStyle: t,
276
- defaultStyle: n
278
+ defaultStyle: a
277
279
  };
278
- return s.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { fillStyle: t, defaultStyle: n }), !0;
280
+ return i.defaultStyle = this._buildGeoJSONDefaultStyle(o, o.mode ?? "overlay"), this._updateOverlayOptions(e, { fillStyle: t, defaultStyle: a }), !0;
279
281
  }
280
282
  updateGeoJSONMode(e, t) {
281
283
  const r = this._instances.get(e);
282
- if (!r || r.type !== l.GEOJSON) return !1;
283
- const s = r.instance, a = {
284
+ if (!r || r.type !== u.GEOJSON) return !1;
285
+ const i = r.instance, n = {
284
286
  ...r.options,
285
287
  mode: t
286
- }, n = this._getGeoJSONModeFlags(t);
287
- return s.alphaInvert = n.alphaInvert, s.alphaMask = n.alphaMask, s.defaultStyle = this._buildGeoJSONDefaultStyle(a, t), s.requestUpdate?.(), this._updateOverlayOptions(e, { mode: t }), !0;
288
+ }, a = this._getGeoJSONModeFlags(t);
289
+ return i.alphaInvert = a.alphaInvert, i.alphaMask = a.alphaMask, i.defaultStyle = this._buildGeoJSONDefaultStyle(n, t), i.requestUpdate?.(), this._updateOverlayOptions(e, { mode: t }), !0;
288
290
  }
289
291
  setGeoJSON(e, t) {
290
292
  const r = this._instances.get(e);
291
- return !r || r.type !== l.GEOJSON ? !1 : (r.instance.setGeoJSON(t), this._updateOverlayOptions(e, { geojson: t }), !0);
293
+ return !r || r.type !== u.GEOJSON ? !1 : (r.instance.setGeoJSON(t), this._updateOverlayOptions(e, { geojson: t }), !0);
292
294
  }
293
295
  normalizeGeoJSON(e) {
294
296
  return this._getGeoJSONUtilityOverlay().normalizeGeoJSON(e);
@@ -297,26 +299,26 @@ class Q {
297
299
  return this._getGeoJSONUtilityOverlay().mergeGeoJSON(e);
298
300
  }
299
301
  setMergedGeoJSON(e, t, r) {
300
- const s = this._instances.get(e);
301
- if (!s || s.type !== l.GEOJSON) return null;
302
- const n = s.instance.setMergedGeoJSON(t, r);
303
- return this._updateOverlayOptions(e, { geojson: n }), n;
302
+ const i = this._instances.get(e);
303
+ if (!i || i.type !== u.GEOJSON) return null;
304
+ const a = i.instance.setMergedGeoJSON(t, r);
305
+ return this._updateOverlayOptions(e, { geojson: a }), a;
304
306
  }
305
307
  getGeoJSONFeatureById(e, t) {
306
308
  const r = this._instances.get(e);
307
- return !r || r.type !== l.GEOJSON ? null : r.instance.getFeatureById(t);
309
+ return !r || r.type !== u.GEOJSON ? null : r.instance.getFeatureById(t);
308
310
  }
309
311
  updateGeoJSONFeatureStyleById(e, t, r) {
310
- const s = this._instances.get(e);
311
- return !s || s.type !== l.GEOJSON ? !1 : (s.instance.updateFeatureStyleById(
312
+ const i = this._instances.get(e);
313
+ return !i || i.type !== u.GEOJSON ? !1 : (i.instance.updateFeatureStyleById(
312
314
  t,
313
315
  r,
314
316
  { requestUpdate: !0 }
315
317
  ), !0);
316
318
  }
317
319
  updateGeoJSONFeatureStylesByIds(e, t, r) {
318
- const s = this._instances.get(e);
319
- return !s || s.type !== l.GEOJSON ? !1 : (s.instance.updateFeatureStylesByIds(
320
+ const i = this._instances.get(e);
321
+ return !i || i.type !== u.GEOJSON ? !1 : (i.instance.updateFeatureStylesByIds(
320
322
  t,
321
323
  r,
322
324
  { requestUpdate: !0 }
@@ -326,7 +328,7 @@ class Q {
326
328
  addCesiumIonOverlay(e) {
327
329
  const t = this._getImageOverlayPluginForAdd(e.id);
328
330
  if (!t) return null;
329
- const r = new be({
331
+ const r = new Oe({
330
332
  assetId: e.assetId,
331
333
  apiToken: e.apiToken,
332
334
  autoRefreshToken: e.autoRefreshToken ?? !0,
@@ -348,7 +350,7 @@ class Q {
348
350
  addTMSOverlay(e) {
349
351
  const t = this._getImageOverlayPluginForAdd(e.id);
350
352
  if (!t) return null;
351
- const r = new Re({
353
+ const r = new Me({
352
354
  url: e.url,
353
355
  color: typeof e.color == "number" ? e.color : 16777215,
354
356
  opacity: e.opacity ?? 1
@@ -368,7 +370,7 @@ class Q {
368
370
  addXYZOverlay(e) {
369
371
  const t = this._getImageOverlayPluginForAdd(e.id);
370
372
  if (!t) return null;
371
- const r = new Me({
373
+ const r = new he({
372
374
  url: e.url,
373
375
  color: typeof e.color == "number" ? e.color : 16777215,
374
376
  opacity: e.opacity ?? 1
@@ -419,7 +421,7 @@ class Q {
419
421
  addUrlTemplateOverlay(e) {
420
422
  const t = this._getImageOverlayPluginForAdd(e.id);
421
423
  if (!t) return null;
422
- const r = new Ee({
424
+ const r = new Se({
423
425
  url: e.url,
424
426
  subdomains: e.subdomains,
425
427
  levels: e.levels,
@@ -451,56 +453,56 @@ class Q {
451
453
  crs: e.crs || "EPSG:4326",
452
454
  format: e.format || "image/png",
453
455
  tileDimension: e.tileDimension || 256
454
- }, s = new ke({
456
+ }, i = new we({
455
457
  url: e.url,
456
458
  layer: r.layer,
457
459
  crs: r.crs,
458
460
  format: r.format,
459
461
  tileDimension: r.tileDimension,
460
462
  styles: r.styles,
461
- color: new q(typeof e.color == "number" ? e.color : 16777215),
463
+ color: new L(typeof e.color == "number" ? e.color : 16777215),
462
464
  opacity: e.opacity ?? 1
463
465
  });
464
- return t.addOverlay(s, e.order), this._instances.set(e.id, {
466
+ return t.addOverlay(i, e.order), this._instances.set(e.id, {
465
467
  id: e.id,
466
468
  type: e.type,
467
- instance: s,
469
+ instance: i,
468
470
  options: { ...e }
469
471
  }), this.resourceManager?.addOverlay({
470
472
  id: e.id,
471
473
  type: e.type,
472
474
  options: e
473
- }), s;
475
+ }), i;
474
476
  }
475
477
  // =============== WMTS ===============
476
478
  async addWMTSOverlay(e) {
477
479
  const t = this._getImageOverlayPluginForAdd(e.id);
478
480
  if (!t) return null;
479
- const r = await new Le().loadAsync(e.url), s = ["EPSG:4326", "EPSG:3857"];
480
- let a = e.layer || "";
481
- r.layers.find((o) => o.identifier === a) || (a = r.layers.find(
482
- (o) => o?.tileMatrixSets?.some((d) => s.includes(d.supportedCRS))
481
+ const r = await new Ce().loadAsync(e.url), i = ["EPSG:4326", "EPSG:3857"];
482
+ let n = e.layer || "";
483
+ r.layers.find((o) => o.identifier === n) || (n = r.layers.find(
484
+ (o) => o?.tileMatrixSets?.some((d) => i.includes(d.supportedCRS))
483
485
  )?.identifier || r.layers[0].identifier);
484
- const n = new xe({
486
+ const a = new be({
485
487
  capabilities: r,
486
- layer: a,
488
+ layer: n,
487
489
  dimensions: e.dimensions || null,
488
490
  style: e.style || void 0,
489
491
  tileMatrixSet: e.tileMatrixSet || null,
490
492
  planar: !1,
491
- color: new q(typeof e.color == "number" ? e.color : 16777215),
493
+ color: new L(typeof e.color == "number" ? e.color : 16777215),
492
494
  opacity: e.opacity ?? 1
493
495
  });
494
- return t.addOverlay(n, e.order), this._instances.set(e.id, {
496
+ return t.addOverlay(a, e.order), this._instances.set(e.id, {
495
497
  id: e.id,
496
498
  type: e.type,
497
- instance: n,
499
+ instance: a,
498
500
  options: { ...e }
499
501
  }), this.resourceManager?.addOverlay({
500
502
  id: e.id,
501
503
  type: e.type,
502
504
  options: e
503
- }), n;
505
+ }), a;
504
506
  }
505
507
  // =============== 通用方法 ===============
506
508
  /**
@@ -509,12 +511,12 @@ class Q {
509
511
  remove(e) {
510
512
  const t = this._instances.get(e);
511
513
  return t ? [
512
- l.XYZ,
513
- l.TMS,
514
- l.WMS,
515
- l.WMTS,
516
- l.CESIUM_ION,
517
- l.URL_TEMPLATE
514
+ u.XYZ,
515
+ u.TMS,
516
+ u.WMS,
517
+ u.WMTS,
518
+ u.CESIUM_ION,
519
+ u.URL_TEMPLATE
518
520
  ].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);
519
521
  }
520
522
  /**
@@ -567,10 +569,10 @@ class Q {
567
569
  const t = this._instances.get(e);
568
570
  if (!t) return !1;
569
571
  const r = this.imageOverlayPlugin.overlayInfo;
570
- let s = 0;
571
- return r.forEach((a) => {
572
- a.order > s && (s = a.order);
573
- }), this.imageOverlayPlugin.setOverlayOrder(t.instance, s + 1), this._updateOverlayOptions(e, { order: s + 1 }), !0;
572
+ let i = 0;
573
+ return r.forEach((n) => {
574
+ n.order > i && (i = n.order);
575
+ }), this.imageOverlayPlugin.setOverlayOrder(t.instance, i + 1), this._updateOverlayOptions(e, { order: i + 1 }), !0;
574
576
  }
575
577
  /**
576
578
  * 将 overlay 移到最底层
@@ -580,10 +582,10 @@ class Q {
580
582
  const t = this._instances.get(e);
581
583
  if (!t) return !1;
582
584
  const r = this.imageOverlayPlugin.overlayInfo;
583
- let s = 1 / 0;
584
- return r.forEach((a) => {
585
- a.order < s && (s = a.order);
586
- }), this.imageOverlayPlugin.setOverlayOrder(t.instance, s - 1), this._updateOverlayOptions(e, { order: s - 1 }), !0;
585
+ let i = 1 / 0;
586
+ return r.forEach((n) => {
587
+ n.order < i && (i = n.order);
588
+ }), this.imageOverlayPlugin.setOverlayOrder(t.instance, i - 1), this._updateOverlayOptions(e, { order: i - 1 }), !0;
587
589
  }
588
590
  // =============== 资源恢复 ===============
589
591
  /**
@@ -601,25 +603,25 @@ class Q {
601
603
  _createOverlayFromResource(e) {
602
604
  const t = this.resourceManager;
603
605
  switch (this.resourceManager = void 0, e.type) {
604
- case l.GEOJSON:
606
+ case u.GEOJSON:
605
607
  this.addGeoJSONOverlay(e.options);
606
608
  break;
607
- case l.CESIUM_ION:
609
+ case u.CESIUM_ION:
608
610
  this.addCesiumIonOverlay(e.options);
609
611
  break;
610
- case l.TMS:
612
+ case u.TMS:
611
613
  this.addTMSOverlay(e.options);
612
614
  break;
613
- case l.XYZ:
615
+ case u.XYZ:
614
616
  this.addXYZOverlay(e.options);
615
617
  break;
616
- case l.WMS:
618
+ case u.WMS:
617
619
  this.addWMSOverlay(e.options);
618
620
  break;
619
- case l.WMTS:
621
+ case u.WMTS:
620
622
  this.addWMTSOverlay(e.options);
621
623
  break;
622
- case l.URL_TEMPLATE:
624
+ case u.URL_TEMPLATE:
623
625
  this.addUrlTemplateOverlay(e.options);
624
626
  break;
625
627
  }
@@ -666,7 +668,7 @@ class Q {
666
668
  };
667
669
  }
668
670
  _getGeoJSONUtilityOverlay() {
669
- return this._geoJSONUtilityOverlay || (this._geoJSONUtilityOverlay = new pe({})), this._geoJSONUtilityOverlay;
671
+ return this._geoJSONUtilityOverlay || (this._geoJSONUtilityOverlay = new Z({})), this._geoJSONUtilityOverlay;
670
672
  }
671
673
  _updateOverlayOptions(e, t) {
672
674
  const r = this._instances.get(e);
@@ -676,7 +678,7 @@ class Q {
676
678
  }), this.resourceManager?.updateOverlay(e, t);
677
679
  }
678
680
  _getImageOverlayPluginForAdd(e) {
679
- return this.imageOverlayPlugin ? this._instances.has(e) ? (console.warn(`OverlayManager: Overlay "${e}" already exists`), null) : this._instances.size >= Q.MAX_OVERLAY_INSTANCES ? (console.error(`OverlayManager: Cannot add overlay "${e}" because the maximum number of overlays is ${Q.MAX_OVERLAY_INSTANCES}`), null) : this.imageOverlayPlugin : null;
681
+ return this.imageOverlayPlugin ? this._instances.has(e) ? (console.warn(`OverlayManager: Overlay "${e}" already exists`), null) : this._instances.size >= N.MAX_OVERLAY_INSTANCES ? (console.error(`OverlayManager: Cannot add overlay "${e}" because the maximum number of overlays is ${N.MAX_OVERLAY_INSTANCES}`), null) : this.imageOverlayPlugin : null;
680
682
  }
681
683
  /**
682
684
  * 获取本地影像数量(不依赖 ResourceManager)
@@ -684,7 +686,7 @@ class Q {
684
686
  _getLocalImageryCount() {
685
687
  let e = 0;
686
688
  return this._instances.forEach((t) => {
687
- [l.XYZ, l.TMS, l.WMS, l.WMTS, l.CESIUM_ION, l.URL_TEMPLATE].includes(t.type) && e++;
689
+ [u.XYZ, u.TMS, u.WMS, u.WMTS, u.CESIUM_ION, u.URL_TEMPLATE].includes(t.type) && e++;
688
690
  }), e;
689
691
  }
690
692
  /**
@@ -702,7 +704,7 @@ class Q {
702
704
  this.disposeInstances(), this.resourceManager?.clear();
703
705
  }
704
706
  }
705
- class Je {
707
+ class Le {
706
708
  /** Overlay 资源配置 */
707
709
  _overlays = /* @__PURE__ */ new Map();
708
710
  // =============== Overlay 资源管理 ===============
@@ -760,7 +762,7 @@ class Je {
760
762
  getImageryOverlayCount() {
761
763
  let e = 0;
762
764
  return this._overlays.forEach((t) => {
763
- (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++;
765
+ (t.type === u.XYZ || t.type === u.TMS || t.type === u.WMS || t.type === u.WMTS || t.type === u.CESIUM_ION || t.type === u.URL_TEMPLATE) && e++;
764
766
  }), e;
765
767
  }
766
768
  /**
@@ -792,7 +794,7 @@ class Je {
792
794
  e.overlays && (this._overlays.clear(), e.overlays.forEach((t) => this._overlays.set(t.id, { ...t })));
793
795
  }
794
796
  }
795
- class Ue {
797
+ class De {
796
798
  /** 地形配置映射表 */
797
799
  _terrains = /* @__PURE__ */ new Map();
798
800
  /** 当前激活的地形 ID */
@@ -881,409 +883,648 @@ class Ue {
881
883
  this.clear();
882
884
  }
883
885
  }
884
- let We = 1;
885
- class C {
886
+ let Ge = 1;
887
+ class _ {
888
+ /** 自增字符串 id('1' / '2' / '3' ...) */
886
889
  id;
890
+ /**
891
+ * 类别。基类构造为空串,子类用 `readonly category = 'xxx' as const` 覆写。
892
+ * 桥接器据此 switch 分支。
893
+ */
887
894
  category = "";
895
+ /**
896
+ * 标绘选项。基类持 GisPlotBaseOptions,子类用 `declare options: 具体Options`
897
+ * 收窄类型提示。
898
+ */
888
899
  options;
889
900
  constructor(e) {
890
- this.id = String(We++), this.category = "", this.options = { ...e }, this.options.points && (this.options.points = this.options.points.map((t) => [t[0], t[1]]));
901
+ this.id = String(Ge++), this.category = "", this.options = { ...e }, this.options.points && (this.options.points = this.options.points.map(
902
+ (t) => [t[0], t[1]]
903
+ ));
891
904
  }
892
905
  /**
893
- * 合并更新 `options`(不可变风格:整表替换为新对象)。
894
- * 子类应覆盖为 `Partial<具体Options>`,以便类型提示包含各类型专有字段。
906
+ * 不可变整表替换:用展开 + patch 重建 options。
907
+ * 子类覆写此方法仅为收窄 patch 的类型提示,方法体相同。
895
908
  */
896
909
  update(e) {
897
910
  this.options = { ...this.options, ...e };
898
911
  }
899
912
  /**
900
- * 浅拷贝快照:`options` 为一层展开新对象,`points` 与内部仍为同一数组引用。
901
- * {@link GroundDecalManager.getItem} 默认使用此方法。
913
+ * 浅快照:options 是新对象(展开一层),但 options.points 与内部共享引用。
914
+ * 管理器 getItem 默认走这里。
902
915
  */
903
916
  getSnapshot() {
904
- return { type: this.category, options: { ...this.options } };
917
+ return {
918
+ type: this.category,
919
+ options: { ...this.options }
920
+ };
905
921
  }
906
922
  /**
907
- * 深拷贝快照:`points` 中每个顶点为新数组,修改返回值不会影响标绘内部状态。
908
- * 需独立副本时请用 {@link GroundDecalManager.getItemDeep} 或本方法。
923
+ * 深快照:points 每个顶点都是新数组 → 改返回值不影响内部。
924
+ * 管理器 getItemDeep 走这里。
909
925
  */
910
926
  getSnapshotDeep() {
911
927
  const e = { ...this.options };
912
- return e.points && (e.points = e.points.map((t) => [...t])), { type: this.category, options: e };
928
+ return e.points && (e.points = e.points.map((t) => [...t])), {
929
+ type: this.category,
930
+ options: e
931
+ };
913
932
  }
914
- /** 用于计算 ENU 参考中心的坐标点 */
933
+ /**
934
+ * 基类默认:返回全部顶点。上层用来算 ENU 参考中心。
935
+ * 子类(point / text / circle / sector 等)可覆写为更紧的语义。
936
+ */
915
937
  getCenterPoints() {
916
938
  return this.options.points || [];
917
939
  }
918
- /** 用于计算最大空间范围的坐标点(子类可覆盖以扩展半径等) */
940
+ /**
941
+ * 基类默认:返回全部顶点。上层用来算最大空间范围。
942
+ * circle / sector 子类覆写为按半径外扩的经纬度包围盒。
943
+ */
919
944
  getExtentPoints() {
920
945
  return this.options.points || [];
921
946
  }
922
947
  }
923
- class Be extends C {
948
+ class Fe extends _ {
924
949
  category = "point";
925
950
  constructor(e) {
926
951
  super(e);
927
952
  }
953
+ /** 类型收窄:patch 限定为 PlotPointOptions 的子集 + 任意扩展键 */
928
954
  update(e) {
929
955
  this.options = { ...this.options, ...e };
930
956
  }
957
+ /** 单中心语义:只取 points[0] */
931
958
  getCenterPoints() {
932
959
  const e = this.options.points;
933
960
  return e && e.length > 0 ? [e[0]] : [];
934
961
  }
962
+ /** 范围与中心相同(点无几何外扩) */
935
963
  getExtentPoints() {
936
964
  return this.getCenterPoints();
937
965
  }
938
966
  }
939
- class ze extends C {
967
+ class Je extends _ {
940
968
  category = "line";
941
969
  constructor(e) {
942
970
  super(e);
943
971
  }
972
+ /** 类型收窄:patch 限定为 PlotLineOptions 的子集 + 任意扩展键 */
944
973
  update(e) {
945
974
  this.options = { ...this.options, ...e };
946
975
  }
947
976
  }
948
- class Qe extends C {
977
+ class Ue extends _ {
949
978
  category = "polygon";
950
979
  constructor(e) {
951
980
  super(e);
952
981
  }
982
+ /** 类型收窄:patch 限定为 PlotPolygonOptions 的子集 + 任意扩展键 */
953
983
  update(e) {
954
984
  this.options = { ...this.options, ...e };
955
985
  }
956
986
  }
957
- class je extends C {
987
+ class We extends _ {
958
988
  category = "rectangle";
959
989
  constructor(e) {
960
990
  super(e);
961
991
  }
992
+ /** 类型收窄:patch 限定为 PlotRectangleOptions 的子集 + 任意扩展键 */
962
993
  update(e) {
963
994
  this.options = { ...this.options, ...e };
964
995
  }
965
996
  }
966
- const Te = S.DEG2RAD;
967
- new Pe();
968
- class He extends C {
997
+ const $e = f.DEG2RAD, te = 111320;
998
+ class ze extends _ {
969
999
  category = "sector";
970
1000
  constructor(e) {
971
1001
  super(e);
972
1002
  }
1003
+ /** 类型收窄:patch 限定为 PlotSectorOptions 的子集 + 任意扩展键 */
973
1004
  update(e) {
974
1005
  this.options = { ...this.options, ...e };
975
1006
  }
1007
+ /** 按半径外扩的经纬度包围盒(与 GisPlotCircle 完全一致;不区分扇区角度) */
976
1008
  getExtentPoints() {
977
1009
  const e = this.options.points;
978
1010
  if (!e || e.length === 0) return [];
979
- const t = e[0][0], r = e[0][1], s = this.options.radius || 0, a = s / (111320 * Math.cos(r * Te)), n = s / 111320;
1011
+ const t = e[0][0], r = e[0][1], i = this.options.radius || 0, n = i / (te * Math.cos(r * $e)), a = i / te;
980
1012
  return [
981
- [t - a, r - n],
982
- [t + a, r + n]
1013
+ [t - n, r - a],
1014
+ [t + n, r + a]
983
1015
  ];
984
1016
  }
985
1017
  }
986
- const ye = 100, oe = 1e-4;
987
- function T(i, e) {
988
- return Math.sqrt((i[0] - e[0]) ** 2 + (i[1] - e[1]) ** 2);
989
- }
990
- function le(i) {
991
- let e = 0;
992
- for (let t = 0; t < i.length - 1; t++)
993
- e += T(i[t], i[t + 1]);
994
- return e;
995
- }
996
- function B(i) {
997
- return le(i) ** 0.99;
998
- }
999
- function de(i, e) {
1000
- return [(i[0] + e[0]) / 2, (i[1] + e[1]) / 2];
1001
- }
1002
- function te(i, e) {
1003
- const t = Math.asin(
1004
- Math.abs(e[1] - i[1]) / T(i, e)
1005
- );
1006
- 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;
1007
- }
1008
- function Xe(i, e, t) {
1009
- const r = te(e, i) - te(e, t);
1010
- return r < 0 ? r + Math.PI * 2 : r;
1011
- }
1012
- function we(i, e, t) {
1013
- return (t[1] - i[1]) * (e[0] - i[0]) > (e[1] - i[1]) * (t[0] - i[0]);
1014
- }
1015
- function f(i, e, t, r, s) {
1016
- const a = te(i, e), n = s ? a + t : a - t;
1017
- return [e[0] + r * Math.cos(n), e[1] + r * Math.sin(n)];
1018
- }
1019
- function he(i, e, t) {
1020
- let r = i[0] - e[0], s = i[1] - e[1];
1021
- const a = Math.sqrt(r * r + s * s);
1022
- r /= a, s /= a;
1023
- let n = t[0] - e[0], o = t[1] - e[1];
1024
- const d = Math.sqrt(n * n + o * o);
1025
- return n /= d, o /= d, [r + n, s + o];
1026
- }
1027
- function ue(i, e, t, r) {
1028
- const s = he(e, t, r), a = Math.sqrt(s[0] ** 2 + s[1] ** 2), n = T(e, t), o = T(t, r);
1029
- let d, u;
1030
- if (a > oe) {
1031
- const h = s[0] / a, c = s[1] / a;
1032
- we(e, t, r) ? (d = [t[0] - i * n * c, t[1] + i * n * h], u = [t[0] + i * o * c, t[1] - i * o * h]) : (d = [t[0] + i * n * c, t[1] - i * n * h], u = [t[0] - i * o * c, t[1] + i * o * h]);
1033
- } else
1034
- d = [t[0] + i * (e[0] - t[0]), t[1] + i * (e[1] - t[1])], u = [t[0] + i * (r[0] - t[0]), t[1] + i * (r[1] - t[1])];
1035
- return [d, u];
1036
- }
1037
- function Ye(i, e) {
1038
- const [t, r, s] = [i[0], i[1], i[2]], n = ue(0, t, r, s)[0], o = he(t, r, s);
1039
- if (Math.sqrt(o[0] ** 2 + o[1] ** 2) > oe) {
1040
- const u = de(t, r), h = t[0] - u[0], c = t[1] - u[1], g = 2 / T(t, r), y = -g * c, p = g * h, m = y * y - p * p, _ = 2 * y * p, O = p * p - y * y, w = n[0] - u[0], P = n[1] - u[1];
1041
- return [u[0] + m * w + _ * P, u[1] + _ * w + O * P];
1042
- }
1043
- return [t[0] + e * (r[0] - t[0]), t[1] + e * (r[1] - t[1])];
1044
- }
1045
- function qe(i, e) {
1046
- const t = i.length, [r, s, a] = [i[t - 3], i[t - 2], i[t - 1]], o = ue(0, r, s, a)[1], d = he(r, s, a);
1047
- if (Math.sqrt(d[0] ** 2 + d[1] ** 2) > oe) {
1048
- const h = de(s, a), c = a[0] - h[0], g = a[1] - h[1], y = 2 / T(s, a), p = -y * g, m = y * c, _ = p * p - m * m, O = 2 * p * m, w = m * m - p * p, P = o[0] - h[0], b = o[1] - h[1];
1049
- return [h[0] + _ * P + O * b, h[1] + O * P + w * b];
1050
- }
1051
- return [a[0] + e * (s[0] - a[0]), a[1] + e * (s[1] - a[1])];
1052
- }
1053
- function Ze(i, e) {
1054
- let r = [Ye(e, i)];
1055
- for (let n = 0; n < e.length - 2; n++) {
1056
- const o = ue(i, e[n], e[n + 1], e[n + 2]);
1057
- r = r.concat(o);
1058
- }
1059
- const s = qe(e, i);
1060
- s && r.push(s);
1061
- const a = [];
1062
- for (let n = 0; n < e.length - 1; n++) {
1063
- const o = e[n], d = e[n + 1];
1064
- a.push(o);
1065
- for (let u = 0; u < ye; u++) {
1066
- const h = u / ye, c = 1 - h, g = h * h, y = g * h, p = c * c, m = p * c, _ = r[n * 2], O = r[n * 2 + 1];
1067
- a.push([
1068
- m * o[0] + 3 * p * h * _[0] + 3 * c * g * O[0] + y * d[0],
1069
- m * o[1] + 3 * p * h * _[1] + 3 * c * g * O[1] + y * d[1]
1070
- ]);
1071
- }
1072
- a.push(d);
1073
- }
1074
- return a;
1075
- }
1076
- function Ve(i, e) {
1077
- return i === 0 ? (e - 1) ** 2 / 2 : i === 1 ? (-2 * e ** 2 + 2 * e + 1) / 2 : i === 2 ? e ** 2 / 2 : 0;
1078
- }
1079
- function fe(i) {
1080
- if (i.length <= 2) return i;
1081
- const e = [i[0]], t = i.length - 3;
1082
- for (let r = 0; r <= t; r++)
1083
- for (let s = 0; s <= 1; s += 0.05) {
1084
- let a = 0, n = 0;
1085
- for (let o = 0; o <= 2; o++) {
1086
- const d = Ve(o, s);
1087
- a += d * i[r + o][0], n += d * i[r + o][1];
1088
- }
1089
- e.push([a, n]);
1090
- }
1091
- return e.push(i[i.length - 1]), e;
1092
- }
1093
- function re(i, e) {
1094
- const t = B([i, e]), r = t * 0.1, s = t * 0.2, a = t * 0.25, n = Math.PI / 8.5, o = Math.PI / 13, d = f(e, i, Math.PI / 2, r, !0), u = f(e, i, Math.PI / 2, r, !1), h = f(i, e, n, a, !1), c = f(i, e, n, a, !0), g = f(i, e, o, s, !1), y = f(i, e, o, s, !0);
1095
- return [d, g, h, e, c, y, u, i];
1096
- }
1097
- function se(i, e) {
1098
- if (i.length <= e) return i;
1099
- const t = [i[0]], r = (i.length - 1) / (e - 1);
1100
- for (let s = 1; s < e - 1; s++)
1101
- t.push(i[Math.round(s * r)]);
1102
- return t.push(i[i.length - 1]), t;
1103
- }
1104
- function $e(i) {
1105
- if (i.length === 2)
1106
- return re(i[0], i[1]);
1107
- const e = Ze(0.3, i), t = se(e, 25), r = le(t), s = 0.08, a = 0.12, n = 0.2, o = Math.PI / 8.5, d = Math.PI / 13, u = 0.15, h = r * s, c = r * u, g = [], y = [];
1108
- let p = 0;
1109
- const m = r - c;
1110
- for (let v = 0; v < t.length && (v > 0 && (p += T(t[v - 1], t[v])), !(p > m)); v++) {
1111
- const H = m > 0 ? p / m : 0, F = h * (1 - H * 0.5), G = v > 0 ? t[v - 1] : t[0], W = v < t.length - 1 ? t[v + 1] : t[v], D = W[0] - G[0], R = W[1] - G[1], A = Math.sqrt(D * D + R * R) || 1, J = -R / A, E = D / A;
1112
- g.push([t[v][0] + J * F, t[v][1] + E * F]), y.push([t[v][0] - J * F, t[v][1] - E * F]);
1113
- }
1114
- const _ = t[t.length - 1], O = t[t.length - 2], w = r * a, P = r * n, b = f(O, _, d, w, !1), x = f(O, _, d, w, !0), N = f(O, _, o, P, !1), j = f(O, _, o, P, !0);
1115
- return [...g, b, N, _, j, x, ...y.reverse()];
1116
- }
1117
- function Ke(i) {
1118
- let e = i[0], t = i[1];
1119
- we(i[0], i[1], i[2]) && (e = i[1], t = i[0]);
1120
- const s = [de(e, t), ...i.slice(2)], a = 0.18, n = 0.3, o = 0.85, d = 0.15, u = 0.8;
1121
- let h = B(s), c = h * a;
1122
- const g = s[s.length - 1];
1123
- h = T(g, s[s.length - 2]);
1124
- const y = T(e, t);
1125
- c > y * u && (c = y * u);
1126
- const p = c * n, m = c * d;
1127
- c = Math.min(c, h);
1128
- const _ = c * o, O = f(s[s.length - 2], g, 0, c, !0), w = f(s[s.length - 2], g, 0, _, !0), P = f(g, O, Math.PI / 2, p, !1), b = f(g, O, Math.PI / 2, p, !0), x = f(g, w, Math.PI / 2, m, !1), N = f(g, w, Math.PI / 2, m, !0), j = [x, P, g, b, N], v = y / B(s), H = le(s), G = B(s) * v, W = T(x, N), D = (G - W) / 2;
1129
- let R = 0;
1130
- const A = [], J = [];
1131
- for (let M = 1; M < s.length - 1; M++) {
1132
- const Y = Xe(s[M - 1], s[M], s[M + 1]) / 2;
1133
- R += T(s[M - 1], s[M]);
1134
- const ce = (G / 2 - R / H * D) / Math.sin(Y);
1135
- A.push(f(s[M - 1], s[M], Math.PI - Y, ce, !0)), J.push(f(s[M - 1], s[M], Y, ce, !1));
1136
- }
1137
- let E = [e, ...A, x], X = [t, ...J, N];
1138
- return E = se(fe(E), 25), X = se(fe(X), 25), [...E, ...j, ...X.reverse()];
1139
- }
1140
- class et extends C {
1018
+ class Be extends _ {
1141
1019
  category = "arrow";
1142
- /** `generateCoords()` 填充的闭合多边形顶点 */
1020
+ /** generateCoords() 填充的闭合多边形顶点;初始为空 */
1143
1021
  generatedCoords = [];
1144
1022
  constructor(e) {
1145
1023
  super(e);
1146
1024
  }
1025
+ /** 类型收窄:patch 限定为 PlotArrowOptions 的子集 + 任意扩展键 */
1147
1026
  update(e) {
1148
1027
  this.options = { ...this.options, ...e };
1149
1028
  }
1150
1029
  /**
1151
- * 按 `arrowType` 与控制点生成闭合多边形顶点(供 GroundDecalManager / PlotOverlay 重建几何)。
1030
+ * 根据 arrowType 把控制点转为闭合多边形顶点序列,存入 generatedCoords。
1031
+ * 结果已 CCW 规范化、去除连续重复顶点并 clamp 到 ≤120 顶点,
1032
+ * 可直接喂给 CesiumGroundPolygonPrimitive。
1033
+ *
1034
+ * 边界:
1035
+ * - 控制点 < 2 → generatedCoords = [],返回 []。
1036
+ * - 'fine' / 'assaultDirection' 只用前 2 个控制点。
1037
+ * - 'attack' / 'swallowtailAttack' / 'curved' 用全部控制点。
1038
+ * - 未知 arrowType 退化为 createFineArrow( cp[0], cp[last] )。
1152
1039
  */
1153
1040
  generateCoords() {
1154
1041
  const e = this.options.points;
1155
1042
  if (!e || e.length < 2)
1156
- return this.generatedCoords = [], [];
1157
- const t = this.options.arrowType || "straight";
1158
- return t === "fine" ? this.generatedCoords = re(e[0], e[1]) : t === "curved" ? this.generatedCoords = $e(e) : t === "attack" && e.length >= 3 ? this.generatedCoords = Ke(e) : this.generatedCoords = re(e[0], e[e.length - 1]), this.generatedCoords;
1043
+ return this.generatedCoords = [], this.generatedCoords;
1044
+ switch (this.options.arrowType) {
1045
+ case "fine":
1046
+ this.generatedCoords = W(e[0], e[1]);
1047
+ break;
1048
+ case "assaultDirection":
1049
+ this.generatedCoords = fe(e[0], e[1]);
1050
+ break;
1051
+ case "attack":
1052
+ this.generatedCoords = ge(e);
1053
+ break;
1054
+ case "swallowtailAttack":
1055
+ this.generatedCoords = pe(e);
1056
+ break;
1057
+ case "curved":
1058
+ this.generatedCoords = ce(e);
1059
+ break;
1060
+ default:
1061
+ this.generatedCoords = W(e[0], e[e.length - 1]);
1062
+ break;
1063
+ }
1064
+ return this.generatedCoords;
1159
1065
  }
1160
- /** 浅拷贝:`options`、`generatedCoords` 与内部共享引用(顶点数组仍与 `options.points` 规则一致)。 */
1066
+ /** 浅快照:附带 generatedCoords(每个顶点复制一份,与内部数组解耦) */
1161
1067
  getSnapshot() {
1162
1068
  return {
1163
1069
  type: this.category,
1164
1070
  options: { ...this.options },
1165
- generatedCoords: this.generatedCoords
1071
+ generatedCoords: this.generatedCoords.map(
1072
+ (e) => [e[0], e[1]]
1073
+ )
1166
1074
  };
1167
1075
  }
1168
- /** 深拷贝:`options.points` 与 `generatedCoords` 均为新数组。 */
1076
+ /** 深快照:options.points 与 generatedCoords 各自每个顶点都是新数组 */
1169
1077
  getSnapshotDeep() {
1170
1078
  const e = super.getSnapshotDeep();
1171
1079
  return {
1172
1080
  type: e.type,
1173
1081
  options: e.options,
1174
- generatedCoords: this.generatedCoords.map((t) => [...t])
1082
+ generatedCoords: this.generatedCoords.map(
1083
+ (t) => [t[0], t[1]]
1084
+ )
1175
1085
  };
1176
1086
  }
1177
1087
  }
1178
- class tt extends C {
1088
+ class je extends _ {
1179
1089
  category = "text";
1180
1090
  constructor(e) {
1181
1091
  super(e);
1182
1092
  }
1093
+ /** 类型收窄:patch 限定为 PlotTextOptions 的子集 + 任意扩展键 */
1183
1094
  update(e) {
1184
1095
  this.options = { ...this.options, ...e };
1185
1096
  }
1097
+ /** 单锚点语义:只取 points[0] */
1186
1098
  getCenterPoints() {
1187
1099
  const e = this.options.points;
1188
1100
  return e && e.length > 0 ? [e[0]] : [];
1189
1101
  }
1102
+ /** 范围与中心相同(文本无几何外扩) */
1190
1103
  getExtentPoints() {
1191
1104
  return this.getCenterPoints();
1192
1105
  }
1193
1106
  }
1194
- class rt extends C {
1107
+ const He = f.DEG2RAD, re = 111320;
1108
+ class Qe extends _ {
1195
1109
  category = "circle";
1196
1110
  constructor(e) {
1197
1111
  super(e);
1198
1112
  }
1113
+ /** 类型收窄:patch 限定为 PlotCircleOptions 的子集 + 任意扩展键 */
1199
1114
  update(e) {
1200
1115
  this.options = { ...this.options, ...e };
1201
1116
  }
1117
+ /** 按半径外扩的经纬度包围盒(两点:西南角、东北角) */
1202
1118
  getExtentPoints() {
1203
1119
  const e = this.options.points;
1204
1120
  if (!e || e.length === 0) return [];
1205
- const t = e[0][0], r = e[0][1], s = this.options.radius || 0, a = s / (111320 * Math.cos(r * Te)), n = s / 111320;
1121
+ const t = e[0][0], r = e[0][1], i = this.options.radius || 0, n = i / (re * Math.cos(r * He)), a = i / re;
1206
1122
  return [
1207
- [t - a, r - n],
1208
- [t + a, r + n]
1123
+ [t - n, r - a],
1124
+ [t + n, r + a]
1209
1125
  ];
1210
1126
  }
1211
1127
  }
1212
- class st {
1213
- /** 标绘 id → 实例;与 `PlotOverlay.imageSource.shapes` 共用同一引用 */
1128
+ const Xe = 3, Ye = 1e3;
1129
+ function qe(s) {
1130
+ return Number.isFinite(s) ? Math.max(Math.round(s), 0) : 0;
1131
+ }
1132
+ function Ve(s) {
1133
+ const e = qe(s), t = Ye + e * Xe;
1134
+ if (!Number.isSafeInteger(t))
1135
+ throw new Error("Plot renderOrder exceeded JavaScript safe integer range.");
1136
+ return t;
1137
+ }
1138
+ function ie(s) {
1139
+ return s instanceof I || s instanceof E ? s.group : s.classification.group;
1140
+ }
1141
+ function Ze(s) {
1142
+ const e = s.options, t = JSON.stringify(e.points ?? []);
1143
+ switch (s.category) {
1144
+ case "circle":
1145
+ return `circle|${t}|${e.radius}`;
1146
+ case "sector":
1147
+ return `sector|${t}|${e.radius}|${e.startAngle}|${e.sectorAngle}`;
1148
+ case "point":
1149
+ return `point|${t}|${e.pointStyle}|${e.size}`;
1150
+ case "arrow":
1151
+ return `arrow|${t}|${e.arrowType}`;
1152
+ case "line":
1153
+ return `line|${t}|${e.strokeStyle}|${e.startArrowStyle}|${e.endArrowStyle}`;
1154
+ case "text":
1155
+ return `text|${t}|${e.content}|${e.fontSize}|${e.textAlign}|${e.verticalAlign}|${e.anchorX}|${e.anchorY}|${e.layoutDirection}|${e.rotation}|${e.boxWidth}|${e.boxHeight}|${JSON.stringify(e.padding)}|${e.offsetX}|${e.offsetY}|${e.scale}`;
1156
+ default:
1157
+ return `${s.category}|${t}`;
1158
+ }
1159
+ }
1160
+ function se(s) {
1161
+ const e = Math.max(s * 4, 1), t = Math.max(s * 3, 0.8);
1162
+ return { lengthMeters: e, widthMetersArrow: t };
1163
+ }
1164
+ function Ke(s, e) {
1165
+ const t = s.options;
1166
+ return `${t.strokeColor}|${t.strokeWidth}|${t.strokeOpacity}|${t.fillColor}|${t.fillOpacity}|${e}|${t.fontColor ?? ""}|${t.fontSize ?? ""}`;
1167
+ }
1168
+ class et {
1169
+ /** 标绘 id → 渲染记录 */
1170
+ _entries = /* @__PURE__ */ new Map();
1171
+ /** 由 GroundDecalManager 写入的标绘集合(引用共享) */
1172
+ _shapes = /* @__PURE__ */ new Map();
1173
+ /** 全局不透明度(0..1);写入后下次 redraw 生效 */
1174
+ _opacity = 1;
1175
+ /** 挂载场景 */
1176
+ _scene;
1177
+ /** 已释放标记 */
1178
+ _disposed = !1;
1179
+ constructor(e) {
1180
+ this._scene = e.scene;
1181
+ }
1182
+ // ── 协议 ──
1183
+ /** 接收 GroundDecalManager 交付的 Map */
1184
+ set shapes(e) {
1185
+ this._shapes = e;
1186
+ }
1187
+ /** 当前持有的标绘集合(引用,与 GroundDecalManager._items 同一) */
1188
+ get shapes() {
1189
+ return this._shapes;
1190
+ }
1191
+ /** 全局不透明度,写入时钳到 [0, 1] */
1192
+ set opacity(e) {
1193
+ if (!Number.isFinite(e)) {
1194
+ this._opacity = 1;
1195
+ return;
1196
+ }
1197
+ this._opacity = Math.min(Math.max(e, 0), 1);
1198
+ }
1199
+ get opacity() {
1200
+ return this._opacity;
1201
+ }
1202
+ /**
1203
+ * 把 _shapes 同步成图元集合:删除消失的、新增没有的、几何 / 样式变化的重建,
1204
+ * 仅可见性 / renderOrder 变化的轻量刷新。
1205
+ */
1206
+ redraw() {
1207
+ if (this._disposed) return;
1208
+ for (const [t, r] of this._entries)
1209
+ this._shapes.has(t) || (this._scene.remove(r.group), r.primitive.dispose(), this._entries.delete(t));
1210
+ let e = 0;
1211
+ for (const [t, r] of this._shapes) {
1212
+ const i = Ve(e);
1213
+ e += 1;
1214
+ const n = this._entries.get(t), a = Ze(r), o = Ke(r, this._opacity);
1215
+ if (n !== void 0 && n.signature === a && (this._supportsStyleHotUpdate(n.primitive) || n.styleSignature === o)) {
1216
+ this._refreshLightweight(n, i), n.styleSignature = o;
1217
+ continue;
1218
+ }
1219
+ n !== void 0 && (this._scene.remove(n.group), n.primitive.dispose(), this._entries.delete(t));
1220
+ const d = this._buildPrimitive(r, i);
1221
+ if (d === null) continue;
1222
+ const l = ie(d);
1223
+ l.visible = r.options.visible !== !1, this._scene.add(l);
1224
+ const h = {
1225
+ plot: r,
1226
+ primitive: d,
1227
+ group: l,
1228
+ signature: a,
1229
+ styleSignature: o
1230
+ };
1231
+ this._entries.set(t, h), d instanceof E && this._refreshLightweight(h, i);
1232
+ }
1233
+ }
1234
+ /**
1235
+ * 宿主每帧调用:把 frameState 透传给所有图元(深度 + 视口 + 相机 + pixelRatio)。
1236
+ */
1237
+ update(e) {
1238
+ if (!this._disposed)
1239
+ for (const t of this._entries.values())
1240
+ t.primitive.update(e);
1241
+ }
1242
+ /** 释放全部图元与场景挂载 */
1243
+ dispose() {
1244
+ if (!this._disposed) {
1245
+ for (const e of this._entries.values())
1246
+ this._scene.remove(e.group), e.primitive.dispose();
1247
+ this._entries.clear(), this._disposed = !0;
1248
+ }
1249
+ }
1250
+ // ── 内部:轻量刷新 / 样式热更新支持判定 ──
1251
+ /**
1252
+ * 当前图元是否支持样式热更新(颜色 / 描边等)。
1253
+ * 折线(setColor / setWidth)与文字(setText)支持;面类不支持,需重建。
1254
+ */
1255
+ _supportsStyleHotUpdate(e) {
1256
+ return e instanceof I || e instanceof E;
1257
+ }
1258
+ /**
1259
+ * 几何未变时的轻量刷新:
1260
+ * - 所有图元:group.visible + setRenderOrder。
1261
+ * - 折线:setColor / setWidth / setArrowSizeMeters / setVisible(不重建几何)。
1262
+ * - 文字:setText(内容 + 颜色 + 不透明度)/ setVisible(不重建图元)。
1263
+ */
1264
+ _refreshLightweight(e, t) {
1265
+ if (e.group.visible = e.plot.options.visible !== !1, e.primitive.setRenderOrder?.(t), e.primitive instanceof I) {
1266
+ const r = e.plot.options;
1267
+ e.primitive.setColor(
1268
+ r.strokeColor,
1269
+ (r.strokeOpacity ?? 100) * this._opacity
1270
+ );
1271
+ const i = typeof r.strokeWidth == "number" && r.strokeWidth > 0 ? r.strokeWidth : 5;
1272
+ e.primitive.setWidth(i);
1273
+ const { lengthMeters: n, widthMetersArrow: a } = se(i);
1274
+ e.primitive.setArrowSizeMeters(n, a), e.primitive.setVisible(r.visible !== !1);
1275
+ }
1276
+ if (e.primitive instanceof E) {
1277
+ const r = e.plot.options;
1278
+ e.primitive.setText({
1279
+ content: r.content,
1280
+ fontColor: r.fontColor,
1281
+ fontSize: r.fontSize,
1282
+ fillColor: r.fillColor,
1283
+ fillOpacity: (r.fillOpacity ?? 100) * this._opacity,
1284
+ strokeColor: r.strokeColor,
1285
+ strokeOpacity: (r.strokeOpacity ?? 100) * this._opacity,
1286
+ strokeWidth: r.strokeWidth,
1287
+ textAlign: r.textAlign,
1288
+ verticalAlign: r.verticalAlign,
1289
+ anchorX: r.anchorX,
1290
+ anchorY: r.anchorY,
1291
+ layoutDirection: r.layoutDirection,
1292
+ rotation: r.rotation,
1293
+ boxWidth: r.boxWidth,
1294
+ boxHeight: r.boxHeight,
1295
+ padding: r.padding,
1296
+ showBorder: r.showBorder,
1297
+ offsetEastMeters: r.offsetX,
1298
+ offsetNorthMeters: r.offsetY,
1299
+ metersPerPixel: r.scale
1300
+ }), e.primitive.setVisible(r.visible !== !1), e.group = ie(e.primitive), e.group.visible = r.visible !== !1;
1301
+ }
1302
+ }
1303
+ // ── 内部:按 category 构建图元 ──
1304
+ /**
1305
+ * 按 category 实例化对应 cesium-to-three 图元。统一透传 stroke/fill 颜色与
1306
+ * 0..100 不透明度,并按全局 opacity 折算(在 0..100 口径上乘 this._opacity)。
1307
+ *
1308
+ * @returns 渲染图元;未知类型 / 退化情况返回 null。
1309
+ */
1310
+ _buildPrimitive(e, t) {
1311
+ const r = e.options, i = r.points ?? [], n = this._opacity, a = (r.strokeOpacity ?? 100) * n, o = (r.fillOpacity ?? 100) * n, d = r.visible !== !1;
1312
+ switch (e.category) {
1313
+ case "point": {
1314
+ if (i.length === 0) return null;
1315
+ const l = r;
1316
+ return new Te({
1317
+ position: i[0],
1318
+ shape: l.pointStyle ?? "circle",
1319
+ size: l.size ?? 100,
1320
+ strokeColor: l.strokeColor,
1321
+ strokeWidth: l.strokeWidth ?? 0,
1322
+ strokeOpacity: a,
1323
+ fillColor: l.fillColor,
1324
+ fillOpacity: o,
1325
+ visible: d,
1326
+ renderOrder: t
1327
+ });
1328
+ }
1329
+ case "circle": {
1330
+ if (i.length === 0) return null;
1331
+ const l = r;
1332
+ return new ee({
1333
+ center: i[0],
1334
+ radius: l.radius ?? 100,
1335
+ strokeColor: l.strokeColor,
1336
+ strokeWidth: l.strokeWidth ?? 0,
1337
+ strokeOpacity: a,
1338
+ fillColor: l.fillColor,
1339
+ fillOpacity: o,
1340
+ visible: d,
1341
+ renderOrder: t
1342
+ });
1343
+ }
1344
+ case "sector": {
1345
+ if (i.length === 0) return null;
1346
+ const l = r;
1347
+ return new ee({
1348
+ center: i[0],
1349
+ radius: l.radius ?? 100,
1350
+ strokeColor: l.strokeColor,
1351
+ strokeWidth: l.strokeWidth ?? 0,
1352
+ strokeOpacity: a,
1353
+ fillColor: l.fillColor,
1354
+ fillOpacity: o,
1355
+ visible: d,
1356
+ sectorStartDegrees: l.startAngle ?? 0,
1357
+ sectorAngleDegrees: l.sectorAngle ?? 360,
1358
+ renderOrder: t
1359
+ });
1360
+ }
1361
+ case "polygon":
1362
+ case "rectangle":
1363
+ return i.length < 3 ? null : new K({
1364
+ points: i,
1365
+ strokeColor: r.strokeColor,
1366
+ strokeWidth: r.strokeWidth ?? 0,
1367
+ strokeOpacity: a,
1368
+ fillColor: r.fillColor,
1369
+ fillOpacity: o,
1370
+ visible: d,
1371
+ renderOrder: t
1372
+ });
1373
+ case "arrow": {
1374
+ const l = e.generateCoords();
1375
+ if (l.length < 3) return null;
1376
+ const h = r;
1377
+ return new K({
1378
+ points: l,
1379
+ strokeColor: h.strokeColor,
1380
+ strokeWidth: h.strokeWidth ?? 0,
1381
+ strokeOpacity: a,
1382
+ fillColor: h.fillColor,
1383
+ fillOpacity: o,
1384
+ visible: d,
1385
+ renderOrder: t
1386
+ });
1387
+ }
1388
+ case "line": {
1389
+ if (i.length < 2) return null;
1390
+ const l = r, h = l.startArrowStyle ?? null, c = l.endArrowStyle ?? null, y = h !== null && c !== null ? "both" : c !== null ? "right" : h !== null ? "left" : "none", g = (h ?? c) === "unfilledArrow" ? "open" : "solid", p = l.strokeStyle === "dashed", v = p ? 60 : void 0, C = p ? 40 : void 0, M = typeof l.strokeWidth == "number" && l.strokeWidth > 0 ? l.strokeWidth : 5, { lengthMeters: b, widthMetersArrow: S } = se(M);
1391
+ return new I({
1392
+ points: i,
1393
+ strokeColor: l.strokeColor,
1394
+ strokeOpacity: a,
1395
+ widthMode: "world",
1396
+ widthMeters: M,
1397
+ visible: d,
1398
+ arrowMode: y,
1399
+ arrowStyle: g,
1400
+ arrowWidthMode: "world",
1401
+ arrowLengthMeters: b,
1402
+ arrowWidthMeters: S,
1403
+ dashLengthMeters: v,
1404
+ gapLengthMeters: C,
1405
+ renderOrder: t
1406
+ });
1407
+ }
1408
+ case "text": {
1409
+ if (i.length === 0) return null;
1410
+ const l = r;
1411
+ return new E({
1412
+ points: [i[0]],
1413
+ content: l.content,
1414
+ fontColor: l.fontColor,
1415
+ fontSize: l.fontSize,
1416
+ fillColor: l.fillColor,
1417
+ fillOpacity: o,
1418
+ strokeColor: l.strokeColor,
1419
+ strokeOpacity: a,
1420
+ strokeWidth: l.strokeWidth ?? 0,
1421
+ textAlign: l.textAlign,
1422
+ verticalAlign: l.verticalAlign,
1423
+ anchorX: l.anchorX,
1424
+ anchorY: l.anchorY,
1425
+ layoutDirection: l.layoutDirection,
1426
+ rotation: l.rotation,
1427
+ boxWidth: l.boxWidth,
1428
+ boxHeight: l.boxHeight,
1429
+ padding: l.padding,
1430
+ showBorder: l.showBorder,
1431
+ visible: d,
1432
+ renderOrder: t,
1433
+ // offsetX / offsetY → ENU 米偏移
1434
+ offsetEastMeters: l.offsetX,
1435
+ offsetNorthMeters: l.offsetY,
1436
+ // scale → metersPerPixel(无 scale 时不传,默认 1.0)
1437
+ metersPerPixel: l.scale
1438
+ });
1439
+ }
1440
+ default:
1441
+ return null;
1442
+ }
1443
+ }
1444
+ }
1445
+ class tt {
1446
+ /** 标绘 id → 实例;与桥接器的 shapes 共用同一引用 */
1214
1447
  _items = /* @__PURE__ */ new Map();
1215
- /** 标绘 id */
1448
+ /** 标绘管理器 id(对外常量,保持与参考项目一致) */
1216
1449
  id = "GROUND_DECAL_PLOT";
1217
1450
  /** SoonSpace 实例 */
1218
1451
  ssp;
1219
- /** 传入的 PlotSDFPlugin,用于在有图形时自动注册 overlay */
1220
- _plotSdfPlugin;
1221
- /** overlay 是否已注册到 PlotSDFPlugin */
1452
+ /** 渲染桥接器(顶替参考项目的 PlotSdfPlugin) */
1453
+ _bridge;
1454
+ /** 桥接器是否已收到 shapes 引用 */
1222
1455
  _overlayAttached = !1;
1223
- /** 合并同一帧内多次 `_markDirty`,值为 `requestAnimationFrame` 句柄 */
1456
+ /** 合并同一帧内多次 _markDirty,值为 requestAnimationFrame 句柄 */
1224
1457
  _redrawTimer = null;
1225
1458
  constructor(e) {
1226
- this.ssp = e.ssp;
1459
+ this.ssp = e.ssp, this._bridge = new et({ scene: e.ssp.viewport.scene });
1460
+ }
1461
+ /** 暴露内部桥接器,业务若需自定义场景接入可选择性使用 */
1462
+ get bridge() {
1463
+ return this._bridge;
1227
1464
  }
1228
1465
  /**
1229
- * 内部使用的 `PlotOverlay` 实例。
1230
- * 注册到 `ImageOverlayPlugin` 的 `overlays` 数组中,顺序靠后者通常绘制在上层。
1466
+ * 兼容参考项目同名 getter:内置桥接器替代 PlotSdfPlugin。
1467
+ * 业务旧调用 `decals.plotSdfPlugin` 仍能拿到一个具备 shapes / redraw /
1468
+ * opacity / dispose 协议的对象。
1231
1469
  */
1232
1470
  get plotSdfPlugin() {
1233
- return this._plotSdfPlugin;
1471
+ return this._bridge;
1234
1472
  }
1235
1473
  /**
1236
- * 绑定 / 更换 PlotOverlayPlugin(切换地形重建插件后调用)。
1237
- * 如果当前已有图形,会在下一帧自动重新注册 overlay。
1474
+ * 兼容参考项目签名:桥接器已在构造时内置,无需外部注入。
1475
+ * 调用仅触发一次重绘,便于旧业务无感升级。
1238
1476
  */
1239
1477
  setPlotSDFPlugin(e) {
1240
- this._plotSdfPlugin = e, this._overlayAttached = !1, this._items.size > 0 && this._markDirty();
1478
+ this._overlayAttached = !1, this._items.size > 0 && this._markDirty();
1241
1479
  }
1242
- // ── 图形创建:返回字符串 id,可用于后续查询 / 更新 / 删除 ──
1480
+ // ── 图形创建:返回字符串 id ──
1243
1481
  /**
1244
- * 添加标绘:由 `options.type` 决定实例化哪一类 `GisPlot*`(与各类 `*Options` 对应)。
1482
+ * 添加标绘:由 options.type 决定实例化哪一类 GisPlot*。
1483
+ *
1484
+ * @returns 新建标绘的自增字符串 id。
1485
+ * @throws 当 options.type 未知时抛错。
1245
1486
  */
1246
1487
  addPlot(e) {
1247
1488
  let t;
1248
1489
  switch (e.type) {
1249
1490
  case "point": {
1250
- const { type: r, ...s } = e;
1251
- t = new Be(s);
1491
+ const { type: r, ...i } = e;
1492
+ t = new Fe(i);
1252
1493
  break;
1253
1494
  }
1254
1495
  case "line": {
1255
- const { type: r, ...s } = e;
1256
- t = new ze(s);
1496
+ const { type: r, ...i } = e;
1497
+ t = new Je(i);
1257
1498
  break;
1258
1499
  }
1259
1500
  case "polygon": {
1260
- const { type: r, ...s } = e;
1261
- t = new Qe(s);
1501
+ const { type: r, ...i } = e;
1502
+ t = new Ue(i);
1262
1503
  break;
1263
1504
  }
1264
1505
  case "rectangle": {
1265
- const { type: r, ...s } = e;
1266
- t = new je(s);
1506
+ const { type: r, ...i } = e;
1507
+ t = new We(i);
1267
1508
  break;
1268
1509
  }
1269
1510
  case "circle": {
1270
- const { type: r, ...s } = e;
1271
- t = new rt(s);
1511
+ const { type: r, ...i } = e;
1512
+ t = new Qe(i);
1272
1513
  break;
1273
1514
  }
1274
1515
  case "sector": {
1275
- const { type: r, ...s } = e;
1276
- t = new He(s);
1516
+ const { type: r, ...i } = e;
1517
+ t = new ze(i);
1277
1518
  break;
1278
1519
  }
1279
1520
  case "text": {
1280
- const { type: r, ...s } = e;
1281
- t = new tt(s);
1521
+ const { type: r, ...i } = e;
1522
+ t = new je(i);
1282
1523
  break;
1283
1524
  }
1284
1525
  case "arrow": {
1285
- const { type: r, ...s } = e;
1286
- t = new et(s);
1526
+ const { type: r, ...i } = e;
1527
+ t = new Be(i);
1287
1528
  break;
1288
1529
  }
1289
1530
  default:
@@ -1301,136 +1542,161 @@ class st {
1301
1542
  }
1302
1543
  // ── 查询与修改 ──
1303
1544
  /**
1304
- * 读取标绘快照(**浅拷贝**:`options` 为新对象,但 `points` 与内部仍为同一数组引用)。
1305
- * 若需完全独立副本,请用 {@link getItemDeep}。
1545
+ * 读取标绘浅快照(options 为新对象,points 仍共享引用;箭头附带 generatedCoords)。
1546
+ *
1547
+ * @returns 浅快照;id 不存在时返回 null。
1306
1548
  */
1307
1549
  getItem(e) {
1308
1550
  const t = this._items.get(e);
1309
1551
  return t ? t.getSnapshot() : null;
1310
1552
  }
1311
1553
  /**
1312
- * 深拷贝快照:`points` 等嵌套数组被复制,修改返回值不会影响内部状态。
1313
- * 箭头类型额外深拷贝 `generatedCoords`。
1554
+ * 读取标绘深快照:points 等嵌套数组被复制;箭头额外深拷贝 generatedCoords。
1555
+ *
1556
+ * @returns 深快照;id 不存在时返回 null。
1314
1557
  */
1315
1558
  getItemDeep(e) {
1316
1559
  const t = this._items.get(e);
1317
1560
  return t ? t.getSnapshotDeep() : null;
1318
1561
  }
1319
1562
  /**
1320
- * 合并更新样式与几何字段(调用对应 `GisPlot*.update`)。
1321
- * `patch` 形状需与该 id 下图元类型兼容。
1563
+ * 合并更新样式与几何字段(调用对应 GisPlot*.update 做不可变整表替换)。
1322
1564
  */
1323
1565
  setStyle(e, t) {
1324
1566
  const r = this._items.get(e);
1325
1567
  r && (r.update(t), this._markDirty());
1326
1568
  }
1327
1569
  /**
1328
- * 将 **第一个顶点** 设为新的经纬度中心(适用于点、矩形中心、扇心、文字锚点等单中心语义)。
1570
+ * 将第一个顶点设为新的经纬度中心(点 / 矩形中心 / 扇心 / 文字锚点等单中心
1571
+ * 语义)。**就地修改** points[0](与 update 的不可变风格不同)。
1329
1572
  */
1330
1573
  setCenter(e, t) {
1331
1574
  const r = this._items.get(e);
1332
1575
  !r || !r.options.points || r.options.points.length === 0 || (t.lon !== void 0 && (r.options.points[0][0] = t.lon), t.lat !== void 0 && (r.options.points[0][1] = t.lat), this._markDirty());
1333
1576
  }
1334
- /** 整体替换顶点列表(每项为 `[lon, lat]`) */
1577
+ /**
1578
+ * 整体替换顶点列表(每项为 [lon, lat],深拷贝防止外部引用泄漏)。
1579
+ */
1335
1580
  setCoords(e, t) {
1336
1581
  const r = this._items.get(e);
1337
- r && (r.options.points = t.map((s) => [...s]), this._markDirty());
1582
+ r && (r.options.points = t.map((i) => [...i]), this._markDirty());
1338
1583
  }
1339
- /** 修改指定下标顶点;`coord` 分量可为 `undefined` 表示不改该分量 */
1584
+ /**
1585
+ * 修改指定下标顶点;coord 分量为 undefined 表示不改该分量。越界静默返回。
1586
+ */
1340
1587
  setCoord(e, t, r) {
1341
- const s = this._items.get(e);
1342
- !s || !s.options.points || t < 0 || t >= s.options.points.length || (r[0] !== void 0 && (s.options.points[t][0] = r[0]), r[1] !== void 0 && (s.options.points[t][1] = r[1]), this._markDirty());
1588
+ const i = this._items.get(e);
1589
+ !i || !i.options.points || t < 0 || t >= i.options.points.length || (r[0] !== void 0 && (i.options.points[t][0] = r[0]), r[1] !== void 0 && (i.options.points[t][1] = r[1]), this._markDirty());
1343
1590
  }
1344
- /** 在 `index` 处插入一个顶点(可插在末尾,`index` 越界时钳位) */
1591
+ /**
1592
+ * 在 index 处插入一个顶点(可插末尾,越界钳位)。插入顶点深拷贝。
1593
+ */
1345
1594
  insertCoord(e, t, r) {
1346
- const s = this._items.get(e);
1347
- if (!s || !s.options.points) return;
1348
- const a = Math.max(0, Math.min(t, s.options.points.length));
1349
- s.options.points.splice(a, 0, [...r]), this._markDirty();
1595
+ const i = this._items.get(e);
1596
+ if (!i || !i.options.points) return;
1597
+ const n = Math.max(0, Math.min(t, i.options.points.length));
1598
+ i.options.points.splice(n, 0, [...r]), this._markDirty();
1350
1599
  }
1351
1600
  /**
1352
- * 删除指定下标顶点。
1353
- * 多边形至少保留 3 点,其余类型至少 2 点(与 `shape.category` 联动)。
1601
+ * 删除指定下标顶点。多边形至少保留 3 点,其余至少 2 点;越界 / 触底静默返回。
1354
1602
  */
1355
1603
  removeCoord(e, t) {
1356
1604
  const r = this._items.get(e);
1357
1605
  if (!r || !r.options.points || t < 0 || t >= r.options.points.length) return;
1358
- const s = r.category === "polygon" ? 3 : 2;
1359
- r.options.points.length <= s || (r.options.points.splice(t, 1), this._markDirty());
1606
+ const i = r.category === "polygon" ? 3 : 2;
1607
+ r.options.points.length <= i || (r.options.points.splice(t, 1), this._markDirty());
1360
1608
  }
1361
- /** 对所有顶点做经纬度平移(度) */
1609
+ /**
1610
+ * 对所有顶点做经纬度平移(度),就地修改。
1611
+ */
1362
1612
  translateCoords(e, t, r) {
1363
- const s = this._items.get(e);
1364
- if (!(!s || !s.options.points)) {
1365
- for (const a of s.options.points)
1366
- a[0] += t, a[1] += r;
1613
+ const i = this._items.get(e);
1614
+ if (!(!i || !i.options.points)) {
1615
+ for (const n of i.options.points)
1616
+ n[0] += t, n[1] += r;
1367
1617
  this._markDirty();
1368
1618
  }
1369
1619
  }
1370
- /** 仅对 `category === 'text'` 的项更新 `options.content` */
1620
+ /**
1621
+ * 仅对 category === 'text' 的项更新 options.content。
1622
+ */
1371
1623
  setText(e, t) {
1372
1624
  const r = this._items.get(e);
1373
1625
  !r || r.category !== "text" || (r.options.content = t, this._markDirty());
1374
1626
  }
1375
- /** 设置整个 overlay 不透明度(0–1,具体语义以 `PlotOverlay` 为准) */
1627
+ /**
1628
+ * 设置整个标绘层的全局不透明度(0..1)。桥接器内部钳位。
1629
+ */
1376
1630
  setGlobalOpacity(e) {
1377
- this._plotSdfPlugin && (this._plotSdfPlugin.opacity = e, this._markDirty());
1631
+ this._bridge.opacity = e, this._markDirty();
1378
1632
  }
1633
+ /**
1634
+ * 返回某标绘顶点数(不存在返回 0)。
1635
+ */
1379
1636
  getCoordCount(e) {
1380
1637
  const t = this._items.get(e);
1381
1638
  return !t || !t.options.points ? 0 : t.options.points.length;
1382
1639
  }
1383
1640
  /**
1384
- * 在经纬度平面上找离 `(lon, lat)` 最近的顶点下标(平方距离最小);
1385
- * 无顶点时返回 `-1`。
1641
+ * 在经纬度平面找离 (lon, lat) 最近的顶点下标(平方距离最小);无顶点返回 -1。
1386
1642
  */
1387
1643
  findNearestCoord(e, t, r) {
1388
- const s = this._items.get(e);
1389
- if (!s || !s.options.points || s.options.points.length === 0) return -1;
1390
- let a = 0, n = 1 / 0;
1391
- for (let o = 0; o < s.options.points.length; o++) {
1392
- const d = s.options.points[o][0] - t, u = s.options.points[o][1] - r, h = d * d + u * u;
1393
- h < n && (n = h, a = o);
1644
+ const i = this._items.get(e);
1645
+ if (!i || !i.options.points || i.options.points.length === 0) return -1;
1646
+ let n = 0, a = 1 / 0;
1647
+ for (let o = 0; o < i.options.points.length; o++) {
1648
+ const d = i.options.points[o][0] - t, l = i.options.points[o][1] - r, h = d * d + l * l;
1649
+ h < a && (a = h, n = o);
1394
1650
  }
1395
- return a;
1651
+ return n;
1396
1652
  }
1653
+ // ── 渲染接入 ──
1654
+ /**
1655
+ * 宿主每帧调用:在深度纹理渲染之后、renderer.render 之前,
1656
+ * 把深度纹理 / 视口 / 相机透传给所有标绘图元。
1657
+ *
1658
+ * @param frameState 当前帧状态(含 depthTexture / width / height / camera /
1659
+ * pixelRatio?)。
1660
+ */
1661
+ update(e) {
1662
+ this._bridge.update(e);
1663
+ }
1664
+ /**
1665
+ * 触发 SoonSpace 视口刷新;在 _markDirty 合并重绘后调用。
1666
+ */
1397
1667
  render = () => {
1398
1668
  this.ssp.render();
1399
1669
  };
1400
- /**
1401
- * 释放 overlay 内部 RTT / 纹理等资源。
1402
- * `PlotSDFPlugin` 的运行时实现含 `dispose`,类型声明可能未列出,故做断言。
1403
- */
1670
+ /** 释放桥接器内部全部图元与场景挂载 */
1404
1671
  dispose() {
1405
- this._plotSdfPlugin && this._plotSdfPlugin.dispose();
1672
+ this._bridge.dispose();
1406
1673
  }
1407
1674
  /**
1408
- * 标记需要在下一帧重绘瓦片标绘层;同一帧内多次调用只会调度一次。
1409
- * 首次有图形且尚未挂载时,先将 PlotOverlay 注册到 ImageOverlayPlugin(此时 shapes 已有数据,
1410
- * `init()` → `hasContent` 能正确返回 true)。
1675
+ * 标记下一帧重绘;同帧多次调用只调度一次。
1676
+ * 首次有图形时把 _items 交给桥接器(此时 shapes 已有数据,redraw 能正确建图元)。
1411
1677
  */
1412
1678
  _markDirty() {
1413
- this._redrawTimer || (this._redrawTimer = requestAnimationFrame(() => {
1414
- this._plotSdfPlugin && (this._redrawTimer = null, !this._overlayAttached && this._items.size > 0 && (this._plotSdfPlugin.shapes = this._items, this._overlayAttached = !0), this._plotSdfPlugin.redraw(), this.render());
1679
+ this._redrawTimer === null && (this._redrawTimer = requestAnimationFrame(() => {
1680
+ this._redrawTimer = null, !this._overlayAttached && this._items.size > 0 && (this._bridge.shapes = this._items, this._overlayAttached = !0), this._bridge.redraw(), this.render();
1415
1681
  }));
1416
1682
  }
1417
1683
  }
1418
- const it = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/", at = "https://c.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
1419
- class mt {
1684
+ const rt = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/", it = "https://c.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
1685
+ class St {
1420
1686
  constructor(e, t = {}) {
1421
1687
  this.ssp = e, this.options = t;
1422
- const r = t.baseUrl || it;
1423
- if (this.resourceManager = new Je(), this.terrainManager = new Ue(), t.imageryUrl !== !1) {
1424
- const s = t.imageryUrl || at;
1688
+ const r = t.baseUrl || rt;
1689
+ if (this.resourceManager = new Le(), this.terrainManager = new De(), t.imageryUrl !== !1) {
1690
+ const i = t.imageryUrl || it;
1425
1691
  this.resourceManager.addOverlay({
1426
1692
  id: this.defaultImageryId,
1427
- type: l.XYZ,
1428
- options: { id: this.defaultImageryId, url: s, type: l.XYZ }
1693
+ type: u.XYZ,
1694
+ options: { id: this.defaultImageryId, url: i, type: u.XYZ }
1429
1695
  });
1430
1696
  }
1431
- this.groundDecalManager = new st({ ssp: this.ssp }), this._alphaClipMode = t.alphaClipMode ?? "alphaTest", this._currentTerrainConfig = {
1697
+ this.groundDecalManager = new tt({ ssp: this.ssp }), Pe(), this._alphaClipMode = t.alphaClipMode ?? "alphaTest", this._currentTerrainConfig = {
1432
1698
  id: this.defaultTerrainId,
1433
- type: I.QUANTIZED_MESH,
1699
+ type: w.QUANTIZED_MESH,
1434
1700
  url: r
1435
1701
  }, this.terrainManager.add(this._currentTerrainConfig), this.terrainManager.setCurrentId(this._currentTerrainConfig.id), this.tiles = this._initTilesRenderer(this._currentTerrainConfig), this._initPlugins(this.tiles, this._currentTerrainConfig);
1436
1702
  }
@@ -1442,8 +1708,16 @@ class mt {
1442
1708
  customMaterialPlugin;
1443
1709
  imageOverlayPlugin;
1444
1710
  reorientationPlugin;
1445
- /** 标绘 SDF 插件(管理标绘实例) */
1446
- plotSDFPlugin;
1711
+ /** 标绘贴地深度通道(cesium-to-three classification 图元每帧所需的地形 packed depth) */
1712
+ _globeDepth;
1713
+ /**
1714
+ * 虚拟 ECEF 相机:把真实相机(在 reorientation 原点系)经 R⁻¹ 变回绝对 WGS84 ECEF,
1715
+ * 供 cesium-to-three 标绘图元的 RTE 着色器使用。标绘几何烘焙在绝对 ECEF,只有用
1716
+ * ECEF 相机投影才能与「重定向后地形」对齐,同时保持 reorientation 开启(地形不抖)。
1717
+ */
1718
+ _plotVirtualCamera = new q();
1719
+ _reorientInverse = new P();
1720
+ _virtualScale = new me();
1447
1721
  /** 资源管理器(存储配置) */
1448
1722
  resourceManager;
1449
1723
  /** 地形管理器(记录地形列表) */
@@ -1464,7 +1738,7 @@ class mt {
1464
1738
  * 是否使用 Cesium Ion 地形
1465
1739
  */
1466
1740
  get isCesiumIon() {
1467
- return this._currentTerrainConfig.type === I.CESIUM_ION;
1741
+ return this._currentTerrainConfig.type === w.CESIUM_ION;
1468
1742
  }
1469
1743
  /**
1470
1744
  * 获取当前地形配置
@@ -1510,9 +1784,9 @@ class mt {
1510
1784
  this._alphaClipMode = e, this.customMaterialPlugin && (this.customMaterialPlugin.alphaClipMode = e), this._updateAlphaClipMode(), this.render();
1511
1785
  }
1512
1786
  _initTilesRenderer(e) {
1513
- return e.type === I.CESIUM_ION ? new L() : (
1787
+ return e.type === w.CESIUM_ION ? new x() : (
1514
1788
  // Cesium Ion 由插件设置 URL
1515
- new L(e.url)
1789
+ new x(e.url)
1516
1790
  );
1517
1791
  }
1518
1792
  /**
@@ -1520,35 +1794,35 @@ class mt {
1520
1794
  * @param config 地形配置
1521
1795
  */
1522
1796
  _initPlugins(e, t) {
1523
- if (this.tilesFadePlugin = new ie({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new ae(), e.registerPlugin(this.tilesFadePlugin), e.registerPlugin(this.updateOnChangePlugin), t.type === I.CESIUM_ION ? e.registerPlugin(
1524
- new Se({
1797
+ if (this.tilesFadePlugin = new z({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new B(), e.registerPlugin(this.tilesFadePlugin), e.registerPlugin(this.updateOnChangePlugin), t.type === w.CESIUM_ION ? e.registerPlugin(
1798
+ new ue({
1525
1799
  apiToken: t.apiToken,
1526
1800
  assetId: t.assetId || "1",
1527
1801
  autoRefreshToken: t.autoRefreshToken ?? !0,
1528
- assetTypeHandler: (r, s) => {
1529
- r === "TERRAIN" && s.getPluginByName("QUANTIZED_MESH_PLUGIN") === null && s.registerPlugin(
1530
- new ee({ useRecommendedSettings: !0 })
1802
+ assetTypeHandler: (r, i) => {
1803
+ r === "TERRAIN" && i.getPluginByName("QUANTIZED_MESH_PLUGIN") === null && i.registerPlugin(
1804
+ new U({ useRecommendedSettings: !0 })
1531
1805
  );
1532
1806
  }
1533
1807
  })
1534
1808
  ) : (e.registerPlugin(
1535
- new ee({ useRecommendedSettings: !0 })
1809
+ new U({ useRecommendedSettings: !0 })
1536
1810
  ), e.fetchData = async (r) => {
1537
- const s = { method: "GET", mode: "cors" };
1811
+ const i = { method: "GET", mode: "cors" };
1538
1812
  if (/layer\.json$/.test(r)) {
1539
- const a = await fetch(r, s).then((n) => n.json());
1540
- return a.metadataAvailability = -1, new Response(JSON.stringify(a));
1813
+ const n = await fetch(r, i).then((a) => a.json());
1814
+ return n.metadataAvailability = -1, new Response(JSON.stringify(n));
1541
1815
  }
1542
- return fetch(r, s);
1543
- }), this.options.useCustomMaterial !== !1 && (this.customMaterialPlugin = new Ae(), this.customMaterialPlugin.alphaClipMode = this._alphaClipMode, e.registerPlugin(this.customMaterialPlugin)), this.imageOverlayPlugin = new Oe({
1816
+ return fetch(r, i);
1817
+ }), this.options.useCustomMaterial !== !1 && (this.customMaterialPlugin = new Ae(), this.customMaterialPlugin.alphaClipMode = this._alphaClipMode, e.registerPlugin(this.customMaterialPlugin)), this.imageOverlayPlugin = new de({
1544
1818
  renderer: this.ssp.viewport.renderer,
1545
1819
  overlays: []
1546
- }), e.registerPlugin(this.imageOverlayPlugin), this.plotSDFPlugin = new Ne(), this.groundDecalManager?.setPlotSDFPlugin(this.plotSDFPlugin), this.tiles.registerPlugin(this.plotSDFPlugin), this.overlayManager = new Q(
1820
+ }), e.registerPlugin(this.imageOverlayPlugin), this._ensureGlobeDepth(), this.overlayManager = new N(
1547
1821
  this.imageOverlayPlugin,
1548
1822
  this.resourceManager
1549
1823
  ), this.overlayManager.restoreFromResourceManager(), this.options.reorientation !== !1) {
1550
1824
  const r = this.options.reorientation || { lon: 120, lat: 30 };
1551
- this.reorientationPlugin = new ne({
1825
+ this.reorientationPlugin = new j({
1552
1826
  lon: r.lon,
1553
1827
  lat: r.lat,
1554
1828
  height: r.height ?? 0.1
@@ -1578,8 +1852,8 @@ class mt {
1578
1852
  * 添加影像或倾斜加载事件监听
1579
1853
  */
1580
1854
  addEventLoad(e) {
1581
- this.tiles.addEventListener("load-error", ({ tile: t, error: r, url: s }) => {
1582
- e({ tile: t, error: r, url: s });
1855
+ this.tiles.addEventListener("load-error", ({ tile: t, error: r, url: i }) => {
1856
+ e({ tile: t, error: r, url: i });
1583
1857
  });
1584
1858
  }
1585
1859
  // =============== 地形管理 API ===============
@@ -1604,9 +1878,9 @@ class mt {
1604
1878
  setTerrain(e, t = void 0) {
1605
1879
  if (t && (this.options = { ...this.options, ...t }), this.terrainManager.has(e.id) || this.terrainManager.add(e), this.terrainManager.setCurrentId(e.id), this.terrainManager.currentId === e.id) {
1606
1880
  const r = this.terrainManager.getCurrent();
1607
- e.type === I.QUANTIZED_MESH && r?.type === I.QUANTIZED_MESH && (r.url = e.url);
1881
+ e.type === w.QUANTIZED_MESH && r?.type === w.QUANTIZED_MESH && (r.url = e.url);
1608
1882
  }
1609
- this._disposeTilesRenderer(), this._currentTerrainConfig = e, this.tiles = this._initTilesRenderer(e), this._initPlugins(this.tiles, e), this.plotSDFPlugin && this.groundDecalManager && this.groundDecalManager.setPlotSDFPlugin(this.plotSDFPlugin), this._enabled && this.ssp.addObject(this.tiles.group), this.render();
1883
+ 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();
1610
1884
  }
1611
1885
  // =============== Overlay 快捷方法 ===============
1612
1886
  /**
@@ -1617,17 +1891,17 @@ class mt {
1617
1891
  */
1618
1892
  async addOverlay(e) {
1619
1893
  switch (e.type) {
1620
- case l.GEOJSON:
1894
+ case u.GEOJSON:
1621
1895
  return this.overlayManager.addGeoJSONOverlay(e);
1622
- case l.CESIUM_ION:
1896
+ case u.CESIUM_ION:
1623
1897
  return this.overlayManager.addCesiumIonOverlay(e);
1624
- case l.TMS:
1898
+ case u.TMS:
1625
1899
  return this.overlayManager.addTMSOverlay(e);
1626
- case l.XYZ:
1900
+ case u.XYZ:
1627
1901
  return this.overlayManager.addXYZOverlay(e);
1628
- case l.WMS:
1902
+ case u.WMS:
1629
1903
  return await this.overlayManager.addWMSOverlay(e);
1630
- case l.WMTS:
1904
+ case u.WMTS:
1631
1905
  return await this.overlayManager.addWMTSOverlay(e);
1632
1906
  default:
1633
1907
  return this.overlayManager.addUrlTemplateOverlay(e);
@@ -1695,19 +1969,19 @@ class mt {
1695
1969
  * 合并多个 GeoJSON 后替换指定 StyledGeoJSONOverlay 的数据
1696
1970
  */
1697
1971
  setMergedGeoJSON(e, t, r) {
1698
- const s = this.overlayManager.setMergedGeoJSON(e, t, r);
1699
- return s && this.render(), s;
1972
+ const i = this.overlayManager.setMergedGeoJSON(e, t, r);
1973
+ return i && this.render(), i;
1700
1974
  }
1701
1975
  getGeoJSONFeatureById(e, t) {
1702
1976
  return this.overlayManager.getGeoJSONFeatureById(e, t);
1703
1977
  }
1704
1978
  updateGeoJSONFeatureStyleById(e, t, r) {
1705
- const s = this.overlayManager.updateGeoJSONFeatureStyleById(e, t, r);
1706
- return s && this.render(), s;
1979
+ const i = this.overlayManager.updateGeoJSONFeatureStyleById(e, t, r);
1980
+ return i && this.render(), i;
1707
1981
  }
1708
1982
  updateGeoJSONFeatureStylesByIds(e, t, r) {
1709
- const s = this.overlayManager.updateGeoJSONFeatureStylesByIds(e, t, r);
1710
- return s && this.render(), s;
1983
+ const i = this.overlayManager.updateGeoJSONFeatureStylesByIds(e, t, r);
1984
+ return i && this.render(), i;
1711
1985
  }
1712
1986
  // =============== GeoJSON 管理 ===============
1713
1987
  /**
@@ -1773,13 +2047,55 @@ class mt {
1773
2047
  this.ssp.render();
1774
2048
  };
1775
2049
  beforeRenderHandler = () => {
1776
- this.ssp.viewport.camera.updateMatrixWorld(), this.tiles.setCamera(this.ssp.viewport.camera), this.tiles.setResolutionFromRenderer(
1777
- this.ssp.viewport.camera,
1778
- this.ssp.viewport.renderer
1779
- ), this.tiles.update();
2050
+ const { camera: e, renderer: t, scene: r } = this.ssp.viewport;
2051
+ if (e.updateMatrixWorld(), this.tiles.setCamera(e), this.tiles.setResolutionFromRenderer(e, t), this.tiles.update(), this.groundDecalManager && e instanceof q) {
2052
+ const i = this._ensureGlobeDepth(), n = t.domElement.width, a = t.domElement.height;
2053
+ (i.target.width !== n || i.target.height !== a) && i.resize(n, a), xe(e.near, e.far), i.render(t, e, r, this.tiles.group);
2054
+ const o = this._buildPlotVirtualCamera(e);
2055
+ this.groundDecalManager.update({
2056
+ depthTexture: i.target.texture,
2057
+ width: n,
2058
+ height: a,
2059
+ camera: o,
2060
+ pixelRatio: t.getPixelRatio()
2061
+ });
2062
+ }
1780
2063
  };
2064
+ /**
2065
+ * 把真实相机变换回绝对 WGS84 ECEF,得到供标绘 RTE 着色器使用的虚拟相机。
2066
+ *
2067
+ * 原理:地形经 reorientation 用 R = tiles.group.matrixWorld(ECEF → 重定向世界)
2068
+ * 渲染;标绘几何烘焙在绝对 ECEF。令 vCam.matrixWorld = R⁻¹ · realCamera.matrixWorld,
2069
+ * 则 V_virtual = V_real · R,标绘 clip = P·V_virtual·p_ecef = P·V_real·(R·p_ecef)
2070
+ * 与地形 clip 完全一致 → 对齐;且相机与几何都在 ECEF、局部差值小 → RTE 不抖。
2071
+ * 当 R 为单位阵(reorientation 关闭)时,vCam 退化为真实相机,行为不变。
2072
+ *
2073
+ * 注意:cesium-to-three 只读 camera 的 position / quaternion / fov / aspect /
2074
+ * near / far / projectionMatrixInverse,故只需保证这些字段正确。
2075
+ *
2076
+ * @param camera 真实透视相机(soonspacejs 视口相机)。
2077
+ * @returns 复用的虚拟相机实例(每帧原地更新)。
2078
+ */
2079
+ _buildPlotVirtualCamera(e) {
2080
+ this.tiles.group.updateMatrixWorld(), this._reorientInverse.copy(this.tiles.group.matrixWorld).invert();
2081
+ const t = this._plotVirtualCamera;
2082
+ return t.matrixWorld.multiplyMatrices(this._reorientInverse, e.matrixWorld), t.matrixWorld.decompose(t.position, t.quaternion, this._virtualScale), t.matrixWorldInverse.copy(t.matrixWorld).invert(), t.fov = e.fov, t.aspect = e.aspect, t.near = e.near, t.far = e.far, t.projectionMatrix.copy(e.projectionMatrix), t.projectionMatrixInverse.copy(e.projectionMatrixInverse), t;
2083
+ }
2084
+ /**
2085
+ * 惰性创建(或复用)贴地深度通道,尺寸对齐当前渲染器绘制缓冲。
2086
+ */
2087
+ _ensureGlobeDepth() {
2088
+ if (!this._globeDepth) {
2089
+ const { renderer: e } = this.ssp.viewport;
2090
+ this._globeDepth = new ke(
2091
+ e.domElement.width,
2092
+ e.domElement.height
2093
+ );
2094
+ }
2095
+ return this._globeDepth;
2096
+ }
1781
2097
  enable() {
1782
- this._enabled = !0, this.ssp.addObject(this.tiles.group), this.ssp.signals.beforeRender.add(this.beforeRenderHandler);
2098
+ this._enabled = !0, this.ssp.viewport.camera.layers.enable(Ee), this.ssp.addObject(this.tiles.group), this.ssp.signals.beforeRender.add(this.beforeRenderHandler);
1783
2099
  }
1784
2100
  disable() {
1785
2101
  this._enabled = !1, this.ssp.removeObject(this.tiles.group), this.ssp.signals.beforeRender.remove(this.beforeRenderHandler);
@@ -1790,32 +2106,32 @@ class mt {
1790
2106
  "TilesRenderer: reorientationPlugin is not enabled, invalidate() will not work."
1791
2107
  ), () => {
1792
2108
  };
1793
- const s = this.reorientationPlugin;
2109
+ const i = this.reorientationPlugin;
1794
2110
  this.options.reorientation = {
1795
2111
  lon: e,
1796
2112
  lat: t,
1797
2113
  height: r
1798
2114
  };
1799
- const a = () => {
1800
- const o = S.degToRad(t), d = S.degToRad(e);
1801
- s.transformLatLonHeightToOrigin(o, d, r), this.render(), n();
1802
- }, n = () => {
1803
- this.tiles.removeEventListener("load-root-tileset", a), this.loedTilesSets.delete(a);
2115
+ const n = () => {
2116
+ const o = f.degToRad(t), d = f.degToRad(e);
2117
+ i.transformLatLonHeightToOrigin(o, d, r), this.render(), a();
2118
+ }, a = () => {
2119
+ this.tiles.removeEventListener("load-root-tileset", n), this.loedTilesSets.delete(n);
1804
2120
  };
1805
- return this.tiles.addEventListener("load-root-tileset", a), this.loedTilesSets.add(a), this.tiles.root && a(), n;
2121
+ return this.tiles.addEventListener("load-root-tileset", n), this.loedTilesSets.add(n), this.tiles.root && n(), a;
1806
2122
  }
1807
2123
  dispose() {
1808
- this.disable(), this.terrainManager.dispose(), this.overlayManager.dispose(), this.loedTilesSets.forEach(
2124
+ this.disable(), this.terrainManager.dispose(), this.overlayManager.dispose(), this.groundDecalManager?.dispose(), this._globeDepth?.dispose(), this._globeDepth = void 0, this.loedTilesSets.forEach(
1809
2125
  (e) => this.tiles.removeEventListener("load-root-tileset", e)
1810
2126
  ), this.loedTilesSets.clear(), this.tiles.removeEventListener("needs-render", this.render), this.tiles.removeEventListener("needs-update", this.render), this.tiles.dispose();
1811
2127
  }
1812
2128
  }
1813
- const k = {
2129
+ const T = {
1814
2130
  DEFAULT: 0,
1815
2131
  GRADIENT: 1,
1816
2132
  TOPOGRAPHIC_LINES: 2,
1817
2133
  LIGHTING: 3
1818
- }, nt = {
2134
+ }, st = {
1819
2135
  vertexShader: (
1820
2136
  /* glsl */
1821
2137
  `
@@ -1841,7 +2157,7 @@ const k = {
1841
2157
  }
1842
2158
  `
1843
2159
  )
1844
- }, ot = {
2160
+ }, nt = {
1845
2161
  vertexShader: (
1846
2162
  /* glsl */
1847
2163
  `
@@ -1887,10 +2203,10 @@ const k = {
1887
2203
  `
1888
2204
  )
1889
2205
  };
1890
- let Z = null, V = null, $ = null;
1891
- class lt {
2206
+ let D = null, G = null, F = null;
2207
+ class at {
1892
2208
  constructor(e, t) {
1893
- this.ssp = e, this.options = t, "url" in this.options ? this.tiles = new L(this.options.url) : (this.tiles = new L(), this._initCesiumIon(this.options)), this._initBasePlugins(this.options);
2209
+ this.ssp = e, this.options = t, "url" in this.options ? this.tiles = new x(this.options.url) : (this.tiles = new x(), this._initCesiumIon(this.options)), this._initBasePlugins(this.options);
1894
2210
  }
1895
2211
  tiles;
1896
2212
  tilesFadePlugin;
@@ -1898,10 +2214,10 @@ class lt {
1898
2214
  reorientationPlugin;
1899
2215
  options;
1900
2216
  // 用于模型居中
1901
- _box = new Ce();
1902
- _sphere = new _e();
2217
+ _box = new ve();
2218
+ _sphere = new le();
1903
2219
  // 当前材质类型
1904
- _materialType = k.DEFAULT;
2220
+ _materialType = T.DEFAULT;
1905
2221
  // 按需渲染标志
1906
2222
  _needsUpdate = !0;
1907
2223
  _cameraTransitionStart = !1;
@@ -1911,7 +2227,7 @@ class lt {
1911
2227
  */
1912
2228
  _initCesiumIon(e) {
1913
2229
  this.tiles.registerPlugin(
1914
- new Se({
2230
+ new ue({
1915
2231
  apiToken: e.apiToken,
1916
2232
  assetId: e.assetId,
1917
2233
  autoRefreshToken: e.autoRefreshToken ?? !0
@@ -1922,9 +2238,9 @@ class lt {
1922
2238
  * 初始化基础插件
1923
2239
  */
1924
2240
  _initBasePlugins(e) {
1925
- if (e._managedByPlugin || (Z === null ? Z = this.tiles.lruCache : this.tiles.lruCache = Z, V === null ? V = this.tiles.parseQueue : this.tiles.parseQueue = V, $ === 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 ie({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new ae(), 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) {
2241
+ if (e._managedByPlugin || (D === null ? D = this.tiles.lruCache : this.tiles.lruCache = D, G === null ? G = this.tiles.parseQueue : this.tiles.parseQueue = G, 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 z({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new B(), 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) {
1926
2242
  const t = this.options.reorientation || { lon: 120, lat: 30 };
1927
- this.reorientationPlugin = new ne({
2243
+ this.reorientationPlugin = new j({
1928
2244
  lon: t.lon,
1929
2245
  lat: t.lat,
1930
2246
  height: t.height ?? 0.1
@@ -1940,10 +2256,10 @@ class lt {
1940
2256
  * 设置 GLTF Loader
1941
2257
  */
1942
2258
  _setupGLTFLoader() {
1943
- const e = new me(this.tiles.manager), t = this.ssp.manager?.store?.modelManager;
2259
+ const e = new ae(this.tiles.manager), t = this.ssp.manager?.store?.modelManager;
1944
2260
  if (t?.gltfLoader) {
1945
- const { dracoLoader: r, ktx2Loader: s, meshoptDecoder: a } = t.gltfLoader;
1946
- r && e.setDRACOLoader(r), s && e.setKTX2Loader(s), a && e.setMeshoptDecoder(a);
2261
+ const { dracoLoader: r, ktx2Loader: i, meshoptDecoder: n } = t.gltfLoader;
2262
+ r && e.setDRACOLoader(r), i && e.setKTX2Loader(i), n && e.setMeshoptDecoder(n);
1947
2263
  }
1948
2264
  this.tiles.manager.addHandler(/\.gltf$/, e);
1949
2265
  }
@@ -1984,7 +2300,7 @@ class lt {
1984
2300
  onLoadModel = ({ scene: e }) => {
1985
2301
  e.traverse((t) => {
1986
2302
  t.isMesh && (t.originalMaterial = t.material);
1987
- }), this._materialType !== k.DEFAULT && this.updateMaterial(e);
2303
+ }), this._materialType !== T.DEFAULT && this.updateMaterial(e);
1988
2304
  };
1989
2305
  /**
1990
2306
  * 更新场景中所有网格的材质(参考 customMaterial.js)
@@ -1994,19 +2310,19 @@ class lt {
1994
2310
  e.traverse((r) => {
1995
2311
  if (r.isMesh)
1996
2312
  switch (r.material && r.material !== r.originalMaterial && r.material.dispose(), t) {
1997
- case k.DEFAULT:
2313
+ case T.DEFAULT:
1998
2314
  r.material = r.originalMaterial, r.material && (r.material.side = 2), r.receiveShadow = !1, r.castShadow = !1;
1999
2315
  break;
2000
- case k.GRADIENT:
2001
- r.material = new ge(nt), r.material.side = 2, r.receiveShadow = !1, r.castShadow = !1;
2316
+ case T.GRADIENT:
2317
+ r.material = new V(st), r.material.side = 2, r.receiveShadow = !1, r.castShadow = !1;
2002
2318
  break;
2003
- case k.TOPOGRAPHIC_LINES: {
2004
- const s = new ge(ot);
2005
- s.extensions = { derivatives: !0 }, s.side = 2, r.material = s, r.receiveShadow = !1, r.castShadow = !1;
2319
+ case T.TOPOGRAPHIC_LINES: {
2320
+ const i = new V(nt);
2321
+ i.extensions = { derivatives: !0 }, i.side = 2, r.material = i, r.receiveShadow = !1, r.castShadow = !1;
2006
2322
  break;
2007
2323
  }
2008
- case k.LIGHTING:
2009
- r.material = new Ie(), r.material.side = 2, r.receiveShadow = !0, r.castShadow = !0;
2324
+ case T.LIGHTING:
2325
+ r.material = new _e(), r.material.side = 2, r.receiveShadow = !0, r.castShadow = !0;
2010
2326
  break;
2011
2327
  }
2012
2328
  });
@@ -2046,19 +2362,19 @@ class lt {
2046
2362
  "TilesRenderer: reorientationPlugin is not enabled, invalidate() will not work."
2047
2363
  ), () => {
2048
2364
  };
2049
- const s = this.reorientationPlugin;
2365
+ const i = this.reorientationPlugin;
2050
2366
  this.options.reorientation = {
2051
2367
  lon: e,
2052
2368
  lat: t,
2053
2369
  height: r
2054
2370
  };
2055
- const a = () => {
2056
- const o = S.degToRad(t), d = S.degToRad(e);
2057
- s.transformLatLonHeightToOrigin(o, d, r), this.render(), n();
2058
- }, n = () => {
2059
- this.tiles.removeEventListener("load-root-tileset", a), this.loedTilesSets.delete(a);
2371
+ const n = () => {
2372
+ const o = f.degToRad(t), d = f.degToRad(e);
2373
+ i.transformLatLonHeightToOrigin(o, d, r), this.render(), a();
2374
+ }, a = () => {
2375
+ this.tiles.removeEventListener("load-root-tileset", n), this.loedTilesSets.delete(n);
2060
2376
  };
2061
- return this.tiles.addEventListener("load-root-tileset", a), this.loedTilesSets.add(a), this.tiles.root && a(), n;
2377
+ return this.tiles.addEventListener("load-root-tileset", n), this.loedTilesSets.add(n), this.tiles.root && n(), a;
2062
2378
  }
2063
2379
  dispose() {
2064
2380
  this.disable(), this.loedTilesSets.forEach(
@@ -2066,8 +2382,8 @@ class lt {
2066
2382
  ), 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();
2067
2383
  }
2068
2384
  }
2069
- const K = 2;
2070
- class vt {
2385
+ const J = 2;
2386
+ class wt {
2071
2387
  constructor(e) {
2072
2388
  this.ssp = e;
2073
2389
  const { controls: t, viewport: r } = e;
@@ -2088,12 +2404,12 @@ class vt {
2088
2404
  _downloadQueue = null;
2089
2405
  _referenceOrigin = null;
2090
2406
  _referencePlacements = /* @__PURE__ */ new WeakMap();
2091
- _referenceFrame = new U();
2092
- _targetFrame = new U();
2093
- _sourceFrame = new U();
2094
- _placementMatrix = new U();
2095
- _upCorrectionMatrix = new U();
2096
- _boundingSphere = new _e();
2407
+ _referenceFrame = new P();
2408
+ _targetFrame = new P();
2409
+ _sourceFrame = new P();
2410
+ _placementMatrix = new P();
2411
+ _upCorrectionMatrix = new P();
2412
+ _boundingSphere = new le();
2097
2413
  _beforeRenderHandler = () => {
2098
2414
  this.needsUpdate && (this.needsUpdate = !1, this.ssp.viewport.camera.updateMatrixWorld(), this.tilesMap.forEach((e) => {
2099
2415
  e.tiles.setCamera(this.ssp.viewport.camera), e.tiles.setResolutionFromRenderer(this.ssp.viewport.camera, this.ssp.viewport.renderer), e.applyAutoCenter(), e.tiles.group.updateMatrixWorld(), e.tiles.update();
@@ -2116,9 +2432,9 @@ class vt {
2116
2432
  lon: e.lon,
2117
2433
  lat: e.lat,
2118
2434
  height: e.height ?? 0.1
2119
- }, this.tilesMap.forEach((s) => {
2120
- const a = this._referencePlacements.get(s) ?? null;
2121
- this.applyReferencePlacement(s, a);
2435
+ }, this.tilesMap.forEach((i) => {
2436
+ const n = this._referencePlacements.get(i) ?? null;
2437
+ this.applyReferencePlacement(i, n);
2122
2438
  });
2123
2439
  }
2124
2440
  clearReferenceOrigin() {
@@ -2133,21 +2449,21 @@ class vt {
2133
2449
  async loadTiles(e) {
2134
2450
  const t = "url" in e ? e.url : e.assetId;
2135
2451
  if (this.tilesMap.has(t))
2136
- return z.utils.warn(`${t} already loaded`), this.tilesMap.get(t);
2137
- const { ssp: r } = this, s = this._getReferencePlacement(e), a = this._getTilesRendererOptions(e, s), n = new lt(r, {
2138
- ...a,
2452
+ return R.utils.warn(`${t} already loaded`), this.tilesMap.get(t);
2453
+ const { ssp: r } = this, i = this._getReferencePlacement(e), n = this._getTilesRendererOptions(e, i), a = new at(r, {
2454
+ ...n,
2139
2455
  _managedByPlugin: !0
2140
2456
  });
2141
- s && (this._referencePlacements.set(n, s), n.options.reorientation = s);
2142
- const { tiles: o } = n;
2143
- this._lruCache === null ? this._lruCache = o.lruCache : o.lruCache = this._lruCache, this._parseQueue === null ? this._parseQueue = o.parseQueue : o.parseQueue = this._parseQueue, this._downloadQueue === null ? this._downloadQueue = o.downloadQueue : o.downloadQueue = this._downloadQueue, o.lruCache.maxSize = 600, o.lruCache.minSize = 300, o.lruCache.unloadPercent = 0.8, this.tilesMap.set(t, n), o.setCamera(this._tilesCamera), o.setResolutionFromRenderer(this._tilesCamera, r.viewport.renderer), r.addObject(o.group), this._referenceOrigin && this.applyReferencePlacement(n, s);
2457
+ i && (this._referencePlacements.set(a, i), a.options.reorientation = i);
2458
+ const { tiles: o } = a;
2459
+ this._lruCache === null ? this._lruCache = o.lruCache : o.lruCache = this._lruCache, this._parseQueue === null ? this._parseQueue = o.parseQueue : o.parseQueue = this._parseQueue, this._downloadQueue === null ? this._downloadQueue = o.downloadQueue : o.downloadQueue = this._downloadQueue, o.lruCache.maxSize = 600, o.lruCache.minSize = 300, o.lruCache.unloadPercent = 0.8, this.tilesMap.set(t, a), o.setCamera(this._tilesCamera), o.setResolutionFromRenderer(this._tilesCamera, r.viewport.renderer), r.addObject(o.group), this._referenceOrigin && this.applyReferencePlacement(a, i);
2144
2460
  const d = () => {
2145
2461
  this.cameraTransitionStart || (this.needsUpdate = !0, r.render());
2146
2462
  };
2147
- return o.addEventListener("load-model", d), new Promise((u) => {
2463
+ return o.addEventListener("load-model", d), new Promise((l) => {
2148
2464
  o.addEventListener("load-tile-set", () => {
2149
- const h = this._referencePlacements.get(n);
2150
- this._referenceOrigin && this.applyReferencePlacement(n, h ?? null), d(), u(n);
2465
+ const h = this._referencePlacements.get(a);
2466
+ this._referenceOrigin && this.applyReferencePlacement(a, h ?? null), d(), l(a);
2151
2467
  });
2152
2468
  });
2153
2469
  }
@@ -2180,44 +2496,44 @@ class vt {
2180
2496
  e.tiles.dispose(), this.ssp.removeObject(e.tiles.group);
2181
2497
  }), this.tilesMap.clear();
2182
2498
  }
2183
- invalidate(e, t, r, s) {
2184
- (s ? [s] : Array.from(this.tilesMap.values())).forEach((n) => {
2185
- const o = this._referencePlacements.get(n) ?? null;
2186
- this._referenceOrigin ? this.applyReferencePlacement(n, {
2499
+ invalidate(e, t, r, i) {
2500
+ (i ? [i] : Array.from(this.tilesMap.values())).forEach((a) => {
2501
+ const o = this._referencePlacements.get(a) ?? null;
2502
+ this._referenceOrigin ? this.applyReferencePlacement(a, {
2187
2503
  ...o ?? {},
2188
2504
  lon: e,
2189
2505
  lat: t,
2190
2506
  height: r
2191
- }) : n.invalidate(e, t, r);
2507
+ }) : a.invalidate(e, t, r);
2192
2508
  });
2193
2509
  }
2194
2510
  applyReferencePlacement(e, t) {
2195
2511
  if (!this._referenceOrigin)
2196
- return z.utils.warn("TilesRendererManager: reference origin is not set."), !1;
2197
- const { ellipsoid: r, group: s } = e.tiles, a = this._referenceOrigin, n = this._isGeoreferenced(e);
2512
+ return R.utils.warn("TilesRendererManager: reference origin is not set."), !1;
2513
+ const { ellipsoid: r, group: i } = e.tiles, n = this._referenceOrigin, a = this._isGeoreferenced(e);
2198
2514
  if (r.getObjectFrame(
2199
- S.degToRad(a.lat),
2200
- S.degToRad(a.lon),
2201
- a.height ?? 0.1,
2515
+ f.degToRad(n.lat),
2516
+ f.degToRad(n.lon),
2517
+ n.height ?? 0.1,
2202
2518
  0,
2203
2519
  0,
2204
2520
  0,
2205
2521
  this._referenceFrame,
2206
- K
2522
+ J
2207
2523
  ), this._placementMatrix.copy(this._referenceFrame).invert(), t)
2208
2524
  r.getObjectFrame(
2209
- S.degToRad(t.lat),
2210
- S.degToRad(t.lon),
2525
+ f.degToRad(t.lat),
2526
+ f.degToRad(t.lon),
2211
2527
  t.height ?? 0,
2212
2528
  0,
2213
2529
  0,
2214
2530
  0,
2215
2531
  this._targetFrame,
2216
- K
2217
- ), this._placementMatrix.multiply(this._targetFrame), n ? (this._sourceFrame.copy(this._getSourceFrame(e)).invert(), this._placementMatrix.multiply(this._sourceFrame)) : (this._getUpCorrectionMatrix(t.up ?? "+z"), this._placementMatrix.multiply(this._upCorrectionMatrix));
2218
- else if (!n)
2532
+ J
2533
+ ), this._placementMatrix.multiply(this._targetFrame), a ? (this._sourceFrame.copy(this._getSourceFrame(e)).invert(), this._placementMatrix.multiply(this._sourceFrame)) : (this._getUpCorrectionMatrix(t.up ?? "+z"), this._placementMatrix.multiply(this._upCorrectionMatrix));
2534
+ else if (!a)
2219
2535
  return !1;
2220
- return s.matrix.copy(this._placementMatrix), s.matrix.decompose(s.position, s.quaternion, s.scale), s.updateMatrixWorld(!0), t && (this._referencePlacements.set(e, t), e.options.reorientation = t), this.needsUpdate = !0, e.render(), !0;
2536
+ return i.matrix.copy(this._placementMatrix), i.matrix.decompose(i.position, i.quaternion, i.scale), i.updateMatrixWorld(!0), t && (this._referencePlacements.set(e, t), e.options.reorientation = t), this.needsUpdate = !0, e.render(), !0;
2221
2537
  }
2222
2538
  _isGeoreferenced(e) {
2223
2539
  const { tiles: t } = e;
@@ -2239,19 +2555,19 @@ class vt {
2239
2555
  0,
2240
2556
  0,
2241
2557
  this._sourceFrame,
2242
- K
2558
+ J
2243
2559
  ), this._sourceFrame;
2244
2560
  }
2245
2561
  _getReferencePlacement(e) {
2246
2562
  return e.placement === !1 ? null : e.placement ? e.placement : this._referenceOrigin && e.reorientation ? e.reorientation : null;
2247
2563
  }
2248
2564
  _getTilesRendererOptions(e, t) {
2249
- const { placement: r, ...s } = e;
2565
+ const { placement: r, ...i } = e;
2250
2566
  return this._referenceOrigin ? {
2251
- ...s,
2567
+ ...i,
2252
2568
  autoCenter: !1,
2253
- reorientation: t ? void 0 : s.reorientation
2254
- } : s;
2569
+ reorientation: t ? void 0 : i.reorientation
2570
+ } : i;
2255
2571
  }
2256
2572
  _getUpCorrectionMatrix(e) {
2257
2573
  switch (this._upCorrectionMatrix.identity(), e.toLowerCase().replace(/\s+/, "")) {
@@ -2285,25 +2601,224 @@ class vt {
2285
2601
  this.clear(), this.ssp.signals.beforeRender.remove(this._beforeRenderHandler), this.ssp.signals.cameraObjectChange.remove(this._onCameraObjectChange), this._lruCache = null, this._parseQueue = null, this._downloadQueue = null;
2286
2602
  }
2287
2603
  }
2604
+ function Ct(s) {
2605
+ if (s == null) return [0, 0, 0, 0];
2606
+ const e = String(s).trim().toLowerCase();
2607
+ if (e === "" || e === "transparent") return [0, 0, 0, 0];
2608
+ const t = /^rgba\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]*\.?[0-9]+)\s*\)$/.exec(e);
2609
+ if (t !== null) {
2610
+ const i = Number(t[1]) / 255, n = Number(t[2]) / 255, a = Number(t[3]) / 255, o = Number(t[4]);
2611
+ return [m(i), m(n), m(a), m(o)];
2612
+ }
2613
+ const r = /^rgb\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)$/.exec(e);
2614
+ if (r !== null) {
2615
+ const i = Number(r[1]) / 255, n = Number(r[2]) / 255, a = Number(r[3]) / 255;
2616
+ return [m(i), m(n), m(a), 1];
2617
+ }
2618
+ if (e.startsWith("#")) {
2619
+ const i = e.slice(1);
2620
+ if (i.length === 3) {
2621
+ const n = parseInt(i[0] + i[0], 16) / 255, a = parseInt(i[1] + i[1], 16) / 255, o = parseInt(i[2] + i[2], 16) / 255;
2622
+ if (Number.isFinite(n) && Number.isFinite(a) && Number.isFinite(o))
2623
+ return [n, a, o, 1];
2624
+ } else if (i.length === 6) {
2625
+ const n = parseInt(i.slice(0, 2), 16) / 255, a = parseInt(i.slice(2, 4), 16) / 255, o = parseInt(i.slice(4, 6), 16) / 255;
2626
+ if (Number.isFinite(n) && Number.isFinite(a) && Number.isFinite(o))
2627
+ return [n, a, o, 1];
2628
+ } else if (i.length === 8) {
2629
+ const n = parseInt(i.slice(0, 2), 16) / 255, a = parseInt(i.slice(2, 4), 16) / 255, o = parseInt(i.slice(4, 6), 16) / 255, d = parseInt(i.slice(6, 8), 16) / 255;
2630
+ if (Number.isFinite(n) && Number.isFinite(a) && Number.isFinite(o) && Number.isFinite(d))
2631
+ return [n, a, o, d];
2632
+ }
2633
+ }
2634
+ return [1, 1, 1, 1];
2635
+ }
2636
+ function bt(s, e) {
2637
+ typeof s.fillOpacity == "number" && Number.isFinite(s.fillOpacity) ? e[0] = m(s.fillOpacity / 100) : typeof s.opacity == "number" && Number.isFinite(s.opacity) ? e[0] = m(s.opacity) : e[0] = 1, typeof s.strokeOpacity == "number" && Number.isFinite(s.strokeOpacity) ? e[1] = m(s.strokeOpacity / 100) : typeof s.opacity == "number" && Number.isFinite(s.opacity) ? e[1] = m(s.opacity) : e[1] = 1;
2638
+ }
2639
+ function m(s) {
2640
+ return !Number.isFinite(s) || s < 0 ? 0 : s > 1 ? 1 : s;
2641
+ }
2642
+ const ne = 100, H = 1e-4;
2643
+ function k(s, e) {
2644
+ const t = s[0] - e[0], r = s[1] - e[1];
2645
+ return Math.sqrt(t * t + r * r);
2646
+ }
2647
+ function ot(s) {
2648
+ let e = 0;
2649
+ for (let t = 0; t < s.length - 1; t++)
2650
+ e += k(s[t], s[t + 1]);
2651
+ return e;
2652
+ }
2653
+ function Tt(s) {
2654
+ return Math.pow(ot(s), 0.99);
2655
+ }
2656
+ function ye(s, e) {
2657
+ return [(s[0] + e[0]) / 2, (s[1] + e[1]) / 2];
2658
+ }
2659
+ function $(s, e) {
2660
+ let t;
2661
+ const r = Math.asin(
2662
+ Math.abs(e[1] - s[1]) / k(s, e)
2663
+ );
2664
+ return e[1] >= s[1] && e[0] >= s[0] ? t = r + Math.PI : e[1] >= s[1] && e[0] < s[0] ? t = Math.PI * 2 - r : e[1] < s[1] && e[0] < s[0] ? t = r : t = Math.PI - r, t;
2665
+ }
2666
+ function Pt(s, e, t) {
2667
+ const r = $(e, s) - $(e, t);
2668
+ return r < 0 ? r + Math.PI * 2 : r;
2669
+ }
2670
+ function lt(s, e, t) {
2671
+ return (t[1] - s[1]) * (e[0] - s[0]) > (e[1] - s[1]) * (t[0] - s[0]);
2672
+ }
2673
+ function xt(s, e, t, r, i) {
2674
+ const n = $(s, e), a = i ? n + t : n - t, o = r * Math.cos(a), d = r * Math.sin(a);
2675
+ return [e[0] + o, e[1] + d];
2676
+ }
2677
+ function Q(s, e, t) {
2678
+ let r = s[0] - e[0], i = s[1] - e[1];
2679
+ const n = Math.sqrt(r * r + i * i);
2680
+ r /= n, i /= n;
2681
+ let a = t[0] - e[0], o = t[1] - e[1];
2682
+ const d = Math.sqrt(a * a + o * o);
2683
+ return a /= d, o /= d, [r + a, i + o];
2684
+ }
2685
+ function X(s, e, t, r) {
2686
+ const i = Q(e, t, r);
2687
+ let n, a, o, d, l;
2688
+ const h = Math.sqrt(i[0] * i[0] + i[1] * i[1]), c = i[0] / h, y = i[1] / h, O = k(e, t), g = k(t, r);
2689
+ return h > H ? lt(e, t, r) ? (o = s * O, d = t[0] - o * y, l = t[1] + o * c, n = [d, l], o = s * g, d = t[0] + o * y, l = t[1] - o * c, a = [d, l]) : (o = s * O, d = t[0] + o * y, l = t[1] - o * c, n = [d, l], o = s * g, d = t[0] - o * y, l = t[1] + o * c, a = [d, l]) : (d = t[0] + s * (e[0] - t[0]), l = t[1] + s * (e[1] - t[1]), n = [d, l], d = t[0] + s * (r[0] - t[0]), l = t[1] + s * (r[1] - t[1]), a = [d, l]), [n, a];
2690
+ }
2691
+ function dt(s) {
2692
+ const e = s[0], t = s[1], r = s[2], n = X(0, e, t, r)[0], a = Q(e, t, r), o = Math.sqrt(a[0] * a[0] + a[1] * a[1]);
2693
+ let d;
2694
+ if (o > H) {
2695
+ const l = ye(e, t), h = e[0] - l[0], c = e[1] - l[1], O = 2 / k(e, t), g = -O * c, p = O * h, v = g * g - p * p, C = 2 * g * p, M = p * p - g * g, b = n[0] - l[0], S = n[1] - l[1];
2696
+ d = [
2697
+ l[0] + v * b + C * S,
2698
+ l[1] + C * b + M * S
2699
+ ];
2700
+ } else
2701
+ d = [
2702
+ e[0] + A(1) * (t[0] - e[0]),
2703
+ e[1] + A(1) * (t[1] - e[1])
2704
+ ];
2705
+ return d;
2706
+ }
2707
+ function A(s) {
2708
+ return 0.3 * s;
2709
+ }
2710
+ function ht(s) {
2711
+ const e = s.length, t = s[e - 3], r = s[e - 2], i = s[e - 1], a = X(0, t, r, i)[1], o = Q(t, r, i), d = Math.sqrt(o[0] * o[0] + o[1] * o[1]);
2712
+ let l;
2713
+ if (d > H) {
2714
+ const h = ye(r, i), c = i[0] - h[0], y = i[1] - h[1], g = 2 / k(r, i), p = -g * y, v = g * c, C = p * p - v * v, M = 2 * p * v, b = v * v - p * p, S = a[0] - h[0], Y = a[1] - h[1];
2715
+ l = [
2716
+ h[0] + C * S + M * Y,
2717
+ h[1] + M * S + b * Y
2718
+ ];
2719
+ } else
2720
+ l = [
2721
+ i[0] + A(1) * (r[0] - i[0]),
2722
+ i[1] + A(1) * (r[1] - i[1])
2723
+ ];
2724
+ return l;
2725
+ }
2726
+ function kt(s, e) {
2727
+ const r = [dt(e)];
2728
+ for (let a = 0; a < e.length - 2; a++) {
2729
+ const o = e[a], d = e[a + 1], l = e[a + 2], h = X(s, o, d, l);
2730
+ r.push(h[0], h[1]);
2731
+ }
2732
+ const i = ht(e);
2733
+ r.push(i);
2734
+ const n = [];
2735
+ for (let a = 0; a < e.length - 1; a++) {
2736
+ const o = e[a], d = e[a + 1];
2737
+ n.push(o);
2738
+ for (let l = 0; l < ne; l++) {
2739
+ const h = l / ne, c = Math.pow(1 - h, 3) * o[0] + 3 * h * Math.pow(1 - h, 2) * r[a * 2][0] + 3 * h * h * (1 - h) * r[a * 2 + 1][0] + Math.pow(h, 3) * d[0], y = Math.pow(1 - h, 3) * o[1] + 3 * h * Math.pow(1 - h, 2) * r[a * 2][1] + 3 * h * h * (1 - h) * r[a * 2 + 1][1] + Math.pow(h, 3) * d[1];
2740
+ n.push([c, y]);
2741
+ }
2742
+ n.push(d);
2743
+ }
2744
+ return n;
2745
+ }
2746
+ function Et(s) {
2747
+ if (s.length <= 2) return s;
2748
+ const e = 2, t = [], r = s.length - e - 1;
2749
+ t.push(s[0]);
2750
+ for (let i = 0; i <= r; i++)
2751
+ for (let n = 0; n <= 1; n += 0.05) {
2752
+ let a = 0, o = 0;
2753
+ for (let d = 0; d <= e; d++) {
2754
+ const l = ut(d, n);
2755
+ a += l * s[i + d][0], o += l * s[i + d][1];
2756
+ }
2757
+ t.push([a, o]);
2758
+ }
2759
+ return t.push(s[s.length - 1]), t;
2760
+ }
2761
+ function ut(s, e) {
2762
+ return s === 0 ? Math.pow(e - 1, 2) / 2 : s === 1 ? (-2 * Math.pow(e, 2) + 2 * e + 1) / 2 : s === 2 ? Math.pow(e, 2) / 2 : 0;
2763
+ }
2764
+ function It(s, e) {
2765
+ return W(s, e);
2766
+ }
2767
+ function Rt(s, e) {
2768
+ return fe(s, e);
2769
+ }
2770
+ function Nt(s) {
2771
+ return !s || s.length < 3 ? [] : ge(s);
2772
+ }
2773
+ function At(s) {
2774
+ return !s || s.length < 3 ? [] : pe(s);
2775
+ }
2776
+ function Lt(s) {
2777
+ return !s || s.length < 2 ? [] : ce(s);
2778
+ }
2288
2779
  export {
2289
- ft as ArcgisTilesRenderer,
2290
- et as GisPlotArrow,
2291
- C as GisPlotBase,
2292
- rt as GisPlotCircle,
2293
- ze as GisPlotLine,
2294
- Be as GisPlotPoint,
2295
- Qe as GisPlotPolygon,
2296
- je as GisPlotRectangle,
2297
- He as GisPlotSector,
2298
- tt as GisPlotText,
2299
- st as GroundDecalManager,
2300
- k as MaterialType,
2301
- Q as OverlayManager,
2302
- l as OverlayType,
2303
- mt as TerrainTilesRenderer,
2304
- I as TerrainType,
2780
+ Mt as ArcgisTilesRenderer,
2781
+ ne as FITTING_COUNT,
2782
+ Be as GisPlotArrow,
2783
+ _ as GisPlotBase,
2784
+ Qe as GisPlotCircle,
2785
+ Je as GisPlotLine,
2786
+ Fe as GisPlotPoint,
2787
+ Ue as GisPlotPolygon,
2788
+ We as GisPlotRectangle,
2789
+ ze as GisPlotSector,
2790
+ je as GisPlotText,
2791
+ tt as GroundDecalManager,
2792
+ T as MaterialType,
2793
+ k as MathDistance,
2794
+ ye as Mid,
2795
+ N as OverlayManager,
2796
+ u as OverlayType,
2797
+ et as PlotPrimitiveBridge,
2798
+ St as TerrainTilesRenderer,
2799
+ w as TerrainType,
2305
2800
  Ae as TileCustomMaterialPlugin,
2306
- lt as TilesRenderer,
2307
- vt as TilesRendererManager,
2308
- pt as default
2801
+ at as TilesRenderer,
2802
+ wt as TilesRendererManager,
2803
+ H as ZERO_TOLERANCE,
2804
+ Rt as createAssaultDirectionArrow,
2805
+ Nt as createAttackArrow,
2806
+ Lt as createCurvedArrow,
2807
+ It as createFineArrow,
2808
+ At as createSwallowtailAttackArrow,
2809
+ _t as default,
2810
+ Pt as getAngleOfThreePoints,
2811
+ $ as getAzimuth,
2812
+ Tt as getBaseLength,
2813
+ X as getBisectorNormals,
2814
+ kt as getCurvePoints,
2815
+ Q as getNormal,
2816
+ Et as getQBSplinePoints,
2817
+ xt as getThirdPoint,
2818
+ lt as isClockWise,
2819
+ Ct as parseColorToRGBA,
2820
+ Ve as plotOrderToRenderOrder,
2821
+ bt as resolveOpacity,
2822
+ qe as sanitizePlotOrder,
2823
+ ot as wholeDistance
2309
2824
  };