@soonspacejs/plugin-tiles 2.14.35 → 2.15.0

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,9 +1,8 @@
1
1
  import ee from "soonspacejs";
2
- import { TilesRenderer as R } from "um-3d-tiles-renderer";
3
- import { GLTFLoader as pe } from "three/examples/jsm/loaders/GLTFLoader.js";
4
- import { MathUtils as C, MeshBasicMaterial as Me, Color as z, Vector3 as _e, Box3 as Oe, Sphere as Te, MeshStandardMaterial as we, ShaderMaterial as ue } from "three";
5
- import { TilesFadePlugin as te, UpdateOnChangePlugin as se, QuantizedMeshPlugin as q, ImageOverlayPlugin as me, XYZTilesOverlay as ye, ReorientationPlugin as re, GeoJSONOverlay as Pe, CesiumIonOverlay as Se, TMSTilesOverlay as Ce, UrlTemplateTilesOverlay as Le, WMSTilesOverlay as Ee, WMTSCapabilitiesLoader as be, WMTSTilesOverlay as Ie, CesiumIonAuthPlugin as fe } from "um-3d-tiles-renderer/plugins";
6
- import { PlotOverlay as Re } from "um-3d-tiles-renderer/three/plugins";
2
+ import { TilesRenderer as x } from "um-3d-tiles-renderer";
3
+ import { GLTFLoader as ge } from "three/examples/jsm/loaders/GLTFLoader.js";
4
+ import { MathUtils as L, MeshBasicMaterial as pe, Color as z, Vector3 as _e, Box3 as Te, Sphere as Oe, MeshStandardMaterial as we, ShaderMaterial as he } from "three";
5
+ import { TilesFadePlugin as te, UpdateOnChangePlugin as se, QuantizedMeshPlugin as $, ImageOverlayPlugin as me, XYZTilesOverlay as fe, ReorientationPlugin as re, GeoJSONOverlay as Se, CesiumIonOverlay as Pe, TMSTilesOverlay as Ce, UrlTemplateTilesOverlay as Le, WMSTilesOverlay as Ee, WMTSCapabilitiesLoader as Ie, WMTSTilesOverlay as be, CesiumIonAuthPlugin as ye, PlotSdfPlugin as Re } from "um-3d-tiles-renderer/plugins";
7
6
  class xe {
8
7
  constructor(e) {
9
8
  this.parser = e, this.name = "KHR_texture_basisu_patch";
@@ -18,7 +17,7 @@ class xe {
18
17
  return t.loadTextureImage(e, a, o);
19
18
  }
20
19
  }
21
- class gt {
20
+ class ct {
22
21
  constructor(e) {
23
22
  this.ssp = e;
24
23
  const { controls: t, viewport: s } = e;
@@ -48,18 +47,18 @@ class gt {
48
47
  ee.utils.warn(`${e} already loaded`);
49
48
  return;
50
49
  }
51
- const { ssp: t, ssp: { viewport: s } } = this, r = new R(e);
50
+ const { ssp: t, ssp: { viewport: s } } = this, r = new x(e);
52
51
  this.lruCache === null ? this.lruCache = r.lruCache : r.lruCache = this.lruCache, this.parseQueue === null ? this.parseQueue = r.parseQueue : r.parseQueue = this.parseQueue, this.downloadQueue === null ? this.downloadQueue = r.downloadQueue : r.downloadQueue = this.downloadQueue;
53
- const a = new pe(r.manager);
54
- a.register((d) => new xe(d));
55
- const { dracoLoader: n, ktx2Loader: o, meshoptDecoder: h } = t.manager.store.modelManager.gltfLoader;
56
- n && a.setDRACOLoader(n), o && a.setKTX2Loader(o), h && a.setMeshoptDecoder(h), r.manager.addHandler(/\.gltf$/, a), this.tilesMap.set(e, r), r.setCamera(this._tilesCamera), r.setResolutionFromRenderer(this._tilesCamera, s.renderer), r.lruCache.maxSize = 600, r.lruCache.minSize = 300, r.lruCache.unloadPercent = 0.8, t.addObject(r.group);
52
+ const a = new ge(r.manager);
53
+ a.register((h) => new xe(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), r.manager.addHandler(/\.gltf$/, a), this.tilesMap.set(e, r), r.setCamera(this._tilesCamera), r.setResolutionFromRenderer(this._tilesCamera, s.renderer), r.lruCache.maxSize = 600, r.lruCache.minSize = 300, r.lruCache.unloadPercent = 0.8, t.addObject(r.group);
57
56
  const u = () => {
58
57
  this.cameraTransitionStart || (this.needsUpdate = !0, t.render());
59
58
  };
60
- return r.addEventListener("load-model", u), new Promise((d) => {
59
+ return r.addEventListener("load-model", u), new Promise((h) => {
61
60
  r.addEventListener("load-tile-set", () => {
62
- u(), d(r);
61
+ u(), h(r);
63
62
  });
64
63
  });
65
64
  }
@@ -72,23 +71,23 @@ let ke = class {
72
71
  priority = -999;
73
72
  processTileModel(e) {
74
73
  e.traverse((t) => {
75
- t.material && (t.material = new Me());
74
+ t.material && (t.material = new pe());
76
75
  });
77
76
  }
78
77
  };
79
78
  const De = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/";
80
- class mt {
79
+ class pt {
81
80
  constructor(e) {
82
- this.ssp = e, this.tiles = new R(De), this.tiles.fetchData = async (t, s) => {
81
+ this.ssp = e, this.tiles = new x(De), this.tiles.fetchData = async (t, s) => {
83
82
  if (/layer\.json$/.test(t)) {
84
83
  const r = await fetch(t, s).then((a) => a.json());
85
84
  return r.metadataAvailability = -1, new Response(JSON.stringify(r));
86
85
  }
87
86
  return fetch(t, s);
88
- }, this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), this.quantizedPlugin = new q({}), this.customMaterialPlugin = new ke(), this.imageOverlayPlugin = new me({
87
+ }, this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), this.quantizedPlugin = new $({}), this.customMaterialPlugin = new ke(), this.imageOverlayPlugin = new me({
89
88
  renderer: e.viewport.renderer,
90
89
  overlays: [
91
- new ye({
90
+ new fe({
92
91
  url: "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
93
92
  })
94
93
  ]
@@ -123,7 +122,7 @@ class mt {
123
122
  }
124
123
  invalidate(e, t, s) {
125
124
  const r = () => {
126
- const n = C.degToRad(t), o = C.degToRad(e);
125
+ const n = L.degToRad(t), o = L.degToRad(e);
127
126
  this.reorientationPlugin.transformLatLonHeightToOrigin(
128
127
  n,
129
128
  o,
@@ -140,10 +139,10 @@ class mt {
140
139
  ), this.loedTilesSets.clear(), this.tiles.removeEventListener("needs-render", this.render), this.tiles.removeEventListener("needs-update", this.render), this.tiles.dispose();
141
140
  }
142
141
  }
143
- class Ne {
142
+ class Fe {
144
143
  // 使用较低的 priority 确保在 ImageOverlayPlugin 之后执行
145
144
  // ImageOverlayPlugin 默认 priority 是 -1
146
- priority = -10;
145
+ priority = -999;
147
146
  /** Alpha 裁剪模式 */
148
147
  alphaClipMode = "alphaTest";
149
148
  /**
@@ -151,7 +150,7 @@ class Ne {
151
150
  */
152
151
  processTileModel(e) {
153
152
  e.traverse((t) => {
154
- t.material && this._applyToMaterial(t.material);
153
+ t.material && (t.material = new pe());
155
154
  });
156
155
  }
157
156
  /**
@@ -161,7 +160,7 @@ class Ne {
161
160
  updateAllLoadedModels(e) {
162
161
  e.forEachLoadedModel((t) => {
163
162
  t.traverse((s) => {
164
- s.material && this._applyToMaterial(s.material);
163
+ s.material;
165
164
  });
166
165
  });
167
166
  }
@@ -183,8 +182,8 @@ class Ne {
183
182
  e.needsUpdate = !0;
184
183
  }
185
184
  }
186
- var l = /* @__PURE__ */ ((i) => (i.GEOJSON = "geojson", i.CESIUM_ION = "cesiumIon", i.TMS = "tms", i.XYZ = "xyz", i.WMS = "wms", i.WMTS = "wmts", i.URL_TEMPLATE = "urlTemplate", i.PLOT = "plot", i))(l || {}), U = /* @__PURE__ */ ((i) => (i.QUANTIZED_MESH = "quantizedMesh", i.CESIUM_ION = "cesiumIon", i))(U || {});
187
- class Ae {
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 || {}), C = /* @__PURE__ */ ((i) => (i.QUANTIZED_MESH = "quantizedMesh", i.CESIUM_ION = "cesiumIon", i))(C || {});
186
+ class Ne {
188
187
  constructor(e, t) {
189
188
  this.imageOverlayPlugin = e, this.resourceManager = t;
190
189
  }
@@ -204,7 +203,7 @@ class Ae {
204
203
  strokeWidth: e.strokeWidth
205
204
  };
206
205
  e.color && (t.color = new z(e.color));
207
- const s = new Pe(t);
206
+ const s = new Se(t);
208
207
  return this.imageOverlayPlugin.addOverlay(s, e.order), this._instances.set(e.id, {
209
208
  id: e.id,
210
209
  type: l.GEOJSON,
@@ -250,7 +249,7 @@ class Ae {
250
249
  if (!this.imageOverlayPlugin) return null;
251
250
  if (this._instances.has(e.id))
252
251
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
253
- const t = new Se({
252
+ const t = new Pe({
254
253
  assetId: e.assetId,
255
254
  apiToken: e.apiToken,
256
255
  autoRefreshToken: e.autoRefreshToken ?? !0,
@@ -292,7 +291,7 @@ class Ae {
292
291
  if (!this.imageOverlayPlugin) return null;
293
292
  if (this._instances.has(e.id))
294
293
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
295
- const t = new ye({
294
+ const t = new fe({
296
295
  url: e.url,
297
296
  color: typeof e.color == "number" ? e.color : 16777215,
298
297
  opacity: e.opacity ?? 1
@@ -400,12 +399,12 @@ class Ae {
400
399
  if (!this.imageOverlayPlugin) return null;
401
400
  if (this._instances.has(e.id))
402
401
  return console.warn(`OverlayManager: Overlay "${e.id}" already exists`), null;
403
- const t = await new be().loadAsync(e.url), s = ["EPSG:4326", "EPSG:3857"];
402
+ const t = await new Ie().loadAsync(e.url), s = ["EPSG:4326", "EPSG:3857"];
404
403
  let r = e.layer || "";
405
404
  t.layers.find((n) => n.identifier === r) || (r = t.layers.find(
406
405
  (n) => n?.tileMatrixSets?.some((o) => s.includes(o.supportedCRS))
407
406
  )?.identifier || t.layers[0].identifier);
408
- const a = new Ie({
407
+ const a = new be({
409
408
  capabilities: t,
410
409
  layer: r,
411
410
  dimensions: e.dimensions || null,
@@ -574,9 +573,7 @@ class Ae {
574
573
  * 只清理实例(保留 ResourceManager 中的配置)
575
574
  */
576
575
  disposeInstances() {
577
- console.log("disposeInstances"), console.log(this._instances);
578
- debugger;
579
- this._instances.forEach((e) => {
576
+ console.log("disposeInstances"), console.log(this._instances), this._instances.forEach((e) => {
580
577
  this.imageOverlayPlugin?.deleteOverlay(e.instance);
581
578
  }), this._instances.clear();
582
579
  }
@@ -587,7 +584,7 @@ class Ae {
587
584
  this.disposeInstances(), this.resourceManager?.clear();
588
585
  }
589
586
  }
590
- class Fe {
587
+ class Ae {
591
588
  /** Overlay 资源配置 */
592
589
  _overlays = /* @__PURE__ */ new Map();
593
590
  // =============== Overlay 资源管理 ===============
@@ -677,7 +674,7 @@ class Fe {
677
674
  e.overlays && (this._overlays.clear(), e.overlays.forEach((t) => this._overlays.set(t.id, { ...t })));
678
675
  }
679
676
  }
680
- class Ge {
677
+ class Ue {
681
678
  /** 地形配置映射表 */
682
679
  _terrains = /* @__PURE__ */ new Map();
683
680
  /** 当前激活的地形 ID */
@@ -766,13 +763,13 @@ class Ge {
766
763
  this.clear();
767
764
  }
768
765
  }
769
- let Ue = 1;
770
- class S {
766
+ let Ge = 1;
767
+ class P {
771
768
  id;
772
769
  category = "";
773
770
  options;
774
771
  constructor(e) {
775
- this.id = String(Ue++), this.category = "", this.options = { ...e }, this.options.points && (this.options.points = this.options.points.map((t) => [t[0], t[1]]));
772
+ this.id = String(Ge++), this.category = "", this.options = { ...e }, this.options.points && (this.options.points = this.options.points.map((t) => [t[0], t[1]]));
776
773
  }
777
774
  /**
778
775
  * 合并更新 `options`(不可变风格:整表替换为新对象)。
@@ -805,7 +802,7 @@ class S {
805
802
  return this.options.points || [];
806
803
  }
807
804
  }
808
- class We extends S {
805
+ class We extends P {
809
806
  category = "point";
810
807
  constructor(e) {
811
808
  super(e);
@@ -821,7 +818,7 @@ class We extends S {
821
818
  return this.getCenterPoints();
822
819
  }
823
820
  }
824
- class Qe extends S {
821
+ class Qe extends P {
825
822
  category = "line";
826
823
  constructor(e) {
827
824
  super(e);
@@ -830,7 +827,7 @@ class Qe extends S {
830
827
  this.options = { ...this.options, ...e };
831
828
  }
832
829
  }
833
- class je extends S {
830
+ class He extends P {
834
831
  category = "polygon";
835
832
  constructor(e) {
836
833
  super(e);
@@ -839,9 +836,7 @@ class je extends S {
839
836
  this.options = { ...this.options, ...e };
840
837
  }
841
838
  }
842
- const ie = C.DEG2RAD;
843
- new _e();
844
- class He extends S {
839
+ class je extends P {
845
840
  category = "rectangle";
846
841
  constructor(e) {
847
842
  super(e);
@@ -849,18 +844,10 @@ class He extends S {
849
844
  update(e) {
850
845
  this.options = { ...this.options, ...e };
851
846
  }
852
- getExtentPoints() {
853
- const e = this.options.points;
854
- if (!e || e.length === 0) return [];
855
- const t = e[0][0], s = e[0][1], r = (this.options.width || 0) / 2, a = (this.options.height || 0) / 2, n = r / (111320 * Math.cos(s * ie)), o = a / 111320;
856
- return [
857
- [t, s],
858
- [t - n, s - o],
859
- [t + n, s + o]
860
- ];
861
- }
862
847
  }
863
- class Be extends S {
848
+ const ve = L.DEG2RAD;
849
+ new _e();
850
+ class Be extends P {
864
851
  category = "sector";
865
852
  constructor(e) {
866
853
  super(e);
@@ -871,123 +858,123 @@ class Be extends S {
871
858
  getExtentPoints() {
872
859
  const e = this.options.points;
873
860
  if (!e || e.length === 0) return [];
874
- const t = e[0][0], s = e[0][1], r = this.options.radius || 0, a = r / (111320 * Math.cos(s * ie)), n = r / 111320;
861
+ const t = e[0][0], s = e[0][1], r = this.options.radius || 0, a = r / (111320 * Math.cos(s * ve)), n = r / 111320;
875
862
  return [
876
863
  [t - a, s - n],
877
864
  [t + a, s + n]
878
865
  ];
879
866
  }
880
867
  }
881
- const ce = 100, ae = 1e-4;
882
- function T(i, e) {
868
+ const ue = 100, ie = 1e-4;
869
+ function O(i, e) {
883
870
  return Math.sqrt((i[0] - e[0]) ** 2 + (i[1] - e[1]) ** 2);
884
871
  }
885
- function ne(i) {
872
+ function ae(i) {
886
873
  let e = 0;
887
874
  for (let t = 0; t < i.length - 1; t++)
888
- e += T(i[t], i[t + 1]);
875
+ e += O(i[t], i[t + 1]);
889
876
  return e;
890
877
  }
891
878
  function Q(i) {
892
- return ne(i) ** 0.99;
879
+ return ae(i) ** 0.99;
893
880
  }
894
- function oe(i, e) {
881
+ function ne(i, e) {
895
882
  return [(i[0] + e[0]) / 2, (i[1] + e[1]) / 2];
896
883
  }
897
- function Z(i, e) {
884
+ function q(i, e) {
898
885
  const t = Math.asin(
899
- Math.abs(e[1] - i[1]) / T(i, e)
886
+ Math.abs(e[1] - i[1]) / O(i, e)
900
887
  );
901
888
  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;
902
889
  }
903
890
  function Je(i, e, t) {
904
- const s = Z(e, i) - Z(e, t);
891
+ const s = q(e, i) - q(e, t);
905
892
  return s < 0 ? s + Math.PI * 2 : s;
906
893
  }
907
- function ve(i, e, t) {
894
+ function Me(i, e, t) {
908
895
  return (t[1] - i[1]) * (e[0] - i[0]) > (e[1] - i[1]) * (t[0] - i[0]);
909
896
  }
910
- function y(i, e, t, s, r) {
911
- const a = Z(i, e), n = r ? a + t : a - t;
897
+ function f(i, e, t, s, r) {
898
+ const a = q(i, e), n = r ? a + t : a - t;
912
899
  return [e[0] + s * Math.cos(n), e[1] + s * Math.sin(n)];
913
900
  }
914
- function le(i, e, t) {
901
+ function oe(i, e, t) {
915
902
  let s = i[0] - e[0], r = i[1] - e[1];
916
903
  const a = Math.sqrt(s * s + r * r);
917
904
  s /= a, r /= a;
918
905
  let n = t[0] - e[0], o = t[1] - e[1];
919
- const h = Math.sqrt(n * n + o * o);
920
- return n /= h, o /= h, [s + n, r + o];
906
+ const d = Math.sqrt(n * n + o * o);
907
+ return n /= d, o /= d, [s + n, r + o];
921
908
  }
922
- function he(i, e, t, s) {
923
- const r = le(e, t, s), a = Math.sqrt(r[0] ** 2 + r[1] ** 2), n = T(e, t), o = T(t, s);
924
- let h, u;
925
- if (a > ae) {
926
- const d = r[0] / a, c = r[1] / a;
927
- ve(e, t, s) ? (h = [t[0] - i * n * c, t[1] + i * n * d], u = [t[0] + i * o * c, t[1] - i * o * d]) : (h = [t[0] + i * n * c, t[1] - i * n * d], u = [t[0] - i * o * c, t[1] + i * o * d]);
909
+ function le(i, e, t, s) {
910
+ const r = oe(e, t, s), a = Math.sqrt(r[0] ** 2 + r[1] ** 2), n = O(e, t), o = O(t, s);
911
+ let d, u;
912
+ if (a > ie) {
913
+ const h = r[0] / a, c = r[1] / a;
914
+ Me(e, t, s) ? (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]);
928
915
  } else
929
- h = [t[0] + i * (e[0] - t[0]), t[1] + i * (e[1] - t[1])], u = [t[0] + i * (s[0] - t[0]), t[1] + i * (s[1] - t[1])];
930
- return [h, u];
916
+ d = [t[0] + i * (e[0] - t[0]), t[1] + i * (e[1] - t[1])], u = [t[0] + i * (s[0] - t[0]), t[1] + i * (s[1] - t[1])];
917
+ return [d, u];
931
918
  }
932
919
  function ze(i, e) {
933
- const [t, s, r] = [i[0], i[1], i[2]], n = he(0, t, s, r)[0], o = le(t, s, r);
934
- if (Math.sqrt(o[0] ** 2 + o[1] ** 2) > ae) {
935
- const u = oe(t, s), d = t[0] - u[0], c = t[1] - u[1], g = 2 / T(t, s), m = -g * c, p = g * d, f = m * m - p * p, M = 2 * m * p, _ = p * p - m * m, w = n[0] - u[0], P = n[1] - u[1];
936
- return [u[0] + f * w + M * P, u[1] + M * w + _ * P];
920
+ const [t, s, r] = [i[0], i[1], i[2]], n = le(0, t, s, r)[0], o = oe(t, s, r);
921
+ if (Math.sqrt(o[0] ** 2 + o[1] ** 2) > ie) {
922
+ const u = ne(t, s), h = t[0] - u[0], c = t[1] - u[1], g = 2 / O(t, s), m = -g * c, p = g * h, y = m * m - p * p, M = 2 * m * p, _ = p * p - m * m, w = n[0] - u[0], S = n[1] - u[1];
923
+ return [u[0] + y * w + M * S, u[1] + M * w + _ * S];
937
924
  }
938
925
  return [t[0] + e * (s[0] - t[0]), t[1] + e * (s[1] - t[1])];
939
926
  }
940
927
  function Xe(i, e) {
941
- const t = i.length, [s, r, a] = [i[t - 3], i[t - 2], i[t - 1]], o = he(0, s, r, a)[1], h = le(s, r, a);
942
- if (Math.sqrt(h[0] ** 2 + h[1] ** 2) > ae) {
943
- const d = oe(r, a), c = a[0] - d[0], g = a[1] - d[1], m = 2 / T(r, a), p = -m * g, f = m * c, M = p * p - f * f, _ = 2 * p * f, w = f * f - p * p, P = o[0] - d[0], L = o[1] - d[1];
944
- return [d[0] + M * P + _ * L, d[1] + _ * P + w * L];
928
+ const t = i.length, [s, r, a] = [i[t - 3], i[t - 2], i[t - 1]], o = le(0, s, r, a)[1], d = oe(s, r, a);
929
+ if (Math.sqrt(d[0] ** 2 + d[1] ** 2) > ie) {
930
+ const h = ne(r, a), c = a[0] - h[0], g = a[1] - h[1], m = 2 / O(r, a), p = -m * g, y = m * c, M = p * p - y * y, _ = 2 * p * y, w = y * y - p * p, S = o[0] - h[0], E = o[1] - h[1];
931
+ return [h[0] + M * S + _ * E, h[1] + _ * S + w * E];
945
932
  }
946
933
  return [a[0] + e * (r[0] - a[0]), a[1] + e * (r[1] - a[1])];
947
934
  }
948
935
  function Ye(i, e) {
949
936
  let s = [ze(e, i)];
950
937
  for (let n = 0; n < e.length - 2; n++) {
951
- const o = he(i, e[n], e[n + 1], e[n + 2]);
938
+ const o = le(i, e[n], e[n + 1], e[n + 2]);
952
939
  s = s.concat(o);
953
940
  }
954
941
  const r = Xe(e, i);
955
942
  r && s.push(r);
956
943
  const a = [];
957
944
  for (let n = 0; n < e.length - 1; n++) {
958
- const o = e[n], h = e[n + 1];
945
+ const o = e[n], d = e[n + 1];
959
946
  a.push(o);
960
- for (let u = 0; u < ce; u++) {
961
- const d = u / ce, c = 1 - d, g = d * d, m = g * d, p = c * c, f = p * c, M = s[n * 2], _ = s[n * 2 + 1];
947
+ for (let u = 0; u < ue; u++) {
948
+ const h = u / ue, c = 1 - h, g = h * h, m = g * h, p = c * c, y = p * c, M = s[n * 2], _ = s[n * 2 + 1];
962
949
  a.push([
963
- f * o[0] + 3 * p * d * M[0] + 3 * c * g * _[0] + m * h[0],
964
- f * o[1] + 3 * p * d * M[1] + 3 * c * g * _[1] + m * h[1]
950
+ y * o[0] + 3 * p * h * M[0] + 3 * c * g * _[0] + m * d[0],
951
+ y * o[1] + 3 * p * h * M[1] + 3 * c * g * _[1] + m * d[1]
965
952
  ]);
966
953
  }
967
- a.push(h);
954
+ a.push(d);
968
955
  }
969
956
  return a;
970
957
  }
971
- function $e(i, e) {
958
+ function Ze(i, e) {
972
959
  return i === 0 ? (e - 1) ** 2 / 2 : i === 1 ? (-2 * e ** 2 + 2 * e + 1) / 2 : i === 2 ? e ** 2 / 2 : 0;
973
960
  }
974
- function ge(i) {
961
+ function ce(i) {
975
962
  if (i.length <= 2) return i;
976
963
  const e = [i[0]], t = i.length - 3;
977
964
  for (let s = 0; s <= t; s++)
978
965
  for (let r = 0; r <= 1; r += 0.05) {
979
966
  let a = 0, n = 0;
980
967
  for (let o = 0; o <= 2; o++) {
981
- const h = $e(o, r);
982
- a += h * i[s + o][0], n += h * i[s + o][1];
968
+ const d = Ze(o, r);
969
+ a += d * i[s + o][0], n += d * i[s + o][1];
983
970
  }
984
971
  e.push([a, n]);
985
972
  }
986
973
  return e.push(i[i.length - 1]), e;
987
974
  }
988
975
  function V(i, e) {
989
- const t = Q([i, e]), s = t * 0.1, r = t * 0.2, a = t * 0.25, n = Math.PI / 8.5, o = Math.PI / 13, h = y(e, i, Math.PI / 2, s, !0), u = y(e, i, Math.PI / 2, s, !1), d = y(i, e, n, a, !1), c = y(i, e, n, a, !0), g = y(i, e, o, r, !1), m = y(i, e, o, r, !0);
990
- return [h, g, d, e, c, m, u, i];
976
+ const t = Q([i, e]), s = t * 0.1, r = t * 0.2, a = t * 0.25, n = Math.PI / 8.5, o = Math.PI / 13, d = f(e, i, Math.PI / 2, s, !0), u = f(e, i, Math.PI / 2, s, !1), h = f(i, e, n, a, !1), c = f(i, e, n, a, !0), g = f(i, e, o, r, !1), m = f(i, e, o, r, !0);
977
+ return [d, g, h, e, c, m, u, i];
991
978
  }
992
979
  function K(i, e) {
993
980
  if (i.length <= e) return i;
@@ -996,43 +983,43 @@ function K(i, e) {
996
983
  t.push(i[Math.round(r * s)]);
997
984
  return t.push(i[i.length - 1]), t;
998
985
  }
999
- function qe(i) {
986
+ function $e(i) {
1000
987
  if (i.length === 2)
1001
988
  return V(i[0], i[1]);
1002
- const e = Ye(0.3, i), t = K(e, 25), s = ne(t), r = 0.08, a = 0.12, n = 0.2, o = Math.PI / 8.5, h = Math.PI / 13, u = 0.15, d = s * r, c = s * u, g = [], m = [];
989
+ const e = Ye(0.3, i), t = K(e, 25), s = ae(t), r = 0.08, a = 0.12, n = 0.2, o = Math.PI / 8.5, d = Math.PI / 13, u = 0.15, h = s * r, c = s * u, g = [], m = [];
1003
990
  let p = 0;
1004
- const f = s - c;
1005
- for (let v = 0; v < t.length && (v > 0 && (p += T(t[v - 1], t[v])), !(p > f)); v++) {
1006
- const H = f > 0 ? p / f : 0, D = d * (1 - H * 0.5), N = v > 0 ? t[v - 1] : t[0], W = v < t.length - 1 ? t[v + 1] : t[v], A = W[0] - N[0], E = W[1] - N[1], F = Math.sqrt(A * A + E * E) || 1, G = -E / F, b = A / F;
1007
- g.push([t[v][0] + G * D, t[v][1] + b * D]), m.push([t[v][0] - G * D, t[v][1] - b * D]);
991
+ const y = s - c;
992
+ for (let v = 0; v < t.length && (v > 0 && (p += O(t[v - 1], t[v])), !(p > y)); v++) {
993
+ const j = y > 0 ? p / y : 0, F = h * (1 - j * 0.5), N = v > 0 ? t[v - 1] : t[0], W = v < t.length - 1 ? t[v + 1] : t[v], A = W[0] - N[0], I = W[1] - N[1], U = Math.sqrt(A * A + I * I) || 1, G = -I / U, b = A / U;
994
+ g.push([t[v][0] + G * F, t[v][1] + b * F]), m.push([t[v][0] - G * F, t[v][1] - b * F]);
1008
995
  }
1009
- const M = t[t.length - 1], _ = t[t.length - 2], w = s * a, P = s * n, L = y(_, M, h, w, !1), x = y(_, M, h, w, !0), k = y(_, M, o, P, !1), j = y(_, M, o, P, !0);
1010
- return [...g, L, k, M, j, x, ...m.reverse()];
996
+ const M = t[t.length - 1], _ = t[t.length - 2], w = s * a, S = s * n, E = f(_, M, d, w, !1), k = f(_, M, d, w, !0), D = f(_, M, o, S, !1), H = f(_, M, o, S, !0);
997
+ return [...g, E, D, M, H, k, ...m.reverse()];
1011
998
  }
1012
- function Ze(i) {
999
+ function qe(i) {
1013
1000
  let e = i[0], t = i[1];
1014
- ve(i[0], i[1], i[2]) && (e = i[1], t = i[0]);
1015
- const r = [oe(e, t), ...i.slice(2)], a = 0.18, n = 0.3, o = 0.85, h = 0.15, u = 0.8;
1016
- let d = Q(r), c = d * a;
1001
+ Me(i[0], i[1], i[2]) && (e = i[1], t = i[0]);
1002
+ const r = [ne(e, t), ...i.slice(2)], a = 0.18, n = 0.3, o = 0.85, d = 0.15, u = 0.8;
1003
+ let h = Q(r), c = h * a;
1017
1004
  const g = r[r.length - 1];
1018
- d = T(g, r[r.length - 2]);
1019
- const m = T(e, t);
1005
+ h = O(g, r[r.length - 2]);
1006
+ const m = O(e, t);
1020
1007
  c > m * u && (c = m * u);
1021
- const p = c * n, f = c * h;
1022
- c = Math.min(c, d);
1023
- const M = c * o, _ = y(r[r.length - 2], g, 0, c, !0), w = y(r[r.length - 2], g, 0, M, !0), P = y(g, _, Math.PI / 2, p, !1), L = y(g, _, Math.PI / 2, p, !0), x = y(g, w, Math.PI / 2, f, !1), k = y(g, w, Math.PI / 2, f, !0), j = [x, P, g, L, k], v = m / Q(r), H = ne(r), N = Q(r) * v, W = T(x, k), A = (N - W) / 2;
1024
- let E = 0;
1025
- const F = [], G = [];
1026
- for (let O = 1; O < r.length - 1; O++) {
1027
- const J = Je(r[O - 1], r[O], r[O + 1]) / 2;
1028
- E += T(r[O - 1], r[O]);
1029
- const de = (N / 2 - E / H * A) / Math.sin(J);
1030
- F.push(y(r[O - 1], r[O], Math.PI - J, de, !0)), G.push(y(r[O - 1], r[O], J, de, !1));
1031
- }
1032
- let b = [e, ...F, x], B = [t, ...G, k];
1033
- return b = K(ge(b), 25), B = K(ge(B), 25), [...b, ...j, ...B.reverse()];
1008
+ const p = c * n, y = c * d;
1009
+ c = Math.min(c, h);
1010
+ const M = c * o, _ = f(r[r.length - 2], g, 0, c, !0), w = f(r[r.length - 2], g, 0, M, !0), S = f(g, _, Math.PI / 2, p, !1), E = f(g, _, Math.PI / 2, p, !0), k = f(g, w, Math.PI / 2, y, !1), D = f(g, w, Math.PI / 2, y, !0), H = [k, S, g, E, D], v = m / Q(r), j = ae(r), N = Q(r) * v, W = O(k, D), A = (N - W) / 2;
1011
+ let I = 0;
1012
+ const U = [], G = [];
1013
+ for (let T = 1; T < r.length - 1; T++) {
1014
+ const J = Je(r[T - 1], r[T], r[T + 1]) / 2;
1015
+ I += O(r[T - 1], r[T]);
1016
+ const de = (N / 2 - I / j * A) / Math.sin(J);
1017
+ U.push(f(r[T - 1], r[T], Math.PI - J, de, !0)), G.push(f(r[T - 1], r[T], J, de, !1));
1018
+ }
1019
+ let b = [e, ...U, k], B = [t, ...G, D];
1020
+ return b = K(ce(b), 25), B = K(ce(B), 25), [...b, ...H, ...B.reverse()];
1034
1021
  }
1035
- class Ve extends S {
1022
+ class Ve extends P {
1036
1023
  category = "arrow";
1037
1024
  /** `generateCoords()` 填充的闭合多边形顶点 */
1038
1025
  generatedCoords = [];
@@ -1050,7 +1037,7 @@ class Ve extends S {
1050
1037
  if (!e || e.length < 2)
1051
1038
  return this.generatedCoords = [], [];
1052
1039
  const t = this.options.arrowType || "straight";
1053
- return t === "fine" ? this.generatedCoords = V(e[0], e[1]) : t === "curved" ? this.generatedCoords = qe(e) : t === "attack" && e.length >= 3 ? this.generatedCoords = Ze(e) : this.generatedCoords = V(e[0], e[e.length - 1]), this.generatedCoords;
1040
+ return t === "fine" ? this.generatedCoords = V(e[0], e[1]) : t === "curved" ? this.generatedCoords = $e(e) : t === "attack" && e.length >= 3 ? this.generatedCoords = qe(e) : this.generatedCoords = V(e[0], e[e.length - 1]), this.generatedCoords;
1054
1041
  }
1055
1042
  /** 浅拷贝:`options`、`generatedCoords` 与内部共享引用(顶点数组仍与 `options.points` 规则一致)。 */
1056
1043
  getSnapshot() {
@@ -1070,7 +1057,7 @@ class Ve extends S {
1070
1057
  };
1071
1058
  }
1072
1059
  }
1073
- class Ke extends S {
1060
+ class Ke extends P {
1074
1061
  category = "text";
1075
1062
  constructor(e) {
1076
1063
  super(e);
@@ -1086,7 +1073,7 @@ class Ke extends S {
1086
1073
  return this.getCenterPoints();
1087
1074
  }
1088
1075
  }
1089
- class et extends S {
1076
+ class et extends P {
1090
1077
  category = "circle";
1091
1078
  constructor(e) {
1092
1079
  super(e);
@@ -1097,7 +1084,7 @@ class et extends S {
1097
1084
  getExtentPoints() {
1098
1085
  const e = this.options.points;
1099
1086
  if (!e || e.length === 0) return [];
1100
- const t = e[0][0], s = e[0][1], r = this.options.radius || 0, a = r / (111320 * Math.cos(s * ie)), n = r / 111320;
1087
+ const t = e[0][0], s = e[0][1], r = this.options.radius || 0, a = r / (111320 * Math.cos(s * ve)), n = r / 111320;
1101
1088
  return [
1102
1089
  [t - a, s - n],
1103
1090
  [t + a, s + n]
@@ -1109,32 +1096,30 @@ class tt {
1109
1096
  _items = /* @__PURE__ */ new Map();
1110
1097
  /** 标绘 id */
1111
1098
  id = "GROUND_DECAL_PLOT";
1112
- /** 标绘 overlay */
1113
- _overlay;
1114
1099
  /** SoonSpace 实例 */
1115
1100
  ssp;
1116
- /** 传入的 ImageOverlayPlugin,用于在有图形时自动注册 overlay */
1117
- _imageOverlayPlugin;
1118
- /** overlay 是否已注册到 ImageOverlayPlugin */
1101
+ /** 传入的 PlotSDFPlugin,用于在有图形时自动注册 overlay */
1102
+ _plotSdfPlugin;
1103
+ /** overlay 是否已注册到 PlotSDFPlugin */
1119
1104
  _overlayAttached = !1;
1120
1105
  /** 合并同一帧内多次 `_markDirty`,值为 `requestAnimationFrame` 句柄 */
1121
1106
  _redrawTimer = null;
1122
1107
  constructor(e) {
1123
- this.ssp = e.ssp, this._imageOverlayPlugin = e.imageOverlayPlugin, this._overlay = new Re(), this._overlay.imageSource.shapes = this._items, this._overlay.imageSource.setRenderer(e.ssp.viewport.renderer);
1108
+ this.ssp = e.ssp;
1124
1109
  }
1125
1110
  /**
1126
1111
  * 内部使用的 `PlotOverlay` 实例。
1127
1112
  * 注册到 `ImageOverlayPlugin` 的 `overlays` 数组中,顺序靠后者通常绘制在上层。
1128
1113
  */
1129
- get overlay() {
1130
- return this._overlay;
1114
+ get plotSdfPlugin() {
1115
+ return this._plotSdfPlugin;
1131
1116
  }
1132
1117
  /**
1133
- * 绑定 / 更换 ImageOverlayPlugin(切换地形重建插件后调用)。
1118
+ * 绑定 / 更换 PlotOverlayPlugin(切换地形重建插件后调用)。
1134
1119
  * 如果当前已有图形,会在下一帧自动重新注册 overlay。
1135
1120
  */
1136
- setImageOverlayPlugin(e) {
1137
- this._imageOverlayPlugin = e, this._overlayAttached = !1, this._items.size > 0 && this._markDirty();
1121
+ setPlotSDFPlugin(e) {
1122
+ this._plotSdfPlugin = e, this._overlayAttached = !1, this._items.size > 0 && this._markDirty();
1138
1123
  }
1139
1124
  // ── 图形创建:返回字符串 id,可用于后续查询 / 更新 / 删除 ──
1140
1125
  /**
@@ -1155,12 +1140,12 @@ class tt {
1155
1140
  }
1156
1141
  case "polygon": {
1157
1142
  const { type: s, ...r } = e;
1158
- t = new je(r);
1143
+ t = new He(r);
1159
1144
  break;
1160
1145
  }
1161
1146
  case "rectangle": {
1162
1147
  const { type: s, ...r } = e;
1163
- t = new He(r);
1148
+ t = new je(r);
1164
1149
  break;
1165
1150
  }
1166
1151
  case "circle": {
@@ -1271,7 +1256,7 @@ class tt {
1271
1256
  }
1272
1257
  /** 设置整个 overlay 不透明度(0–1,具体语义以 `PlotOverlay` 为准) */
1273
1258
  setGlobalOpacity(e) {
1274
- this._overlay.opacity = e, this._markDirty();
1259
+ this._plotSdfPlugin.opacity = e, this._markDirty();
1275
1260
  }
1276
1261
  getCoordCount(e) {
1277
1262
  const t = this._items.get(e);
@@ -1286,8 +1271,8 @@ class tt {
1286
1271
  if (!r || !r.options.points || r.options.points.length === 0) return -1;
1287
1272
  let a = 0, n = 1 / 0;
1288
1273
  for (let o = 0; o < r.options.points.length; o++) {
1289
- const h = r.options.points[o][0] - t, u = r.options.points[o][1] - s, d = h * h + u * u;
1290
- d < n && (n = d, a = o);
1274
+ const d = r.options.points[o][0] - t, u = r.options.points[o][1] - s, h = d * d + u * u;
1275
+ h < n && (n = h, a = o);
1291
1276
  }
1292
1277
  return a;
1293
1278
  }
@@ -1296,10 +1281,10 @@ class tt {
1296
1281
  };
1297
1282
  /**
1298
1283
  * 释放 overlay 内部 RTT / 纹理等资源。
1299
- * `PlotImageSource` 的运行时实现含 `dispose`,类型声明可能未列出,故做断言。
1284
+ * `PlotSDFPlugin` 的运行时实现含 `dispose`,类型声明可能未列出,故做断言。
1300
1285
  */
1301
1286
  dispose() {
1302
- this._overlay.imageSource.dispose();
1287
+ this._plotSdfPlugin.dispose();
1303
1288
  }
1304
1289
  /**
1305
1290
  * 标记需要在下一帧重绘瓦片标绘层;同一帧内多次调用只会调度一次。
@@ -1308,16 +1293,16 @@ class tt {
1308
1293
  */
1309
1294
  _markDirty() {
1310
1295
  this._redrawTimer || (this._redrawTimer = requestAnimationFrame(() => {
1311
- this._redrawTimer = null, !this._overlayAttached && this._items.size > 0 && this._imageOverlayPlugin ? (this._imageOverlayPlugin.addOverlay(this._overlay), this._overlayAttached = !0) : this._overlay.redraw(), this.render();
1296
+ this._redrawTimer = null, !this._overlayAttached && this._items.size > 0 && this._plotSdfPlugin && (this._plotSdfPlugin.shapes = this._items, this._overlayAttached = !0), this._plotSdfPlugin.redraw(), this.render();
1312
1297
  }));
1313
1298
  }
1314
1299
  }
1315
1300
  const st = "https://sooncps.xwbuilders.com/api/ugis-dataprocess/v1/terrain/NhBLlMx3/", rt = "https://c.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
1316
- class yt {
1301
+ class mt {
1317
1302
  constructor(e, t = {}) {
1318
1303
  this.ssp = e, this.options = t;
1319
1304
  const s = t.baseUrl || st;
1320
- if (this.resourceManager = new Fe(), this.terrainManager = new Ge(), t.imageryUrl !== !1) {
1305
+ if (this.resourceManager = new Ae(), this.terrainManager = new Ue(), t.imageryUrl !== !1) {
1321
1306
  const r = t.imageryUrl || rt;
1322
1307
  this.resourceManager.addOverlay({
1323
1308
  id: this.defaultImageryId,
@@ -1327,9 +1312,9 @@ class yt {
1327
1312
  }
1328
1313
  this.groundDecalManager = new tt({ ssp: this.ssp }), this._alphaClipMode = t.alphaClipMode ?? "alphaTest", this._currentTerrainConfig = {
1329
1314
  id: this.defaultTerrainId,
1330
- type: U.QUANTIZED_MESH,
1315
+ type: C.QUANTIZED_MESH,
1331
1316
  url: s
1332
- }, this.terrainManager.add(this._currentTerrainConfig), this.terrainManager.setCurrentId(this._currentTerrainConfig.id), this.tiles = this._initTilesRenderer(this._currentTerrainConfig), this._initPlugins(this.tiles, this._currentTerrainConfig), this.imageOverlayPlugin && this.groundDecalManager.setImageOverlayPlugin(this.imageOverlayPlugin);
1317
+ }, this.terrainManager.add(this._currentTerrainConfig), this.terrainManager.setCurrentId(this._currentTerrainConfig.id), this.tiles = this._initTilesRenderer(this._currentTerrainConfig), this._initPlugins(this.tiles, this._currentTerrainConfig);
1333
1318
  }
1334
1319
  defaultTerrainId = "__default_terrain__";
1335
1320
  defaultImageryId = "__default_imagery__";
@@ -1339,6 +1324,8 @@ class yt {
1339
1324
  customMaterialPlugin;
1340
1325
  imageOverlayPlugin;
1341
1326
  reorientationPlugin;
1327
+ /** 标绘 SDF 插件(管理标绘实例) */
1328
+ plotSDFPlugin;
1342
1329
  /** 资源管理器(存储配置) */
1343
1330
  resourceManager;
1344
1331
  /** 地形管理器(记录地形列表) */
@@ -1359,7 +1346,7 @@ class yt {
1359
1346
  * 是否使用 Cesium Ion 地形
1360
1347
  */
1361
1348
  get isCesiumIon() {
1362
- return this._currentTerrainConfig.type === U.CESIUM_ION;
1349
+ return this._currentTerrainConfig.type === C.CESIUM_ION;
1363
1350
  }
1364
1351
  /**
1365
1352
  * 获取当前地形配置
@@ -1405,9 +1392,9 @@ class yt {
1405
1392
  this._alphaClipMode = e, this.customMaterialPlugin && (this.customMaterialPlugin.alphaClipMode = e), this._updateAlphaClipMode(), this.render();
1406
1393
  }
1407
1394
  _initTilesRenderer(e) {
1408
- return e.type === U.CESIUM_ION ? new R() : (
1395
+ return e.type === C.CESIUM_ION ? new x() : (
1409
1396
  // Cesium Ion 由插件设置 URL
1410
- new R(e.url)
1397
+ new x(e.url)
1411
1398
  );
1412
1399
  }
1413
1400
  /**
@@ -1415,30 +1402,43 @@ class yt {
1415
1402
  * @param config 地形配置
1416
1403
  */
1417
1404
  _initPlugins(e, t) {
1418
- if (this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), e.registerPlugin(this.tilesFadePlugin), e.registerPlugin(this.updateOnChangePlugin), t.type === U.CESIUM_ION ? e.registerPlugin(new fe({
1419
- apiToken: t.apiToken,
1420
- assetId: t.assetId || "1",
1421
- autoRefreshToken: t.autoRefreshToken ?? !0,
1422
- assetTypeHandler: (s, r) => {
1423
- s === "TERRAIN" && r.getPluginByName("QUANTIZED_MESH_PLUGIN") === null && r.registerPlugin(new q({ useRecommendedSettings: !0 }));
1424
- }
1425
- })) : (e.registerPlugin(new q({ useRecommendedSettings: !0 })), e.fetchData = async (s) => {
1405
+ if (this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), e.registerPlugin(this.tilesFadePlugin), e.registerPlugin(this.updateOnChangePlugin), t.type === C.CESIUM_ION ? e.registerPlugin(
1406
+ new ye({
1407
+ apiToken: t.apiToken,
1408
+ assetId: t.assetId || "1",
1409
+ autoRefreshToken: t.autoRefreshToken ?? !0,
1410
+ assetTypeHandler: (s, r) => {
1411
+ s === "TERRAIN" && r.getPluginByName("QUANTIZED_MESH_PLUGIN") === null && r.registerPlugin(
1412
+ new $({ useRecommendedSettings: !0 })
1413
+ );
1414
+ }
1415
+ })
1416
+ ) : (e.registerPlugin(
1417
+ new $({ useRecommendedSettings: !0 })
1418
+ ), e.fetchData = async (s) => {
1426
1419
  const r = { method: "GET", mode: "cors" };
1427
1420
  if (/layer\.json$/.test(s)) {
1428
1421
  const a = await fetch(s, r).then((n) => n.json());
1429
1422
  return a.metadataAvailability = -1, new Response(JSON.stringify(a));
1430
1423
  }
1431
1424
  return fetch(s, r);
1432
- }), this.options.useCustomMaterial !== !1 && (this.customMaterialPlugin = new Ne(), this.customMaterialPlugin.alphaClipMode = this._alphaClipMode, e.registerPlugin(this.customMaterialPlugin)), this.imageOverlayPlugin = new me({
1425
+ }), this.options.useCustomMaterial !== !1 && (this.customMaterialPlugin = new Fe(), this.customMaterialPlugin.alphaClipMode = this._alphaClipMode, e.registerPlugin(this.customMaterialPlugin)), this.imageOverlayPlugin = new me({
1433
1426
  renderer: this.ssp.viewport.renderer,
1434
1427
  overlays: []
1435
- }), e.registerPlugin(this.imageOverlayPlugin), this.overlayManager = new Ae(this.imageOverlayPlugin, this.resourceManager), this.overlayManager.restoreFromResourceManager(), this.options.reorientation !== !1) {
1428
+ }), e.registerPlugin(this.imageOverlayPlugin), this.plotSDFPlugin = new Re(), this.groundDecalManager?.setPlotSDFPlugin(this.plotSDFPlugin), this.tiles.registerPlugin(this.plotSDFPlugin), this.overlayManager = new Ne(
1429
+ this.imageOverlayPlugin,
1430
+ this.resourceManager
1431
+ ), this.overlayManager.restoreFromResourceManager(), this.options.reorientation !== !1) {
1436
1432
  const s = this.options.reorientation || { lon: 120, lat: 30 };
1437
1433
  this.reorientationPlugin = new re({
1438
1434
  lon: s.lon,
1439
1435
  lat: s.lat,
1440
1436
  height: s.height ?? 0.1
1441
- }), e.registerPlugin(this.reorientationPlugin), this.invalidate(s.lon, s.lat, s.height ?? 0.1);
1437
+ }), e.registerPlugin(this.reorientationPlugin), this.invalidate(
1438
+ s.lon,
1439
+ s.lat,
1440
+ s.height ?? 0.1
1441
+ );
1442
1442
  }
1443
1443
  e.maxDepth = this.options.maxDepth ?? 20, e.errorTarget = this.options.errorTarget ?? 1, e.addEventListener("needs-render", this.render), e.addEventListener("needs-update", this.render);
1444
1444
  }
@@ -1475,7 +1475,11 @@ class yt {
1475
1475
  * })
1476
1476
  */
1477
1477
  setTerrain(e, t = void 0) {
1478
- e.id !== this._currentTerrainConfig.id && (t && (this.options = { ...this.options, ...t }), this.terrainManager.has(e.id) || this.terrainManager.add(e), this.terrainManager.setCurrentId(e.id), this._disposeTilesRenderer(), this._currentTerrainConfig = e, this.tiles = this._initTilesRenderer(e), this._initPlugins(this.tiles, e), this.imageOverlayPlugin && this.groundDecalManager && this.groundDecalManager.setImageOverlayPlugin(this.imageOverlayPlugin), this._enabled && this.ssp.addObject(this.tiles.group), this.render());
1478
+ 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) {
1479
+ const s = this.terrainManager.getCurrent();
1480
+ e.type === C.QUANTIZED_MESH && s?.type === C.QUANTIZED_MESH && (s.url = e.url);
1481
+ }
1482
+ 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();
1479
1483
  }
1480
1484
  // =============== Overlay 快捷方法 ===============
1481
1485
  /**
@@ -1511,19 +1515,19 @@ class yt {
1511
1515
  }
1512
1516
  /**
1513
1517
  * 添加 URL Template Overlay
1514
- *
1518
+ *
1515
1519
  * 支持多种 URL 模板变量:
1516
1520
  * - `{z}`, `{x}`, `{y}` - 标准 XYZ 坐标
1517
1521
  * - `{s}` - 子域名轮换
1518
1522
  * - `{reverseY}` - TMS 风格的 Y 坐标
1519
1523
  * - `{westDegrees}`, `{southDegrees}`, `{eastDegrees}`, `{northDegrees}` - 地理边界框
1520
- *
1524
+ *
1521
1525
  * @example
1522
1526
  * tilesPlugin.addUrlTemplateOverlay({
1523
1527
  * id: 'osm',
1524
1528
  * url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
1525
1529
  * })
1526
- *
1530
+ *
1527
1531
  * @example
1528
1532
  * tilesPlugin.addUrlTemplateOverlay({
1529
1533
  * id: 'carto',
@@ -1652,7 +1656,9 @@ class yt {
1652
1656
  }
1653
1657
  invalidate(e, t, s) {
1654
1658
  if (!this.reorientationPlugin)
1655
- return console.warn("TilesRenderer: reorientationPlugin is not enabled, invalidate() will not work."), () => {
1659
+ return console.warn(
1660
+ "TilesRenderer: reorientationPlugin is not enabled, invalidate() will not work."
1661
+ ), () => {
1656
1662
  };
1657
1663
  const r = this.reorientationPlugin;
1658
1664
  this.options.reorientation = {
@@ -1661,12 +1667,8 @@ class yt {
1661
1667
  height: s
1662
1668
  };
1663
1669
  const a = () => {
1664
- const o = C.degToRad(t), h = C.degToRad(e);
1665
- r.transformLatLonHeightToOrigin(
1666
- o,
1667
- h,
1668
- s
1669
- ), this.render(), n();
1670
+ const o = L.degToRad(t), d = L.degToRad(e);
1671
+ r.transformLatLonHeightToOrigin(o, d, s), this.render(), n();
1670
1672
  }, n = () => {
1671
1673
  this.tiles.removeEventListener("load-root-tileset", a), this.loedTilesSets.delete(a);
1672
1674
  };
@@ -1678,7 +1680,7 @@ class yt {
1678
1680
  ), this.loedTilesSets.clear(), this.tiles.removeEventListener("needs-render", this.render), this.tiles.removeEventListener("needs-update", this.render), this.tiles.dispose();
1679
1681
  }
1680
1682
  }
1681
- const I = {
1683
+ const R = {
1682
1684
  DEFAULT: 0,
1683
1685
  GRADIENT: 1,
1684
1686
  TOPOGRAPHIC_LINES: 2,
@@ -1755,10 +1757,10 @@ const I = {
1755
1757
  `
1756
1758
  )
1757
1759
  };
1758
- let X = null, Y = null, $ = null;
1760
+ let X = null, Y = null, Z = null;
1759
1761
  class nt {
1760
1762
  constructor(e, t) {
1761
- this.ssp = e, this.options = t, "url" in this.options ? this.tiles = new R(this.options.url) : (this.tiles = new R(), this._initCesiumIon(this.options)), this._initBasePlugins(this.options);
1763
+ 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);
1762
1764
  }
1763
1765
  tiles;
1764
1766
  tilesFadePlugin;
@@ -1766,10 +1768,10 @@ class nt {
1766
1768
  reorientationPlugin;
1767
1769
  options;
1768
1770
  // 用于模型居中
1769
- _box = new Oe();
1770
- _sphere = new Te();
1771
+ _box = new Te();
1772
+ _sphere = new Oe();
1771
1773
  // 当前材质类型
1772
- _materialType = I.DEFAULT;
1774
+ _materialType = R.DEFAULT;
1773
1775
  // 按需渲染标志
1774
1776
  _needsUpdate = !0;
1775
1777
  _cameraTransitionStart = !1;
@@ -1779,7 +1781,7 @@ class nt {
1779
1781
  */
1780
1782
  _initCesiumIon(e) {
1781
1783
  this.tiles.registerPlugin(
1782
- new fe({
1784
+ new ye({
1783
1785
  apiToken: e.apiToken,
1784
1786
  assetId: e.assetId,
1785
1787
  autoRefreshToken: e.autoRefreshToken ?? !0
@@ -1790,7 +1792,7 @@ class nt {
1790
1792
  * 初始化基础插件
1791
1793
  */
1792
1794
  _initBasePlugins(e) {
1793
- if (e._managedByPlugin || (X === null ? X = this.tiles.lruCache : this.tiles.lruCache = X, Y === null ? Y = this.tiles.parseQueue : this.tiles.parseQueue = Y, $ === null ? $ = this.tiles.downloadQueue : this.tiles.downloadQueue = $, this.tiles.lruCache.maxSize = 600, this.tiles.lruCache.minSize = 300, this.tiles.lruCache.unloadPercent = 0.8), this._setupGLTFLoader(), this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), this.tiles.registerPlugin(this.tilesFadePlugin), this.tiles.registerPlugin(this.updateOnChangePlugin), this.tiles.maxDepth = e.maxDepth ?? 20, this.tiles.errorTarget = e.errorTarget ?? 2, this.options.reorientation) {
1795
+ if (e._managedByPlugin || (X === null ? X = this.tiles.lruCache : this.tiles.lruCache = X, Y === null ? Y = this.tiles.parseQueue : this.tiles.parseQueue = Y, Z === null ? Z = this.tiles.downloadQueue : this.tiles.downloadQueue = Z, this.tiles.lruCache.maxSize = 600, this.tiles.lruCache.minSize = 300, this.tiles.lruCache.unloadPercent = 0.8), this._setupGLTFLoader(), this.tilesFadePlugin = new te({ maximumFadeOutTiles: 200 }), this.updateOnChangePlugin = new se(), this.tiles.registerPlugin(this.tilesFadePlugin), this.tiles.registerPlugin(this.updateOnChangePlugin), this.tiles.maxDepth = e.maxDepth ?? 20, this.tiles.errorTarget = e.errorTarget ?? 2, this.options.reorientation) {
1794
1796
  const t = this.options.reorientation || { lon: 120, lat: 30 };
1795
1797
  this.reorientationPlugin = new re({
1796
1798
  lon: t.lon,
@@ -1808,7 +1810,7 @@ class nt {
1808
1810
  * 设置 GLTF Loader
1809
1811
  */
1810
1812
  _setupGLTFLoader() {
1811
- const e = new pe(this.tiles.manager), t = this.ssp.manager?.store?.modelManager;
1813
+ const e = new ge(this.tiles.manager), t = this.ssp.manager?.store?.modelManager;
1812
1814
  if (t?.gltfLoader) {
1813
1815
  const { dracoLoader: s, ktx2Loader: r, meshoptDecoder: a } = t.gltfLoader;
1814
1816
  s && e.setDRACOLoader(s), r && e.setKTX2Loader(r), a && e.setMeshoptDecoder(a);
@@ -1852,7 +1854,7 @@ class nt {
1852
1854
  onLoadModel = ({ scene: e }) => {
1853
1855
  e.traverse((t) => {
1854
1856
  t.isMesh && (t.originalMaterial = t.material);
1855
- }), this._materialType !== I.DEFAULT && this.updateMaterial(e);
1857
+ }), this._materialType !== R.DEFAULT && this.updateMaterial(e);
1856
1858
  };
1857
1859
  /**
1858
1860
  * 更新场景中所有网格的材质(参考 customMaterial.js)
@@ -1862,18 +1864,18 @@ class nt {
1862
1864
  e.traverse((s) => {
1863
1865
  if (s.isMesh)
1864
1866
  switch (s.material && s.material !== s.originalMaterial && s.material.dispose(), t) {
1865
- case I.DEFAULT:
1867
+ case R.DEFAULT:
1866
1868
  s.material = s.originalMaterial, s.material && (s.material.side = 2), s.receiveShadow = !1, s.castShadow = !1;
1867
1869
  break;
1868
- case I.GRADIENT:
1869
- s.material = new ue(it), s.material.side = 2, s.receiveShadow = !1, s.castShadow = !1;
1870
+ case R.GRADIENT:
1871
+ s.material = new he(it), s.material.side = 2, s.receiveShadow = !1, s.castShadow = !1;
1870
1872
  break;
1871
- case I.TOPOGRAPHIC_LINES: {
1872
- const r = new ue(at);
1873
+ case R.TOPOGRAPHIC_LINES: {
1874
+ const r = new he(at);
1873
1875
  r.extensions = { derivatives: !0 }, r.side = 2, s.material = r, s.receiveShadow = !1, s.castShadow = !1;
1874
1876
  break;
1875
1877
  }
1876
- case I.LIGHTING:
1878
+ case R.LIGHTING:
1877
1879
  s.material = new we(), s.material.side = 2, s.receiveShadow = !0, s.castShadow = !0;
1878
1880
  break;
1879
1881
  }
@@ -1921,8 +1923,8 @@ class nt {
1921
1923
  height: s
1922
1924
  };
1923
1925
  const a = () => {
1924
- const o = C.degToRad(t), h = C.degToRad(e);
1925
- r.transformLatLonHeightToOrigin(o, h, s), this.render(), n();
1926
+ const o = L.degToRad(t), d = L.degToRad(e);
1927
+ r.transformLatLonHeightToOrigin(o, d, s), this.render(), n();
1926
1928
  }, n = () => {
1927
1929
  this.tiles.removeEventListener("load-root-tileset", a), this.loedTilesSets.delete(a);
1928
1930
  };
@@ -2029,24 +2031,24 @@ class ft {
2029
2031
  }
2030
2032
  }
2031
2033
  export {
2032
- mt as ArcgisTilesRenderer,
2034
+ pt as ArcgisTilesRenderer,
2033
2035
  Ve as GisPlotArrow,
2034
- S as GisPlotBase,
2036
+ P as GisPlotBase,
2035
2037
  et as GisPlotCircle,
2036
2038
  Qe as GisPlotLine,
2037
2039
  We as GisPlotPoint,
2038
- je as GisPlotPolygon,
2039
- He as GisPlotRectangle,
2040
+ He as GisPlotPolygon,
2041
+ je as GisPlotRectangle,
2040
2042
  Be as GisPlotSector,
2041
2043
  Ke as GisPlotText,
2042
2044
  tt as GroundDecalManager,
2043
- I as MaterialType,
2044
- Ae as OverlayManager,
2045
+ R as MaterialType,
2046
+ Ne as OverlayManager,
2045
2047
  l as OverlayType,
2046
- yt as TerrainTilesRenderer,
2047
- U as TerrainType,
2048
- Ne as TileCustomMaterialPlugin,
2048
+ mt as TerrainTilesRenderer,
2049
+ C as TerrainType,
2050
+ Fe as TileCustomMaterialPlugin,
2049
2051
  nt as TilesRenderer,
2050
2052
  ft as TilesRendererManager,
2051
- gt as default
2053
+ ct as default
2052
2054
  };
@@ -1,4 +1,4 @@
1
- import { PlotOverlay } from 'um-3d-tiles-renderer/three/plugins';
1
+ import { PlotSdfPlugin } from 'um-3d-tiles-renderer/three/plugins';
2
2
  import { ImageOverlayPlugin } from 'um-3d-tiles-renderer/plugins';
3
3
  import { GisPlotBase } from './plugins/base';
4
4
  import { GisPlotArrowSnapshot, GisPlotSnapshot, LonLatPoint, PlotAddOptions } from './plugins/types';
@@ -28,13 +28,11 @@ export declare class GroundDecalManager {
28
28
  private readonly _items;
29
29
  /** 标绘 id */
30
30
  readonly id: string;
31
- /** 标绘 overlay */
32
- private readonly _overlay;
33
31
  /** SoonSpace 实例 */
34
32
  readonly ssp: SoonSpace;
35
- /** 传入的 ImageOverlayPlugin,用于在有图形时自动注册 overlay */
36
- private _imageOverlayPlugin?;
37
- /** overlay 是否已注册到 ImageOverlayPlugin */
33
+ /** 传入的 PlotSDFPlugin,用于在有图形时自动注册 overlay */
34
+ private _plotSdfPlugin?;
35
+ /** overlay 是否已注册到 PlotSDFPlugin */
38
36
  private _overlayAttached;
39
37
  /** 合并同一帧内多次 `_markDirty`,值为 `requestAnimationFrame` 句柄 */
40
38
  private _redrawTimer;
@@ -43,12 +41,12 @@ export declare class GroundDecalManager {
43
41
  * 内部使用的 `PlotOverlay` 实例。
44
42
  * 注册到 `ImageOverlayPlugin` 的 `overlays` 数组中,顺序靠后者通常绘制在上层。
45
43
  */
46
- get overlay(): PlotOverlay;
44
+ get plotSdfPlugin(): PlotSdfPlugin;
47
45
  /**
48
- * 绑定 / 更换 ImageOverlayPlugin(切换地形重建插件后调用)。
46
+ * 绑定 / 更换 PlotOverlayPlugin(切换地形重建插件后调用)。
49
47
  * 如果当前已有图形,会在下一帧自动重新注册 overlay。
50
48
  */
51
- setImageOverlayPlugin(plugin: ImageOverlayPlugin): void;
49
+ setPlotSDFPlugin(plugin: PlotSdfPlugin): void;
52
50
  /**
53
51
  * 添加标绘:由 `options.type` 决定实例化哪一类 `GisPlot*`(与各类 `*Options` 对应)。
54
52
  */
@@ -102,7 +100,7 @@ export declare class GroundDecalManager {
102
100
  render: () => void;
103
101
  /**
104
102
  * 释放 overlay 内部 RTT / 纹理等资源。
105
- * `PlotImageSource` 的运行时实现含 `dispose`,类型声明可能未列出,故做断言。
103
+ * `PlotSDFPlugin` 的运行时实现含 `dispose`,类型声明可能未列出,故做断言。
106
104
  */
107
105
  dispose(): void;
108
106
  /**
@@ -1,13 +1,13 @@
1
1
  import { GisPlotBase } from './base';
2
- import { LonLatPoint, PlotRectangleOptions } from './types';
2
+ import { PlotRectangleOptions } from './types';
3
3
  /**
4
4
  * 矩形标绘 → {@link PlotRectangleOptions}
5
- * `points[0]` 为矩形中心;`width`/`height` 为米;shader type 0(sdBox)。
5
+ * `points` 4 个角点 [[lon,lat], ...],按顺/逆时针排列;
6
+ * 渲染端以多边形方式绘制(shader type 2)。
6
7
  */
7
8
  export declare class GisPlotRectangle extends GisPlotBase {
8
9
  readonly category: "rectangle";
9
10
  options: PlotRectangleOptions;
10
11
  constructor(options: PlotRectangleOptions);
11
12
  update(patch: Partial<PlotRectangleOptions>): void;
12
- getExtentPoints(): LonLatPoint[];
13
13
  }
@@ -36,8 +36,6 @@ export type PlotLineOptions = GisPlotBaseOptions & {
36
36
  showArrow?: boolean;
37
37
  startArrowStyle?: PlotArrowStyle | null;
38
38
  endArrowStyle?: PlotArrowStyle | null;
39
- /** 线端箭头尺度(与示例 GroundDecalManager / shader 一致) */
40
- arrowSize?: number;
41
39
  };
42
40
  export type PlotStrokeStyle = 'solid' | 'dashed';
43
41
  export type PlotFillStyle = 'solid' | 'diagonal' | 'grid';
@@ -46,11 +44,9 @@ export type PlotPolygonOptions = GisPlotBaseOptions & {
46
44
  strokeStyle?: PlotStrokeStyle;
47
45
  fillStyle?: PlotFillStyle;
48
46
  };
49
- /** 矩形:中心点 + 宽/高(米) */
47
+ /** 矩形:4 个角点 [[lon,lat], ...] 按顺时针或逆时针顺序 */
50
48
  export type PlotRectangleOptions = GisPlotBaseOptions & {
51
49
  strokeStyle?: PlotStrokeStyle;
52
- width: number;
53
- height: number;
54
50
  };
55
51
  /** 扇形:中心 + 半径与角度(度) */
56
52
  export type PlotSectorOptions = GisPlotBaseOptions & {
@@ -79,6 +75,8 @@ export type PlotTextOptions = GisPlotBaseOptions & {
79
75
  fontSize: number;
80
76
  textAlign?: PlotTextAlign;
81
77
  showBorder?: boolean;
78
+ fillColor?: string;
79
+ fillOpacity?: number;
82
80
  offsetX?: number;
83
81
  offsetY?: number;
84
82
  };
@@ -1,5 +1,5 @@
1
1
  import { TilesRenderer } from 'um-3d-tiles-renderer';
2
- import { TilesFadePlugin, UpdateOnChangePlugin, ImageOverlayPlugin, ReorientationPlugin } from 'um-3d-tiles-renderer/plugins';
2
+ import { TilesFadePlugin, UpdateOnChangePlugin, ImageOverlayPlugin, ReorientationPlugin, PlotSdfPlugin } from 'um-3d-tiles-renderer/plugins';
3
3
  import { default as SoonSpace } from 'soonspacejs';
4
4
  import { TileCustomMaterialPlugin } from './plugins';
5
5
  import { OverlayManager } from './OverlayManager';
@@ -23,6 +23,8 @@ export declare class TerrainTilesRenderer {
23
23
  customMaterialPlugin?: TileCustomMaterialPlugin;
24
24
  imageOverlayPlugin?: ImageOverlayPlugin;
25
25
  reorientationPlugin?: ReorientationPlugin;
26
+ /** 标绘 SDF 插件(管理标绘实例) */
27
+ plotSDFPlugin?: PlotSdfPlugin;
26
28
  /** 资源管理器(存储配置) */
27
29
  resourceManager: ResourceManager;
28
30
  /** 地形管理器(记录地形列表) */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-tiles",
3
3
  "pluginName": "TilesPlugin",
4
- "version": "2.14.35",
4
+ "version": "2.15.0",
5
5
  "description": "3D Tiles plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -18,8 +18,8 @@
18
18
  "license": "UNLICENSED",
19
19
  "gitHead": "4a87dd85050651088e11c3da777c49fab3db7e5d",
20
20
  "peerDependencies": {
21
- "um-3d-tiles-renderer": "^0.4.31",
21
+ "um-3d-tiles-renderer": "^0.4.40",
22
22
  "three": "^0.183.0",
23
- "soonspacejs": "2.14.35"
23
+ "soonspacejs": "2.15.0"
24
24
  }
25
25
  }