@xingm/vmap-cesium-toolbar 0.0.5 → 0.0.6

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.es.js CHANGED
@@ -51,7 +51,7 @@ function at(u) {
51
51
  n / e.length
52
52
  );
53
53
  }
54
- class ue {
54
+ class de {
55
55
  viewer;
56
56
  scene;
57
57
  entities;
@@ -323,7 +323,7 @@ function we(u) {
323
323
  console.warn("toggleSelectedStyle failed", e);
324
324
  }
325
325
  }
326
- const De = {
326
+ const He = {
327
327
  locale: "zh-CN",
328
328
  toolbar: {
329
329
  search: "搜索",
@@ -390,7 +390,7 @@ const De = {
390
390
  area: "面积: {value}"
391
391
  }
392
392
  }
393
- }, He = {
393
+ }, De = {
394
394
  locale: "en-US",
395
395
  toolbar: {
396
396
  search: "Search",
@@ -458,8 +458,8 @@ const De = {
458
458
  }
459
459
  }
460
460
  }, Re = "vmap-cesium-tool-locale", F = {
461
- [De.locale]: De,
462
- [He.locale]: He
461
+ [He.locale]: He,
462
+ [De.locale]: De
463
463
  };
464
464
  let $ = "zh-CN", Oe = !1, Le = !1, te = (() => {
465
465
  if (typeof window > "u") return $;
@@ -538,7 +538,7 @@ function ie() {
538
538
  return !1;
539
539
  }
540
540
  }
541
- class de {
541
+ class ge {
542
542
  profiles;
543
543
  lastByKind = /* @__PURE__ */ new Map();
544
544
  suspendUntil = 0;
@@ -575,7 +575,7 @@ class de {
575
575
  return Number.isFinite(e?.x) && Number.isFinite(e?.y);
576
576
  }
577
577
  }
578
- class ut extends ue {
578
+ class ut extends de {
579
579
  currentLineEntity = null;
580
580
  currentSegmentLabels = [];
581
581
  currentTotalLabel = null;
@@ -922,8 +922,8 @@ function $e(u, e, t, i, n = dt) {
922
922
  if (!gt(u, e, t, i, n)) return "none";
923
923
  const o = ne(u, e, t), s = ne(u, e, i), a = ne(t, i, u), l = ne(t, i, e), c = re(o, n), h = re(s, n), d = re(a, n), g = re(l, n);
924
924
  if (c && h && d && g) {
925
- const p = Math.abs(e.x - u.x), y = Math.abs(e.y - u.y), v = p >= y, w = v ? u.x : u.y, C = v ? e.x : e.y, P = v ? t.x : t.y, N = v ? i.x : i.y, T = Math.min(w, C), x = Math.max(w, C), M = Math.min(P, N), D = Math.max(P, N), E = Math.max(T, M), H = Math.min(x, D);
926
- return H < E - n ? "none" : Math.abs(H - E) <= n ? "touch" : "overlap";
925
+ const p = Math.abs(e.x - u.x), y = Math.abs(e.y - u.y), v = p >= y, w = v ? u.x : u.y, C = v ? e.x : e.y, P = v ? t.x : t.y, N = v ? i.x : i.y, T = Math.min(w, C), x = Math.max(w, C), M = Math.min(P, N), H = Math.max(P, N), E = Math.max(T, M), D = Math.min(x, H);
926
+ return D < E - n ? "none" : Math.abs(D - E) <= n ? "touch" : "overlap";
927
927
  }
928
928
  const f = o > n && s < -n || o < -n && s > n, m = a > n && l < -n || a < -n && l > n;
929
929
  return f && m ? "cross" : c && le(t, u, e, n) || h && le(i, u, e, n) || d && le(u, t, i, n) || g && le(e, t, i, n) ? "touch" : "none";
@@ -983,7 +983,7 @@ function yt(u, e) {
983
983
  const i = xe(u);
984
984
  return et(i, t);
985
985
  }
986
- class vt extends ue {
986
+ class vt extends de {
987
987
  currentPolygonEntity = null;
988
988
  currentBorderEntity = null;
989
989
  /**
@@ -1281,7 +1281,7 @@ class vt extends ue {
1281
1281
  super.addPoint(e), this.updateDrawingEntity();
1282
1282
  }
1283
1283
  }
1284
- class Ct extends ue {
1284
+ class Ct extends de {
1285
1285
  currentRectangleEntity = null;
1286
1286
  /**
1287
1287
  * 开始绘制
@@ -1412,7 +1412,7 @@ class Ct extends ue {
1412
1412
  return "rectangle";
1413
1413
  }
1414
1414
  }
1415
- class wt extends ue {
1415
+ class wt extends de {
1416
1416
  currentCircleEntity = null;
1417
1417
  currentBorderEntity = null;
1418
1418
  // 边框折线,用作粗边框
@@ -1974,7 +1974,7 @@ class j {
1974
1974
  constructor(e) {
1975
1975
  if (!e || !(e instanceof r.Viewer))
1976
1976
  throw new Error("Invalid Cesium Viewer instance provided.");
1977
- this.viewer = e, this.scene = e.scene, this.entities = e.entities, this.pickGovernor = new de({
1977
+ this.viewer = e, this.scene = e.scene, this.entities = e.entities, this.pickGovernor = new ge({
1978
1978
  profiles: {
1979
1979
  draw: { minIntervalMs: 120, minMovePx: 0 }
1980
1980
  }
@@ -3394,7 +3394,7 @@ const Nt = tt(), Tt = "73.5577,18.1597,135.0882,53.5609", Gt = {}, Mt = (u, e, t
3394
3394
  i
3395
3395
  )}&type=query&tk=${t}`;
3396
3396
  };
3397
- class Dt {
3397
+ class Ht {
3398
3398
  viewer;
3399
3399
  toolbarElement;
3400
3400
  searchCallback;
@@ -4018,7 +4018,7 @@ const Ee = {
4018
4018
  basePath: "/geojson",
4019
4019
  silent: !1
4020
4020
  };
4021
- async function Ht(u = {}) {
4021
+ async function Dt(u = {}) {
4022
4022
  const { basePath: e } = { ...Ee, ...u };
4023
4023
  try {
4024
4024
  const t = await fetch(`${e}/file-list.json`);
@@ -4046,7 +4046,7 @@ async function Rt(u, e = {}) {
4046
4046
  async function Ot(u, e = {}) {
4047
4047
  const { silent: t } = { ...Ee, ...e };
4048
4048
  let i = u;
4049
- if ((!i || i.length === 0) && (i = await Ht(e)), !i || i.length === 0)
4049
+ if ((!i || i.length === 0) && (i = await Dt(e)), !i || i.length === 0)
4050
4050
  return t || (console.warn("未提供 GeoJSON 文件列表,无法加载数据"), console.warn("请使用 loadAllAirportNoFlyZones(fileList) 提供文件列表,"), console.warn("或在 public/geojson 目录下创建 file-list.json 文件")), [];
4051
4051
  const n = [], o = i.map(async (s) => {
4052
4052
  try {
@@ -4513,7 +4513,7 @@ class Bt {
4513
4513
  this.viewer = e, this.container = t, this.config = {
4514
4514
  ...jt,
4515
4515
  ...i
4516
- }, this.useI18n = i.useI18n ?? !0, this.i18n = i.i18n ?? Y, this.measurementCallback = n?.measurement, this.zoomCallback = n?.zoom, this.fullscreenCallback = n?.fullscreen, this.resetLocationCallback = n?.resetLocation, this.initialCenter = o, this.drawHelper = new j(e), this.createToolbar(), this.searchService = new Dt(e, this.toolbarElement, n?.search, {
4516
+ }, this.useI18n = i.useI18n ?? !0, this.i18n = i.i18n ?? Y, this.measurementCallback = n?.measurement, this.zoomCallback = n?.zoom, this.fullscreenCallback = n?.fullscreen, this.resetLocationCallback = n?.resetLocation, this.initialCenter = o, this.drawHelper = new j(e), this.createToolbar(), this.searchService = new Ht(e, this.toolbarElement, n?.search, {
4517
4517
  i18n: this.i18n,
4518
4518
  useI18n: this.useI18n
4519
4519
  }), this.notFlyZonesService = new Lt(e, {
@@ -5051,7 +5051,7 @@ class Bt {
5051
5051
  this.toolbarElement && this.toolbarElement.parentNode && this.toolbarElement.parentNode.removeChild(this.toolbarElement), this.searchService.destroy(), this.mapLayersService.destroy(), this.drawHelper.destroy();
5052
5052
  }
5053
5053
  }
5054
- function pe(u, e) {
5054
+ function me(u, e) {
5055
5055
  if (!u) return { remove: null };
5056
5056
  try {
5057
5057
  const t = u.addEventListener?.(e);
@@ -5104,47 +5104,47 @@ function it(u, e, t) {
5104
5104
  let a = !1, l = !1, c = 0, h = 0, d = Date.now(), g = null;
5105
5105
  const f = () => {
5106
5106
  d = Date.now();
5107
- }, m = (D, E) => {
5107
+ }, m = (H, E) => {
5108
5108
  T("renderError", E);
5109
- }, p = (D, E) => {
5109
+ }, p = (H, E) => {
5110
5110
  T("widgetError", E);
5111
- }, y = (D) => {
5112
- const E = String(D?.message || D?.error?.message || "");
5113
- (E.includes("Rendering has stopped") || E.includes("NaN") || E.includes("DeveloperError")) && T("windowError", D?.error || D);
5114
- }, v = (D) => {
5115
- const E = D?.reason, H = String(E?.message || E || "");
5116
- (H.includes("Rendering has stopped") || H.includes("NaN") || H.includes("DataCloneError")) && T("unhandledrejection", E);
5117
- }, w = pe(u.scene?.postRender, f).remove, C = pe(u.scene?.renderError, m).remove, P = pe(u.cesiumWidget?.errorEvent, p).remove;
5111
+ }, y = (H) => {
5112
+ const E = String(H?.message || H?.error?.message || "");
5113
+ (E.includes("Rendering has stopped") || E.includes("NaN") || E.includes("DeveloperError")) && T("windowError", H?.error || H);
5114
+ }, v = (H) => {
5115
+ const E = H?.reason, D = String(E?.message || E || "");
5116
+ (D.includes("Rendering has stopped") || D.includes("NaN") || D.includes("DataCloneError")) && T("unhandledrejection", E);
5117
+ }, w = me(u.scene?.postRender, f).remove, C = me(u.scene?.renderError, m).remove, P = me(u.cesiumWidget?.errorEvent, p).remove;
5118
5118
  window.addEventListener("error", y), window.addEventListener("unhandledrejection", v);
5119
5119
  const N = t.watchdog;
5120
5120
  if (N?.enabled) {
5121
- const D = Math.max(500, N.staleMs ?? 6e3), E = Math.max(250, N.checkIntervalMs ?? 2e3);
5121
+ const H = Math.max(500, N.staleMs ?? 6e3), E = Math.max(250, N.checkIntervalMs ?? 2e3);
5122
5122
  g = setInterval(() => {
5123
5123
  if (a || l) return;
5124
- const H = Date.now();
5125
- H - d > D && T("watchdog", new Error(`No postRender for ${H - d}ms`));
5124
+ const D = Date.now();
5125
+ D - d > H && T("watchdog", new Error(`No postRender for ${D - d}ms`));
5126
5126
  }, E);
5127
5127
  }
5128
- function T(D, E) {
5129
- a || l || c >= n || Date.now() - h < o || x(D, E);
5128
+ function T(H, E) {
5129
+ a || l || c >= n || Date.now() - h < o || x(H, E);
5130
5130
  }
5131
- async function x(D, E) {
5131
+ async function x(H, E) {
5132
5132
  if (a || l) return;
5133
5133
  l = !0, h = Date.now(), c += 1;
5134
- const H = u, O = s ? Xt(H) : null;
5134
+ const D = u, O = s ? Xt(D) : null;
5135
5135
  try {
5136
- t.onRecovering?.({ reason: D, error: E, attempt: c });
5136
+ t.onRecovering?.({ reason: H, error: E, attempt: c });
5137
5137
  } catch {
5138
5138
  }
5139
5139
  let L = null;
5140
5140
  try {
5141
5141
  try {
5142
- H.destroy?.();
5142
+ D.destroy?.();
5143
5143
  } catch {
5144
5144
  }
5145
5145
  L = await e(), O && Ut(L, O);
5146
5146
  try {
5147
- t.onRecovered?.({ reason: D, error: E, attempt: c, oldViewer: H, newViewer: L });
5147
+ t.onRecovered?.({ reason: H, error: E, attempt: c, oldViewer: D, newViewer: L });
5148
5148
  } catch {
5149
5149
  }
5150
5150
  } finally {
@@ -5825,38 +5825,38 @@ class $t {
5825
5825
  default:
5826
5826
  return { left: G, right: G + p, top: R - y, bottom: R };
5827
5827
  }
5828
- }, M = 4, D = (b) => {
5828
+ }, M = 4, H = (b) => {
5829
5829
  const G = g - M, R = f - M, K = Math.max(0, M - b.left), S = Math.max(0, b.right - G), U = Math.max(0, M - b.top), k = Math.max(0, b.bottom - R);
5830
5830
  return K + S + U + k;
5831
- }, E = (b) => b === "top" ? "bottom" : b === "bottom" ? "top" : b.startsWith("top-") ? `bottom-${b.slice(4)}` : b.startsWith("bottom-") ? `top-${b.slice(7)}` : b.endsWith("-top") ? `${b.slice(0, -4)}-bottom` : b.endsWith("-bottom") ? `${b.slice(0, -7)}-top` : b, H = (b) => b === "left" ? "right" : b === "right" ? "left" : b.startsWith("left-") ? `right-${b.slice(5)}` : b.startsWith("right-") ? `left-${b.slice(6)}` : b.endsWith("-left") ? `${b.slice(0, -5)}-right` : b.endsWith("-right") ? `${b.slice(0, -6)}-left` : b, O = [], L = (b) => {
5831
+ }, E = (b) => b === "top" ? "bottom" : b === "bottom" ? "top" : b.startsWith("top-") ? `bottom-${b.slice(4)}` : b.startsWith("bottom-") ? `top-${b.slice(7)}` : b.endsWith("-top") ? `${b.slice(0, -4)}-bottom` : b.endsWith("-bottom") ? `${b.slice(0, -7)}-top` : b, D = (b) => b === "left" ? "right" : b === "right" ? "left" : b.startsWith("left-") ? `right-${b.slice(5)}` : b.startsWith("right-") ? `left-${b.slice(6)}` : b.endsWith("-left") ? `${b.slice(0, -5)}-right` : b.endsWith("-right") ? `${b.slice(0, -6)}-left` : b, O = [], L = (b) => {
5832
5832
  O.includes(b) || O.push(b);
5833
- }, A = T(N), Q = x(N, A.x, A.y), ee = D(Q);
5834
- let ge = N, se = A;
5833
+ }, A = T(N), Q = x(N, A.x, A.y), ee = H(Q);
5834
+ let fe = N, se = A;
5835
5835
  if (ee > 0) {
5836
- L(E(N)), L(H(N)), L(H(E(N))), L(N);
5836
+ L(E(N)), L(D(N)), L(D(E(N))), L(N);
5837
5837
  let b = N, G = A, R = ee;
5838
5838
  for (const K of O) {
5839
- const S = T(K), U = x(K, S.x, S.y), k = D(U);
5839
+ const S = T(K), U = x(K, S.x, S.y), k = H(U);
5840
5840
  k < R && (R = k, b = K, G = S);
5841
5841
  }
5842
- ge = b, se = G;
5842
+ fe = b, se = G;
5843
5843
  }
5844
5844
  a = se.x, l = se.y;
5845
- let fe = se.transform;
5846
- const W = x(ge, a, l);
5845
+ let pe = se.transform;
5846
+ const W = x(fe, a, l);
5847
5847
  let B = 0, X = 0;
5848
5848
  const Ne = g - M, Te = f - M;
5849
- W.left + B < M && (B += M - (W.left + B)), W.right + B > Ne && (B -= W.right + B - Ne), W.top + X < M && (X += M - (W.top + X)), W.bottom + X > Te && (X -= W.bottom + X - Te), (B !== 0 || X !== 0) && (fe = `${fe} translate(${B}px, ${X}px)`);
5849
+ W.left + B < M && (B += M - (W.left + B)), W.right + B > Ne && (B -= W.right + B - Ne), W.top + X < M && (X += M - (W.top + X)), W.bottom + X > Te && (X -= W.bottom + X - Te), (B !== 0 || X !== 0) && (pe = `${pe} translate(${B}px, ${X}px)`);
5850
5850
  const Ge = {
5851
5851
  left: W.left + B,
5852
5852
  right: W.right + B,
5853
5853
  top: W.top + X,
5854
5854
  bottom: W.bottom + X
5855
5855
  };
5856
- if (i.style.left = `${a}px`, i.style.top = `${l}px`, i.style.transform = fe, i.style.display = "block", t.arrowEl && n.showArrow) {
5856
+ if (i.style.left = `${a}px`, i.style.top = `${l}px`, i.style.transform = pe, i.style.display = "block", t.arrowEl && n.showArrow) {
5857
5857
  const b = t.arrowEl, G = (n.arrowSize ?? 8) + "px", R = i.style.background || n.backgroundColor || "#ffffff";
5858
5858
  b.style.borderLeft = "0", b.style.borderRight = "0", b.style.borderTop = "0", b.style.borderBottom = "0", b.style.left = "", b.style.right = "", b.style.top = "", b.style.bottom = "", b.style.transform = "";
5859
- const S = ((Z) => Z.startsWith("top") ? "top" : Z.startsWith("bottom") ? "bottom" : Z.startsWith("left") ? "left" : Z.startsWith("right") ? "right" : "top")(ge), U = (Z) => Math.max(10, Math.min(90, Z));
5859
+ const S = ((Z) => Z.startsWith("top") ? "top" : Z.startsWith("bottom") ? "bottom" : Z.startsWith("left") ? "left" : Z.startsWith("right") ? "right" : "top")(fe), U = (Z) => Math.max(10, Math.min(90, Z));
5860
5860
  let k = 50;
5861
5861
  if (S === "top" || S === "bottom") {
5862
5862
  const Z = (a - Ge.left) / Math.max(1, p) * 100;
@@ -6513,11 +6513,11 @@ class ii {
6513
6513
  }
6514
6514
  });
6515
6515
  if (e.onClick) {
6516
- const H = w, O = N;
6517
- H._onClick = e.onClick, O._onClick = e.onClick;
6516
+ const D = w, O = N;
6517
+ D._onClick = e.onClick, O._onClick = e.onClick;
6518
6518
  }
6519
- const T = w, x = N, M = [w, N], D = e.clickHighlight ?? !1, E = e.hoverHighlight ?? !1;
6520
- return T._clickHighlight = D, x._clickHighlight = D, T._hoverHighlight = E, x._hoverHighlight = E, T._highlightEntities = M, x._highlightEntities = M, T._borderEntity = N, T._isThickOutline = !0, T._outlineWidth = s, T._clampToGround = f, T._baseHeight = p, T._groundHeightEpsilon = m, x._groundHeightEpsilon = m, w;
6519
+ const T = w, x = N, M = [w, N], H = e.clickHighlight ?? !1, E = e.hoverHighlight ?? !1;
6520
+ return T._clickHighlight = H, x._clickHighlight = H, T._hoverHighlight = E, x._hoverHighlight = E, T._highlightEntities = M, x._highlightEntities = M, T._borderEntity = N, T._isThickOutline = !0, T._outlineWidth = s, T._clampToGround = f, T._baseHeight = p, T._groundHeightEpsilon = m, x._groundHeightEpsilon = m, w;
6521
6521
  }
6522
6522
  const a = e.clampToGround ?? !0, l = a ? Math.max(0, Number(e.groundHeightEpsilon ?? 0)) : 0, c = e.heightReference ?? (a ? l > 0 ? r.HeightReference.RELATIVE_TO_GROUND : r.HeightReference.CLAMP_TO_GROUND : r.HeightReference.NONE), h = a ? this.elevatePositions(i, 0) : i, d = this.entities.add({
6523
6523
  id: n,
@@ -7007,11 +7007,11 @@ class ri {
7007
7007
  }
7008
7008
  });
7009
7009
  if (e.onClick) {
7010
- const H = P, O = N;
7011
- H._onClick = e.onClick, O._onClick = e.onClick;
7010
+ const D = P, O = N;
7011
+ D._onClick = e.onClick, O._onClick = e.onClick;
7012
7012
  }
7013
- const T = P, x = N, M = [P, N], D = e.clickHighlight ?? !1, E = e.hoverHighlight ?? !1;
7014
- return T._clickHighlight = D, x._clickHighlight = D, T._hoverHighlight = E, x._hoverHighlight = E, T._highlightEntities = M, x._highlightEntities = M, T._innerEntity = N, T._isRing = !0, T._ringThickness = o, T._outerRectangle = e.coordinates, T._clampToGround = d, T._baseHeight = f, T._groundHeightEpsilon = g, T._ringHeightEpsilon = p, x._groundHeightEpsilon = g, P;
7013
+ const T = P, x = N, M = [P, N], H = e.clickHighlight ?? !1, E = e.hoverHighlight ?? !1;
7014
+ return T._clickHighlight = H, x._clickHighlight = H, T._hoverHighlight = E, x._hoverHighlight = E, T._highlightEntities = M, x._highlightEntities = M, T._innerEntity = N, T._isRing = !0, T._ringThickness = o, T._outerRectangle = e.coordinates, T._clampToGround = d, T._baseHeight = f, T._groundHeightEpsilon = g, T._ringHeightEpsilon = p, x._groundHeightEpsilon = g, P;
7015
7015
  }
7016
7016
  const s = e.clampToGround ?? !0, a = s ? Math.max(0, Number(e.groundHeightEpsilon ?? 0)) : 0, l = e.heightReference ?? (s ? a > 0 ? r.HeightReference.RELATIVE_TO_GROUND : r.HeightReference.CLAMP_TO_GROUND : r.HeightReference.NONE), c = this.entities.add({
7017
7017
  id: t,
@@ -7376,7 +7376,7 @@ class oi {
7376
7376
  this.layers.clear();
7377
7377
  }
7378
7378
  }
7379
- class ce {
7379
+ class he {
7380
7380
  viewer;
7381
7381
  entities;
7382
7382
  primitiveBatch = null;
@@ -7515,8 +7515,8 @@ class ce {
7515
7515
  const O = N, L = T;
7516
7516
  O._onClick = e.onClick, L._onClick = e.onClick;
7517
7517
  }
7518
- const x = N, M = T, D = [N, T], E = e.clickHighlight ?? !1, H = e.hoverHighlight ?? !1;
7519
- return x._clickHighlight = E, M._clickHighlight = E, x._hoverHighlight = H, M._hoverHighlight = H, x._highlightEntities = D, M._highlightEntities = D, x._innerEntity = T, x._isRing = !0, x._ringThickness = s, x._fillMaterial = o, x._ringHeightEpsilon = g, x._groundHeightEpsilon = l, x._centerCartographic = new r.Cartographic(c.longitude, c.latitude, h), x._outerRadius = y, x._innerRadius = w, x._ringSegments = v, x._clampToGround = a, x._baseHeight = h, M._groundHeightEpsilon = l, N;
7518
+ const x = N, M = T, H = [N, T], E = e.clickHighlight ?? !1, D = e.hoverHighlight ?? !1;
7519
+ return x._clickHighlight = E, M._clickHighlight = E, x._hoverHighlight = D, M._hoverHighlight = D, x._highlightEntities = H, M._highlightEntities = H, x._innerEntity = T, x._isRing = !0, x._ringThickness = s, x._fillMaterial = o, x._ringHeightEpsilon = g, x._groundHeightEpsilon = l, x._centerCartographic = new r.Cartographic(c.longitude, c.latitude, h), x._outerRadius = y, x._innerRadius = w, x._ringSegments = v, x._clampToGround = a, x._baseHeight = h, M._groundHeightEpsilon = l, N;
7520
7520
  } else {
7521
7521
  const a = e.clampToGround ?? !0, l = a ? Math.max(0, Number(e.groundHeightEpsilon ?? 0)) : 0, c = e.heightReference ?? (a ? l > 0 ? r.HeightReference.RELATIVE_TO_GROUND : r.HeightReference.CLAMP_TO_GROUND : r.HeightReference.NONE), h = r.Cartographic.fromCartesian(i), d = r.Cartesian3.fromRadians(h.longitude, h.latitude, 0), g = a ? l : h.height ?? 0, f = this.entities.add({
7522
7522
  id: n,
@@ -7559,7 +7559,7 @@ class ce {
7559
7559
  * @returns 返回一个包含正弦和余弦数组的对象
7560
7560
  */
7561
7561
  getBearingTable(e) {
7562
- const t = Math.max(3, Math.floor(e)), i = ce.bearingTableCache.get(t);
7562
+ const t = Math.max(3, Math.floor(e)), i = he.bearingTableCache.get(t);
7563
7563
  if (i) return i;
7564
7564
  const n = new Float64Array(t), o = new Float64Array(t);
7565
7565
  for (let a = 0; a < t; a++) {
@@ -7567,7 +7567,7 @@ class ce {
7567
7567
  n[a] = Math.sin(l), o[a] = Math.cos(l);
7568
7568
  }
7569
7569
  const s = { sin: n, cos: o };
7570
- return ce.bearingTableCache.set(t, s), s;
7570
+ return he.bearingTableCache.set(t, s), s;
7571
7571
  }
7572
7572
  /**
7573
7573
  * 粗边框模式的默认分段数:平衡“圆滑程度/性能”。
@@ -7589,16 +7589,16 @@ class ce {
7589
7589
  x.length >= 2 && x.push(x[0]), g._primitiveOutlinePositions = x;
7590
7590
  const M = g._innerEntity;
7591
7591
  M && (M._primitiveOutlinePositions = x);
7592
- const D = g._innerEntity;
7593
- if (!D) return;
7594
- const E = g._primitiveRingBaseColor ?? r.Color.BLACK, H = g._primitiveFillBaseColor ?? this.resolveMaterialColor(g._fillMaterial) ?? r.Color.BLUE.withAlpha(0.5);
7592
+ const H = g._innerEntity;
7593
+ if (!H) return;
7594
+ const E = g._primitiveRingBaseColor ?? r.Color.BLACK, D = g._primitiveFillBaseColor ?? this.resolveMaterialColor(g._fillMaterial) ?? r.Color.BLUE.withAlpha(0.5);
7595
7595
  this.getPrimitiveBatchForOverlay(g).upsertGeometry({
7596
7596
  circleId: f,
7597
- parts: { outer: e, inner: D },
7597
+ parts: { outer: e, inner: H },
7598
7598
  ringPositions: N,
7599
7599
  fillPositions: T,
7600
7600
  ringColor: E,
7601
- fillColor: H,
7601
+ fillColor: D,
7602
7602
  visible: e.show !== !1
7603
7603
  });
7604
7604
  return;
@@ -8018,7 +8018,7 @@ class si {
8018
8018
  return this.entities.remove(t);
8019
8019
  }
8020
8020
  }
8021
- const me = {
8021
+ const ce = {
8022
8022
  vertex: !0,
8023
8023
  mid: !0,
8024
8024
  move: !1,
@@ -8215,9 +8215,9 @@ class li {
8215
8215
  */
8216
8216
  constructor(e, t = {}) {
8217
8217
  this.host = e, this.onChange = t.onChange ?? null, this.editingOptions = {
8218
- ...me,
8219
- ...t.editCapabilities || {}
8220
- }, this.pickGovernor = new de({
8218
+ ...ce,
8219
+ ...t.overlayEditOptions || {}
8220
+ }, this.pickGovernor = new ge({
8221
8221
  profiles: {
8222
8222
  edit: { minIntervalMs: 80, minMovePx: 0 }
8223
8223
  }
@@ -8277,15 +8277,19 @@ class li {
8277
8277
  /**
8278
8278
  * 设置编辑器启用状态
8279
8279
  * @param enabled 是否启用
8280
+ * @param options 编辑功能配置项,可选。不传时使用构造函数传入的配置或默认配置
8280
8281
  */
8281
- setEnabled(e) {
8282
- const t = !!e;
8283
- if (this.enabled !== t) {
8284
- if (this.enabled = t, !t) {
8282
+ setEnabled(e, t) {
8283
+ const i = !!e;
8284
+ if (this.enabled !== i) {
8285
+ if (this.enabled = i, !i) {
8285
8286
  this.stop(), this.destroyHandler();
8286
8287
  return;
8287
8288
  }
8288
- this.ensureHandler(me);
8289
+ t && (this.editingOptions = {
8290
+ ...ce,
8291
+ ...t
8292
+ }), this.ensureHandler(this.editingOptions || ce);
8289
8293
  }
8290
8294
  }
8291
8295
  /**
@@ -8317,7 +8321,10 @@ class li {
8317
8321
  * @returns true 表示成功进入编辑
8318
8322
  */
8319
8323
  start(e, t) {
8320
- const i = { ...me, ...t }, n = typeof e == "string" ? this.host.getOverlayById(e) : e;
8324
+ const i = {
8325
+ ...this.editingOptions || ce,
8326
+ ...t
8327
+ }, n = typeof e == "string" ? this.host.getOverlayById(e) : e;
8321
8328
  if (!n) return !1;
8322
8329
  const o = this.resolveEditTarget(n);
8323
8330
  if (o.__vmapOverlayEditHandle || o._drawType !== void 0 || o.show === !1) return !1;
@@ -8566,7 +8573,7 @@ class li {
8566
8573
  }
8567
8574
  }
8568
8575
  }, r.ScreenSpaceEventType.LEFT_DOWN), this.handler.setInputAction((i) => {
8569
- if (!this.enabled || !this.editingTarget || this.editingKind !== "polygon" && this.editingKind !== "polyline" || !i.position) return;
8576
+ if (!this.enabled || !this.editingTarget || this.editingKind !== "polygon" && this.editingKind !== "polyline" && this.editingKind !== "point" || !i.position) return;
8570
8577
  try {
8571
8578
  const c = t;
8572
8579
  c.__vmapDrawHelperBlockPickUntil = Date.now() + 250;
@@ -8577,9 +8584,14 @@ class li {
8577
8584
  const o = t.scene.pick(n), s = o && o.id;
8578
8585
  if (!s || !s.__vmapOverlayEditHandle) return;
8579
8586
  const a = s.__vmapOverlayEditHandleMeta;
8580
- if (!a || a.type !== "vertex" || typeof a.index != "number" || this.editingKind === "polygon" && this.editingPositions.length <= 3 || this.editingKind === "polyline" && this.editingPositions.length <= 2) return;
8587
+ if (!a) return;
8588
+ if (this.editingKind === "point" && a.type === "point") {
8589
+ this.editingTarget && this.onChange && this.emitChange(this.editingTarget), this.stop();
8590
+ return;
8591
+ }
8592
+ if (a.type !== "vertex" || typeof a.index != "number" || this.editingKind === "polygon" && this.editingPositions.length <= 3 || this.editingKind === "polyline" && this.editingPositions.length <= 2) return;
8581
8593
  const l = a.index;
8582
- l < 0 || l >= this.editingPositions.length || (this.editingPositions.splice(l, 1), this.editingKind === "polygon" && this.applyEditedPolygon(), this.editingKind === "polyline" && this.applyEditedPolyline(), this.rebuildHandles(e));
8594
+ l < 0 || l >= this.editingPositions.length || (this.editingPositions.splice(l, 1), this.editingKind === "polygon" && this.applyEditedPolygon(), this.editingKind === "polyline" && this.applyEditedPolyline(), this.rebuildHandles(e), this.editingTarget && this.onChange && this.emitChange(this.editingTarget));
8583
8595
  }, r.ScreenSpaceEventType.RIGHT_CLICK), this.handler.setInputAction((i) => {
8584
8596
  if (!this.enabled || !this.dragging || !this.editingTarget || !this.editingKind) return;
8585
8597
  const n = i.endPosition;
@@ -9548,7 +9560,7 @@ class q {
9548
9560
  this.viewer = e, this.options = t, this.entities = e.entities, this.clickPickMinIntervalMs = Math.max(
9549
9561
  0,
9550
9562
  t.clickPickMinIntervalMs ?? q.CLICK_PICK_MIN_INTERVAL_MS
9551
- ), this.pickGovernor = new de({
9563
+ ), this.pickGovernor = new ge({
9552
9564
  profiles: {
9553
9565
  click: { minIntervalMs: this.clickPickMinIntervalMs, minMovePx: 0 }
9554
9566
  }
@@ -9602,8 +9614,9 @@ class q {
9602
9614
  }
9603
9615
  }
9604
9616
  }, {
9605
- onChange: t.onOverlayEditChange
9606
- }), this.initInfoWindowContainer(), this.marker = new Vt(e), this.label = new qt(e), this.icon = new Kt(e), this.svg = new Jt(e), this.infoWindow = new $t(e, this.infoWindowContainer), this.polyline = new ei(e), this.polygon = new ii(e), this.rectangle = new ri(e), this.circle = new ce(e), this.ring = new si(e), this.overlayHighlight = new V({
9617
+ onChange: t.onOverlayEditChange,
9618
+ overlayEditOptions: t.overlayEditOptions
9619
+ }), this.initInfoWindowContainer(), this.marker = new Vt(e), this.label = new qt(e), this.icon = new Kt(e), this.svg = new Jt(e), this.infoWindow = new $t(e, this.infoWindowContainer), this.polyline = new ei(e), this.polygon = new ii(e), this.rectangle = new ri(e), this.circle = new he(e), this.ring = new si(e), this.overlayHighlight = new V({
9607
9620
  getEntities: () => this.entities,
9608
9621
  getOverlayById: (i) => this.overlayMap.get(i),
9609
9622
  getPropertyValue: (i, n) => this.getPropertyValue(i, n),
@@ -9613,17 +9626,6 @@ class q {
9613
9626
  getRectangle: () => this.rectangle
9614
9627
  }), this.setupEntityClickHandler(), this.options.enableHoverHandler !== !1 && this.setupEntityHoverHandler();
9615
9628
  }
9616
- /**
9617
- * Cesium 默认可能无法 pick 到半透明覆盖物(例如 alpha < 1 的填充面)。
9618
- * 开启 pickTranslucentDepth 后,hover/click 才能稳定命中半透明面。
9619
- */
9620
- enableTranslucentPicking() {
9621
- try {
9622
- const e = this.viewer.scene;
9623
- e && "pickTranslucentDepth" in e && (e.pickTranslucentDepth = !0);
9624
- } catch {
9625
- }
9626
- }
9627
9629
  /**
9628
9630
  * 尝试从屏幕坐标拾取地表/模型位置并转为 Cartographic
9629
9631
  */
@@ -9759,9 +9761,11 @@ class q {
9759
9761
  * 开启/关闭覆盖物编辑模式。
9760
9762
  * - 开启后:点击覆盖物会进入编辑,并显示可拖拽控制点。
9761
9763
  * - 关闭后:退出编辑并移除控制点。
9764
+ * @param enabled 是否启用编辑模式
9765
+ * @param overlayEditOptions 编辑功能配置项,可选。不传时使用构造函数传入的配置或默认配置
9762
9766
  */
9763
- setOverlayEditMode(e) {
9764
- this.overlayEditor.setEnabled(e);
9767
+ setOverlayEditMode(e, t) {
9768
+ this.overlayEditor.setEnabled(e, t);
9765
9769
  }
9766
9770
  /** 当前是否处于覆盖物编辑模式(全局开关) */
9767
9771
  getOverlayEditModeEnabled() {
@@ -9775,8 +9779,8 @@ class q {
9775
9779
  * 主动开始编辑某个覆盖物。
9776
9780
  * @returns true 表示成功进入编辑
9777
9781
  */
9778
- startOverlayEdit(e) {
9779
- return this.overlayEditor.start(e);
9782
+ startOverlayEdit(e, t) {
9783
+ return this.overlayEditor.start(e, t);
9780
9784
  }
9781
9785
  /**
9782
9786
  * 设置实体 hover 高亮处理器(鼠标移入高亮,移出取消)
@@ -10205,10 +10209,10 @@ class ci {
10205
10209
  const C = this.options.discreteOverlap;
10206
10210
  for (const x of e) {
10207
10211
  if (!Number.isFinite(x.lon) || !Number.isFinite(x.lat) || !Number.isFinite(x.value)) continue;
10208
- const M = this.getDiscreteBucketIndex(x.value), D = Math.round((x.lon - c) / f * (t - 1)), E = Math.round((1 - (x.lat - d) / m) * (i - 1));
10209
- if (!(D < 0 || D >= t || E < 0 || E >= i))
10210
- for (const H of y) {
10211
- const O = D + H.dx, L = E + H.dy;
10212
+ const M = this.getDiscreteBucketIndex(x.value), H = Math.round((x.lon - c) / f * (t - 1)), E = Math.round((1 - (x.lat - d) / m) * (i - 1));
10213
+ if (!(H < 0 || H >= t || E < 0 || E >= i))
10214
+ for (const D of y) {
10215
+ const O = H + D.dx, L = E + D.dy;
10212
10216
  if (O < 0 || O >= t || L < 0 || L >= i) continue;
10213
10217
  const A = L * t + O;
10214
10218
  (C === "last" || M > w[A]) && (w[A] = M);
@@ -10221,8 +10225,8 @@ class ci {
10221
10225
  N[x * 4 + 3] = 0;
10222
10226
  continue;
10223
10227
  }
10224
- const D = l[Math.min(l.length - 1, Math.max(0, M))];
10225
- N[x * 4] = D.r, N[x * 4 + 1] = D.g, N[x * 4 + 2] = D.b, N[x * 4 + 3] = Math.round(D.a / 255 * T);
10228
+ const H = l[Math.min(l.length - 1, Math.max(0, M))];
10229
+ N[x * 4] = H.r, N[x * 4 + 1] = H.g, N[x * 4 + 2] = H.b, N[x * 4 + 3] = Math.round(H.a / 255 * T);
10226
10230
  }
10227
10231
  o.putImageData(P, 0, 0), this.updateImageryLayer();
10228
10232
  }
@@ -10537,31 +10541,31 @@ class ci {
10537
10541
  }
10538
10542
  const g = r.Math.toDegrees(this.fullDataRectangle.west), f = r.Math.toDegrees(this.fullDataRectangle.east), m = r.Math.toDegrees(this.fullDataRectangle.south), p = r.Math.toDegrees(this.fullDataRectangle.north), y = f - g || 1, v = p - m || 1, w = new Float32Array(i * n), C = Math.max(1, Math.round(o)), P = [], N = C * C;
10539
10543
  for (let E = -C; E <= C; E++)
10540
- for (let H = -C; H <= C; H++) {
10541
- const O = H * H + E * E;
10544
+ for (let D = -C; D <= C; D++) {
10545
+ const O = D * D + E * E;
10542
10546
  if (O > N) continue;
10543
10547
  const A = 1 - Math.sqrt(O) / C;
10544
- A <= 0 || P.push({ dx: H, dy: E, w: A });
10548
+ A <= 0 || P.push({ dx: D, dy: E, w: A });
10545
10549
  }
10546
10550
  for (const E of e) {
10547
10551
  if (!Number.isFinite(E.lon) || !Number.isFinite(E.lat)) continue;
10548
- const H = (E.value - h) / (d - h || 1);
10549
- if (H <= 0) continue;
10552
+ const D = (E.value - h) / (d - h || 1);
10553
+ if (D <= 0) continue;
10550
10554
  const O = Math.round((E.lon - g) / y * (i - 1)), L = Math.round((1 - (E.lat - m) / v) * (n - 1));
10551
10555
  if (!(O < 0 || O >= i || L < 0 || L >= n))
10552
10556
  for (const A of P) {
10553
10557
  const Q = O + A.dx, ee = L + A.dy;
10554
- Q < 0 || Q >= i || ee < 0 || ee >= n || (w[ee * i + Q] += H * A.w);
10558
+ Q < 0 || Q >= i || ee < 0 || ee >= n || (w[ee * i + Q] += D * A.w);
10555
10559
  }
10556
10560
  }
10557
- const T = l.createImageData(i, n), x = T.data, M = Math.max(0.01, s ?? 1), D = Math.min(1, Math.max(0, a ?? 0));
10561
+ const T = l.createImageData(i, n), x = T.data, M = Math.max(0.01, s ?? 1), H = Math.min(1, Math.max(0, a ?? 0));
10558
10562
  for (let E = 0; E < w.length; E++) {
10559
- const H = Math.min(1, Math.max(0, w[E]));
10560
- if (H <= 0) {
10563
+ const D = Math.min(1, Math.max(0, w[E]));
10564
+ if (D <= 0) {
10561
10565
  x[E * 4 + 3] = 0;
10562
10566
  continue;
10563
10567
  }
10564
- const O = Math.pow(H, M), L = Math.max(D, O), A = Math.min(255, Math.max(0, Math.round(L * 255))), Q = Math.min(255, Math.max(0, Math.round(H * 255))) * 4;
10568
+ const O = Math.pow(D, M), L = Math.max(H, O), A = Math.min(255, Math.max(0, Math.round(L * 255))), Q = Math.min(255, Math.max(0, Math.round(D * 255))) * 4;
10565
10569
  x[E * 4] = this.gradientLUT[Q], x[E * 4 + 1] = this.gradientLUT[Q + 1], x[E * 4 + 2] = this.gradientLUT[Q + 2], x[E * 4 + 3] = Math.round(A * this.options.opacity);
10566
10570
  }
10567
10571
  l.putImageData(T, 0, 0), this.updateImageryLayer();
@@ -10590,7 +10594,7 @@ class ci {
10590
10594
  function _e(u) {
10591
10595
  return typeof u == "string" ? r.Color.fromCssColorString(u) : u;
10592
10596
  }
10593
- class he {
10597
+ class ue {
10594
10598
  static CLUSTER_STYLE_MIN_INTERVAL_MS = 33;
10595
10599
  // ~30fps
10596
10600
  static CLICK_PICK_MIN_INTERVAL_MS = 120;
@@ -10608,9 +10612,9 @@ class he {
10608
10612
  constructor(e, t = {}) {
10609
10613
  this.viewer = e;
10610
10614
  const i = t.id || `vmap-point-cluster-${Math.random().toString(36).slice(2)}`;
10611
- this.layerId = i, this.pickGovernor = new de({
10615
+ this.layerId = i, this.pickGovernor = new ge({
10612
10616
  profiles: {
10613
- cluster: { minIntervalMs: he.CLICK_PICK_MIN_INTERVAL_MS, minMovePx: 0 }
10617
+ cluster: { minIntervalMs: ue.CLICK_PICK_MIN_INTERVAL_MS, minMovePx: 0 }
10614
10618
  }
10615
10619
  }), this.options = {
10616
10620
  id: i,
@@ -10694,7 +10698,7 @@ class he {
10694
10698
  enqueueClusterStyle(e, t) {
10695
10699
  if (this.pendingClusterStyles.set(t, Array.isArray(e) ? e.slice() : []), this.clusterStyleRAF !== null || this.clusterStyleTimer !== null)
10696
10700
  return;
10697
- const i = Date.now(), n = Math.max(0, he.CLUSTER_STYLE_MIN_INTERVAL_MS - (i - this.lastClusterStyleFlushTime));
10701
+ const i = Date.now(), n = Math.max(0, ue.CLUSTER_STYLE_MIN_INTERVAL_MS - (i - this.lastClusterStyleFlushTime));
10698
10702
  if (n > 0) {
10699
10703
  this.clusterStyleTimer = window.setTimeout(() => {
10700
10704
  this.clusterStyleTimer = null, this.clusterStyleRAF = window.requestAnimationFrame(() => {
@@ -10772,10 +10776,10 @@ const ui = {
10772
10776
  initCesium: Ye,
10773
10777
  initCesiumMap: Ye,
10774
10778
  HeatmapLayer: ci,
10775
- PointClusterLayer: he
10779
+ PointClusterLayer: ue
10776
10780
  };
10777
10781
  export {
10778
- ue as BaseDraw,
10782
+ de as BaseDraw,
10779
10783
  xt as CesiumMapController,
10780
10784
  Bt as CesiumMapToolbar,
10781
10785
  q as CesiumOverlayService,
@@ -10786,7 +10790,7 @@ export {
10786
10790
  vt as DrawPolygon,
10787
10791
  Ct as DrawRectangle,
10788
10792
  ci as HeatmapLayer,
10789
- ce as MapCircle,
10793
+ he as MapCircle,
10790
10794
  Kt as MapIcon,
10791
10795
  $t as MapInfoWindow,
10792
10796
  qt as MapLabel,
@@ -10798,8 +10802,8 @@ export {
10798
10802
  si as MapRing,
10799
10803
  Jt as MapSVG,
10800
10804
  Lt as NotFlyZonesService,
10801
- he as PointClusterLayer,
10802
- Dt as SearchService,
10805
+ ue as PointClusterLayer,
10806
+ Ht as SearchService,
10803
10807
  ui as default,
10804
10808
  J as defaultButtonSorts,
10805
10809
  ze as defaultButtons,