@vsleem-realsee-viewer/shared 1.1.3 → 2.0.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.mjs CHANGED
@@ -1,207 +1,224 @@
1
- var W = Object.defineProperty;
2
- var Q = (i, t, e) => t in i ? W(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var r = (i, t, e) => Q(i, typeof t != "symbol" ? t + "" : t, e);
4
- var P = /* @__PURE__ */ ((i) => (i[i.CADModel = 5] = "CADModel", i[i.BimfaceModel = 6] = "BimfaceModel", i[i.ForgeModel = 7] = "ForgeModel", i[i.ThreeDModel = 8] = "ThreeDModel", i[i.SkyMapModel = 9] = "SkyMapModel", i[i.ScaleModel = 10] = "ScaleModel", i))(P || {}), K = /* @__PURE__ */ ((i) => (i[i.Global = 0] = "Global", i))(K || {}), x = /* @__PURE__ */ ((i) => (i[i.Space = 0] = "Space", i[i.Model = 1] = "Model", i[i.Data = 2] = "Data", i))(x || {}), L = /* @__PURE__ */ ((i) => (i[i.Used = 0] = "Used", i[i.Enabled = 1] = "Enabled", i[i.Disabled = 2] = "Disabled", i))(L || {}), X = /* @__PURE__ */ ((i) => (i[i.SUCCESS = 200] = "SUCCESS", i[i.ERROR = -1] = "ERROR", i[i.TIMEOUT = 401] = "TIMEOUT", i))(X || {}), g = /* @__PURE__ */ ((i) => (i.GET = "GET", i.POST = "POST", i))(g || {}), D = /* @__PURE__ */ ((i) => (i.JSON = "application/json", i.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", i.FORM_DATA = "multipart/form-data;charset=UTF-8", i.OCTET_STREAM = "'application/octet-stream", i))(D || {}), tt = /* @__PURE__ */ ((i) => (i.Hw = "huawei", i.Ali = "aliyun", i.Hs = "hs", i.Aws = "amazon", i.Minio = "minio", i))(tt || {}), M = /* @__PURE__ */ ((i) => (i[i.GEO_POINT_NO_PLANE = 9e3] = "GEO_POINT_NO_PLANE", i[i.POINT_AND_GIS_NO_MAPPING = 9010] = "POINT_AND_GIS_NO_MAPPING", i[i.POINT_NO_PLANE = 9011] = "POINT_NO_PLANE", i[i.RELATIVE_MAP_MAPPING_SAME = 9020] = "RELATIVE_MAP_MAPPING_SAME", i[i.RELATIVE_NO_PLANE = 9021] = "RELATIVE_NO_PLANE", i[i.RELATIVE_JSON_ERROR = 9022] = "RELATIVE_JSON_ERROR", i))(M || {});
5
- const et = {
1
+ var et = Object.defineProperty;
2
+ var st = (i, t, e) => t in i ? et(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var o = (i, t, e) => st(i, typeof t != "symbol" ? t + "" : t, e);
4
+ class y extends Error {
5
+ constructor(t, e, s) {
6
+ super(e), this.code = t, this.message = e, this.details = s, this.name = "Apprror", Object.setPrototypeOf(this, y.prototype);
7
+ }
8
+ // 可选的:转换成 JSON 格式,方便返回给调用方
9
+ toJSON() {
10
+ return {
11
+ code: this.code,
12
+ message: this.message,
13
+ details: this.details,
14
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
15
+ };
16
+ }
17
+ }
18
+ var N = /* @__PURE__ */ ((i) => (i[i.CADModel = 5] = "CADModel", i[i.BIMModel = 6] = "BIMModel", i[i.ForgeModel = 7] = "ForgeModel", i[i.ThreeDModel = 8] = "ThreeDModel", i[i.SkyMapModel = 9] = "SkyMapModel", i[i.ScaleModel = 10] = "ScaleModel", i))(N || {}), it = /* @__PURE__ */ ((i) => (i[i.Global = 0] = "Global", i))(it || {}), M = /* @__PURE__ */ ((i) => (i[i.Space = 0] = "Space", i[i.Model = 1] = "Model", i[i.Data = 2] = "Data", i))(M || {}), O = /* @__PURE__ */ ((i) => (i[i.Used = 0] = "Used", i[i.Enabled = 1] = "Enabled", i[i.Disabled = 2] = "Disabled", i))(O || {}), Y = /* @__PURE__ */ ((i) => (i[i.SUCCESS = 200] = "SUCCESS", i[i.ERROR = -1] = "ERROR", i[i.TIMEOUT = 401] = "TIMEOUT", i))(Y || {}), x = /* @__PURE__ */ ((i) => (i.GET = "GET", i.POST = "POST", i))(x || {}), R = /* @__PURE__ */ ((i) => (i.JSON = "application/json", i.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", i.FORM_DATA = "multipart/form-data;charset=UTF-8", i.OCTET_STREAM = "'application/octet-stream", i))(R || {}), nt = /* @__PURE__ */ ((i) => (i.Hw = "huawei", i.Ali = "aliyun", i.Hs = "hs", i.Aws = "amazon", i.Minio = "minio", i))(nt || {}), w = /* @__PURE__ */ ((i) => (i[i.GeoPointNoPlane = 9e3] = "GeoPointNoPlane", i[i.PointUnmappedGIS = 9010] = "PointUnmappedGIS", i[i.PointNoXYZ = 9011] = "PointNoXYZ", i[i.PointNoPlane = 9012] = "PointNoPlane", i[i.RelativePlaneUnmatch = 9020] = "RelativePlaneUnmatch", i[i.RelativeNoPlane = 9021] = "RelativeNoPlane", i[i.RelativeJsonError = 9022] = "RelativeJsonError", i[i.RequestCodeError = 9030] = "RequestCodeError", i[i.RequestResultError = 9031] = "RequestResultError", i[i.RequestUnknownError = 9032] = "RequestUnknownError", i))(w || {});
19
+ const rt = {
6
20
  baseUrl: "https://vsleem.com/api",
7
21
  obsType: "hs"
8
- }, st = {
22
+ }, ot = {
9
23
  isTransformResponse: !0,
10
24
  joinBaseUrl: !0,
11
25
  withAuthorize: !0
12
- }, it = {
26
+ }, at = {
13
27
  url: "",
14
- method: g.GET,
28
+ method: x.GET,
15
29
  headers: {}
16
- }, F = { ...et };
17
- function nt(i) {
18
- Object.assign(F, i);
30
+ }, B = { ...rt };
31
+ function ht(i) {
32
+ Object.assign(B, i);
19
33
  }
20
- async function b(i, t) {
21
- const e = { ...st, ...t }, s = { ...it, ...i };
34
+ async function T(i, t) {
35
+ const e = { ...ot, ...t }, s = { ...at, ...i };
22
36
  try {
23
- const n = rt(s, e), { url: a, ...o } = n, c = await (await window.fetch(a, o)).json();
24
- return at(c, e);
37
+ const n = ct(s, e), { url: r, ...a } = n, c = await (await window.fetch(r, a)).json();
38
+ return lt(c, e);
25
39
  } catch (n) {
26
- return ot(n);
40
+ return ut(n);
27
41
  }
28
42
  }
29
- function rt(i, t) {
30
- const { baseUrl: e, authorizeCode: s } = F, { joinBaseUrl: n } = t;
31
- let { url: a, method: o, headers: h = {}, params: c, data: l } = i;
32
- n && e && (a = `${e}${a}`), o = o == null ? void 0 : o.toUpperCase();
33
- const u = { ...h };
34
- if (o === g.POST && !u["Content-Type"] && (u["Content-Type"] = D.JSON), o === g.GET && c) {
35
- const d = new URLSearchParams(c);
36
- a += `?${d.toString()}`;
37
- }
38
- let f;
39
- return o === g.POST && (f = u["Content-Type"] === D.JSON ? JSON.stringify(l || {}) : l), {
43
+ function ct(i, t) {
44
+ const { baseUrl: e, authorizeCode: s } = B, { joinBaseUrl: n, withAuthorize: r } = t;
45
+ let { url: a, method: h, headers: c = {}, params: u, data: f } = i;
46
+ n && e && (a = `${e}${a}`), h = h == null ? void 0 : h.toUpperCase();
47
+ const l = { ...c };
48
+ if (e && (l.PlatForm = new URL(e).hostname), r && s && (l.AuthorizationCode = s), h === x.POST && !l["Content-Type"] && (l["Content-Type"] = R.JSON), h === x.GET && u) {
49
+ const b = new URLSearchParams(u);
50
+ a += `?${b.toString()}`;
51
+ }
52
+ let d;
53
+ return h === x.POST && (d = l["Content-Type"] === R.JSON ? JSON.stringify(f || {}) : f), {
40
54
  url: a,
41
- method: o,
42
- headers: u,
43
- body: f
55
+ method: h,
56
+ headers: l,
57
+ body: d
44
58
  };
45
59
  }
46
- function at(i, t) {
60
+ function lt(i, t) {
47
61
  if (!t.isTransformResponse)
48
62
  return i;
49
63
  if (!i)
50
- throw new Error("Request no return data!");
64
+ throw new y(w.RequestResultError, "请求返回的结果错误");
51
65
  const { code: e, data: s, msg: n } = i;
52
- if (e === X.SUCCESS)
66
+ if (e === Y.SUCCESS)
53
67
  return s;
54
- throw new Error(n || "Request error!");
68
+ throw new y(w.RequestCodeError, n || "请求返回的Code错误");
55
69
  }
56
- function ot(i) {
57
- throw i instanceof Error ? i : new Error(typeof i == "string" ? i : "Unknown request error");
70
+ function ut(i) {
71
+ throw i instanceof Error ? i : new y(
72
+ w.RequestUnknownError,
73
+ typeof i == "string" ? i : "未知的请求错误"
74
+ );
58
75
  }
59
- const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76
+ const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
60
77
  __proto__: null,
61
- request: b,
62
- setRequestGlobalConfig: nt
78
+ request: T,
79
+ setRequestGlobalConfig: ht
63
80
  }, Symbol.toStringTag, { value: "Module" }));
64
- function Y(i, t) {
65
- return b(
81
+ function G(i, t) {
82
+ return T(
66
83
  {
67
84
  url: "/project/jssdk/cs/list",
68
- method: g.GET,
85
+ method: x.GET,
69
86
  params: i
70
87
  },
71
88
  t
72
89
  );
73
90
  }
74
- function G(i, t) {
75
- return b(
91
+ function $(i, t) {
92
+ return T(
76
93
  {
77
94
  url: "/project/jssdk/cs/bind",
78
- method: g.POST,
95
+ method: x.POST,
79
96
  data: i
80
97
  },
81
98
  t
82
99
  );
83
100
  }
84
- function A(i, t) {
85
- return b(
101
+ function L(i, t) {
102
+ return T(
86
103
  {
87
104
  url: "/project/jssdk/cs/save",
88
- method: g.POST,
105
+ method: x.POST,
89
106
  data: i
90
107
  },
91
108
  t
92
109
  );
93
110
  }
94
- function B(i, t) {
95
- return b(
111
+ function _(i, t) {
112
+ return T(
96
113
  {
97
114
  url: "/project/jssdk/cs/delete",
98
- method: g.POST,
115
+ method: x.POST,
99
116
  data: i
100
117
  },
101
118
  t
102
119
  );
103
120
  }
104
- function U(i, t) {
105
- return b(
121
+ function Z(i, t) {
122
+ return T(
106
123
  {
107
124
  url: "/project/jssdk/cs/mapping",
108
- method: g.POST,
125
+ method: x.POST,
109
126
  data: i
110
127
  },
111
128
  t
112
129
  );
113
130
  }
114
- function $(i, t) {
115
- return b(
131
+ function q(i, t) {
132
+ return T(
116
133
  {
117
134
  url: "/project/jssdk/cs/mapping/query",
118
- method: g.GET,
135
+ method: x.GET,
119
136
  params: i
120
137
  },
121
138
  t
122
139
  );
123
140
  }
124
- function ht(i, t = {
141
+ function ft(i, t = {
125
142
  isTransformResponse: !1,
126
143
  joinBaseUrl: !1,
127
144
  withAuthorize: !1
128
145
  }) {
129
- return b(
146
+ return T(
130
147
  {
131
148
  url: i,
132
- method: g.GET
149
+ method: x.GET
133
150
  },
134
151
  t
135
152
  );
136
153
  }
137
- const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154
+ const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
138
155
  __proto__: null,
139
- bindCoordinate: G,
140
- getCoordinateList: Y,
141
- getImageInfo: ht,
142
- getMappingRelation: $,
143
- mapingCoordinate: U,
144
- removeCoordinate: B,
145
- saveCoordinate: A
146
- }, Symbol.toStringTag, { value: "Module" })), ct = typeof window < "u", lt = Object.prototype.toString;
156
+ bindCoordinate: $,
157
+ getCoordinateList: G,
158
+ getImageInfo: ft,
159
+ getMappingRelation: q,
160
+ mapingCoordinate: Z,
161
+ removeCoordinate: _,
162
+ saveCoordinate: L
163
+ }, Symbol.toStringTag, { value: "Module" })), dt = typeof window < "u", mt = Object.prototype.toString;
147
164
  function v(i, t) {
148
- return lt.call(i) === `[object ${t}]`;
165
+ return mt.call(i) === `[object ${t}]`;
149
166
  }
150
167
  function J(i) {
151
168
  return typeof i < "u";
152
169
  }
153
- function V(i) {
170
+ function H(i) {
154
171
  return !J(i);
155
172
  }
156
- function R(i) {
173
+ function A(i) {
157
174
  return i !== null && v(i, "Object");
158
175
  }
159
- function Z(i) {
176
+ function V(i) {
160
177
  return i === null;
161
178
  }
162
- function ut(i) {
179
+ function yt(i) {
163
180
  return v(i, "Date");
164
181
  }
165
- function ft(i) {
182
+ function wt(i) {
166
183
  return v(i, "String");
167
184
  }
168
- function _(i) {
185
+ function j(i) {
169
186
  return typeof i == "function";
170
187
  }
171
- function dt(i) {
188
+ function gt(i) {
172
189
  return v(i, "Boolean");
173
190
  }
174
- function mt(i) {
191
+ function pt(i) {
175
192
  return v(i, "RegExp");
176
193
  }
177
- function S(i) {
194
+ function P(i) {
178
195
  return i && Array.isArray(i);
179
196
  }
180
- function yt(i) {
197
+ function xt(i) {
181
198
  return typeof window < "u" && v(i, "Window");
182
199
  }
183
- function wt(i) {
184
- return R(i) && !!i.tagName;
200
+ function Mt(i) {
201
+ return A(i) && !!i.tagName;
185
202
  }
186
- function gt(i) {
203
+ function vt(i) {
187
204
  return typeof i == "number" || /^\d+(\.\d+)?$/.test(i);
188
205
  }
189
- function O(i) {
206
+ function z(i) {
190
207
  return v(Number(i), "Number");
191
208
  }
192
- function pt(i, t) {
209
+ function bt(i, t) {
193
210
  return JSON.stringify(i) === JSON.stringify(t);
194
211
  }
195
- function Mt(i) {
196
- return V(i) || Z(i);
212
+ function St(i) {
213
+ return H(i) || V(i);
197
214
  }
198
- function xt(i) {
199
- return v(i, "Promise") && R(i) && _(i.then) && _(i.catch);
215
+ function Tt(i) {
216
+ return v(i, "Promise") && A(i) && j(i.then) && j(i.catch);
200
217
  }
201
- function q(i) {
202
- return N(i, /* @__PURE__ */ new WeakMap());
218
+ function W(i) {
219
+ return E(i, /* @__PURE__ */ new WeakMap());
203
220
  }
204
- function N(i, t) {
221
+ function E(i, t) {
205
222
  if (typeof i != "object" || i === null)
206
223
  return i;
207
224
  if (t.has(i))
@@ -212,12 +229,12 @@ function N(i, t) {
212
229
  if (i instanceof RegExp)
213
230
  return e = new RegExp(i), t.set(i, e), e;
214
231
  if (i instanceof Map)
215
- return e = /* @__PURE__ */ new Map(), t.set(i, e), i.forEach((n, a) => {
216
- e.set(a, N(n, t));
232
+ return e = /* @__PURE__ */ new Map(), t.set(i, e), i.forEach((n, r) => {
233
+ e.set(r, E(n, t));
217
234
  }), e;
218
235
  if (i instanceof Set)
219
236
  return e = /* @__PURE__ */ new Set(), t.set(i, e), i.forEach((n) => {
220
- e.add(N(n, t));
237
+ e.add(E(n, t));
221
238
  }), e;
222
239
  if (ArrayBuffer.isView(i))
223
240
  return e = new i.constructor(
@@ -230,66 +247,86 @@ function N(i, t) {
230
247
  if (Array.isArray(i)) {
231
248
  e = [], t.set(i, e);
232
249
  for (let n = 0; n < i.length; n++)
233
- n in i && (e[n] = N(i[n], t));
250
+ n in i && (e[n] = E(i[n], t));
234
251
  return e;
235
252
  }
236
253
  e = Object.create(Object.getPrototypeOf(i)), t.set(i, e);
237
254
  for (const n in i)
238
- Object.prototype.hasOwnProperty.call(i, n) && (e[n] = N(i[n], t));
255
+ Object.prototype.hasOwnProperty.call(i, n) && (e[n] = E(i[n], t));
239
256
  const s = Object.getOwnPropertySymbols(i);
240
257
  for (const n of s)
241
- Object.prototype.propertyIsEnumerable.call(i, n) && (e[n] = N(i[n], t));
258
+ Object.prototype.propertyIsEnumerable.call(i, n) && (e[n] = E(i[n], t));
242
259
  return e;
243
260
  }
244
- function vt(i, t, e = !1) {
261
+ function Pt(i, t, e = !1) {
245
262
  let s;
246
- const n = function(...a) {
247
- const o = this, h = e && !s;
263
+ const n = function(...r) {
264
+ const a = this, h = e && !s;
248
265
  s && clearTimeout(s), s = setTimeout(() => {
249
- s = void 0, e || i.apply(o, a);
250
- }, t), h && i.apply(o, a);
266
+ s = void 0, e || i.apply(a, r);
267
+ }, t), h && i.apply(a, r);
251
268
  };
252
269
  return n.cancel = () => {
253
270
  s && clearTimeout(s), s = void 0;
254
271
  }, n;
255
272
  }
256
- function Tt(i, t, e = !1) {
273
+ function Et(i, t, e = !1) {
257
274
  let s, n;
258
- const a = function(...o) {
275
+ const r = function(...a) {
259
276
  const h = this;
260
277
  n ? (clearTimeout(s), s = setTimeout(
261
278
  () => {
262
- Date.now() - n >= t && (i.apply(h, o), n = Date.now());
279
+ Date.now() - n >= t && (i.apply(h, a), n = Date.now());
263
280
  },
264
281
  t - (Date.now() - n)
265
- )) : (e && i.apply(h, o), n = Date.now());
282
+ )) : (e && i.apply(h, a), n = Date.now());
266
283
  };
267
- return a.cancel = () => {
284
+ return r.cancel = () => {
268
285
  clearTimeout(s), s = void 0, n = void 0;
269
- }, a;
286
+ }, r;
287
+ }
288
+ function k(i, ...t) {
289
+ if (!t.length) return i;
290
+ const e = t.shift();
291
+ return e === void 0 ? i : (I(i) && I(e) && Object.keys(e).forEach((s) => {
292
+ const n = i[s], r = e[s];
293
+ Array.isArray(n) && Array.isArray(r) ? i[s] = [...n, ...r] : I(n) && I(r) ? i[s] = k({ ...n }, r) : r !== void 0 && (i[s] = r);
294
+ }), k(i, ...t));
295
+ }
296
+ function I(i) {
297
+ return i !== null && typeof i == "object" && !Array.isArray(i);
270
298
  }
271
- function bt(i, t = {}) {
299
+ function Q(i, ...t) {
300
+ if (!t.length) return i;
301
+ for (const e of t)
302
+ e != null && typeof e == "object" && Object.keys(e).forEach((s) => {
303
+ const n = e[s], r = i[s];
304
+ n !== null && typeof n == "object" && !Array.isArray(n) ? ((!r || typeof r != "object") && (i[s] = {}), Q(i[s], n)) : i[s] = n;
305
+ });
306
+ return i;
307
+ }
308
+ function Nt(i, t = {}) {
272
309
  return new Promise((e, s) => {
273
- const n = z(i);
274
- if (St(n)) {
310
+ const n = C(i);
311
+ if (zt(n)) {
275
312
  e(!0);
276
313
  return;
277
314
  }
278
- const a = document.createElement("script");
279
- a.src = i, Object.entries(t).forEach(([o, h]) => {
280
- h !== !1 && a.setAttribute(o, h === !0 ? "" : String(h));
281
- }), a.onload = () => {
315
+ const r = document.createElement("script");
316
+ r.src = i, Object.entries(t).forEach(([a, h]) => {
317
+ h !== !1 && r.setAttribute(a, h === !0 ? "" : String(h));
318
+ }), r.onload = () => {
282
319
  e(!0);
283
- }, a.onerror = () => {
284
- document.head.removeChild(a), s(new Error(`Failed to load script: ${i}`));
285
- }, document.head.appendChild(a);
320
+ }, r.onerror = () => {
321
+ document.head.removeChild(r), s(new Error(`Failed to load script: ${i}`));
322
+ }, document.head.appendChild(r);
286
323
  });
287
324
  }
288
- function St(i) {
289
- const t = z(i);
290
- return Array.from(document.scripts).some((e) => z(e.src) === t);
325
+ function zt(i) {
326
+ const t = C(i);
327
+ return Array.from(document.scripts).some((e) => C(e.src) === t);
291
328
  }
292
- function z(i) {
329
+ function C(i) {
293
330
  try {
294
331
  const t = new URL(i, window.location.href);
295
332
  return `${t.origin}${t.pathname}`;
@@ -297,176 +334,240 @@ function z(i) {
297
334
  return i;
298
335
  }
299
336
  }
300
- function Et(i, t, e, s) {
301
- const n = Math.min(i / e, t / s), a = e * n, o = s * n;
337
+ function Dt(i, t, e, s) {
338
+ const n = Math.min(i / e, t / s), r = e * n, a = s * n;
302
339
  return {
303
340
  scale: n,
304
- x: (i - a) / 2,
341
+ x: (i - r) / 2,
305
342
  // 居中计算的X起点
306
- y: (t - o) / 2,
343
+ y: (t - a) / 2,
307
344
  // 居中计算的Y起点
308
- sw: a,
309
- sh: o
345
+ sw: r,
346
+ sh: a
310
347
  };
311
348
  }
312
- function Nt(i, t, e) {
349
+ function It(i, t, e) {
313
350
  return {
314
351
  x: i * e.scale + e.x,
315
352
  // 缩放后加上偏移量
316
353
  y: t * e.scale + e.y
317
354
  };
318
355
  }
319
- function Pt(i, t, e) {
356
+ function Ot(i, t, e) {
320
357
  return {
321
358
  x: (i - e.x) / e.scale,
322
359
  // 减去偏移量后缩放到模型尺寸
323
360
  y: (t - e.y) / e.scale
324
361
  };
325
362
  }
326
- function Ot(i) {
363
+ function Rt(i) {
327
364
  console.warn(`[warn]:${i}`);
328
365
  }
329
- function It(i) {
366
+ function Lt(i) {
330
367
  throw new Error(`[error]:${i}`);
331
368
  }
332
- const zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
369
+ const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
333
370
  __proto__: null,
334
- cloneDeep: q,
335
- debounce: vt,
336
- error: It,
337
- getImageTransform: Et,
338
- inBrowser: ct,
371
+ cloneDeep: W,
372
+ debounce: Pt,
373
+ deepMerge: k,
374
+ deepMergeProps: Q,
375
+ error: Lt,
376
+ getImageTransform: Dt,
377
+ inBrowser: dt,
339
378
  is: v,
340
- isArray: S,
341
- isBoolean: dt,
342
- isDate: ut,
379
+ isArray: P,
380
+ isBoolean: gt,
381
+ isDate: yt,
343
382
  isDef: J,
344
- isElement: wt,
345
- isFunction: _,
346
- isNull: Z,
347
- isNullOrUnDef: Mt,
348
- isNumber: O,
349
- isNumeric: gt,
350
- isObject: R,
351
- isPromise: xt,
352
- isRegExp: mt,
353
- isSameValue: pt,
354
- isString: ft,
355
- isUnDef: V,
356
- isWindow: yt,
357
- loadScript: bt,
358
- throttle: Tt,
359
- toCanvasCoord: Nt,
360
- toModelCoord: Pt,
361
- warn: Ot
383
+ isElement: Mt,
384
+ isFunction: j,
385
+ isNull: V,
386
+ isNullOrUnDef: St,
387
+ isNumber: z,
388
+ isNumeric: vt,
389
+ isObject: A,
390
+ isPromise: Tt,
391
+ isRegExp: pt,
392
+ isSameValue: bt,
393
+ isString: wt,
394
+ isUnDef: H,
395
+ isWindow: xt,
396
+ loadScript: Nt,
397
+ throttle: Et,
398
+ toCanvasCoord: It,
399
+ toModelCoord: Ot,
400
+ warn: Rt
362
401
  }, Symbol.toStringTag, { value: "Module" }));
363
- class p extends Error {
364
- constructor(t, e, s) {
365
- super(e), this.code = t, this.message = e, this.details = s, this.name = "Apprror", Object.setPrototypeOf(this, p.prototype);
366
- }
367
- // 可选的:转换成 JSON 格式,方便返回给调用方
368
- toJSON() {
369
- return {
370
- code: this.code,
371
- message: this.message,
372
- details: this.details,
373
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
374
- };
375
- }
376
- }
377
402
  class m {
403
+ // 默认平面 ('xy' 或 'xz')
378
404
  constructor(t) {
379
- r(this, "x", 0);
380
- r(this, "y", 0);
381
- r(this, "z", 0);
382
- r(this, "lat", 0);
383
- //经度
384
- r(this, "lon", 0);
385
- //纬度
386
- r(this, "alt", 0);
387
- //高度
388
- r(this, "yaw", 0);
389
- r(this, "pitch", 0);
390
- r(this, "roll", 0);
391
- r(this, "hasXYZ", !1);
392
- r(this, "hasGeo", !1);
393
- r(this, "hasAngle", !1);
394
- r(this, "plane", "xy");
395
- const { x: e, y: s, z: n, lat: a, lon: o, alt: h, yaw: c, pitch: l, roll: u, plane: f = "xy" } = t || {};
396
- O(e) && O(s) && (this.x = Number(e) || 0, this.y = Number(s) || 0, this.z = Number(n) || 0, this.plane = f, this.hasXYZ = !0), O(a) && O(o) && Number(a) !== 0 && Number(o) !== 0 && (this.lat = Number(a) || 0, this.lon = Number(o) || 0, this.alt = Number(h) || 0, this.hasGeo = !0), (c !== void 0 || l !== void 0 || u !== void 0) && (this.yaw = Number(c) || 0, this.pitch = Number(l) || 0, this.roll = Number(u) || 0, this.hasAngle = !0);
405
+ // 直角坐标系坐标
406
+ o(this, "x", 0);
407
+ o(this, "y", 0);
408
+ o(this, "z", 0);
409
+ // 地理坐标系坐标
410
+ o(this, "lat", 0);
411
+ // 经度 (longitude)
412
+ o(this, "lon", 0);
413
+ // 纬度 (latitude)
414
+ o(this, "alt", 0);
415
+ // 高度 (altitude)
416
+ // 欧拉角
417
+ o(this, "yaw", 0);
418
+ // 偏航角
419
+ o(this, "pitch", 0);
420
+ // 俯仰角
421
+ o(this, "roll", 0);
422
+ // 翻滚角
423
+ // 状态标志
424
+ o(this, "hasXYZ", !1);
425
+ // 是否有直角坐标
426
+ o(this, "hasGeo", !1);
427
+ // 是否有地理坐标
428
+ o(this, "hasAngle", !1);
429
+ // 是否有角度信息
430
+ o(this, "plane", "xy");
431
+ const { x: e, y: s, z: n, lat: r, lon: a, alt: h, yaw: c, pitch: u, roll: f, plane: l = "xy" } = t || {};
432
+ z(e) && z(s) && (this.x = Number(e) || 0, this.y = Number(s) || 0, this.z = Number(n) || 0, this.plane = l, this.hasXYZ = !0), z(r) && z(a) && Number(r) !== 0 && Number(a) !== 0 && (this.lat = Number(r) || 0, this.lon = Number(a) || 0, this.alt = Number(h) || 0, this.hasGeo = !0), (c !== void 0 || u !== void 0 || f !== void 0) && (this.yaw = Number(c) || 0, this.pitch = Number(u) || 0, this.roll = Number(f) || 0, this.hasAngle = !0);
397
433
  }
434
+ /**
435
+ * 计算两点之间的三维距离
436
+ * @param p1 点1
437
+ * @param p2 点2
438
+ * @returns 距离值
439
+ */
398
440
  static dist(t, e) {
399
- return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2 + (t.z - e.z) ** 2);
441
+ return Math.hypot(t.x - e.x, t.y - e.y, t.z - e.z);
400
442
  }
443
+ /**
444
+ * 计算两点在XZ平面上的距离
445
+ * @param p1 点1
446
+ * @param p2 点2
447
+ * @returns 距离值
448
+ */
401
449
  static distXZ(t, e) {
402
- return Math.sqrt((t.x - e.x) ** 2 + (t.z - e.z) ** 2);
450
+ return Math.hypot(t.x - e.x, t.z - e.z);
403
451
  }
452
+ /**
453
+ * 计算两点在XY平面上的距离
454
+ * @param p1 点1
455
+ * @param p2 点2
456
+ * @returns 距离值
457
+ */
404
458
  static distXY(t, e) {
405
- return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
459
+ return Math.hypot(t.x - e.x, t.y - e.y);
406
460
  }
461
+ /**
462
+ * 角度转弧度
463
+ * @param degrees 角度值
464
+ * @returns 弧度值
465
+ */
407
466
  static toRadians(t) {
408
467
  return (Number(t) || 0) * Math.PI / 180;
409
468
  }
469
+ /**
470
+ * 弧度转角度
471
+ * @param radians 弧度值
472
+ * @returns 角度值
473
+ */
410
474
  static toDegrees(t) {
411
475
  return (Number(t) || 0) * 180 / Math.PI;
412
476
  }
477
+ /**
478
+ * 计算三点在XZ平面上的夹角 (以pb为顶点)
479
+ * @param pa 点A
480
+ * @param pb 点B (顶点)
481
+ * @param pc 点C
482
+ * @returns 夹角角度 (0-180度)
483
+ */
413
484
  static angleXZ(t, e, s) {
414
- const n = { x: t.x - e.x, z: t.z - e.z }, a = { x: s.x - e.x, z: s.z - e.z }, o = n.x * a.x + n.z * a.z, h = Math.sqrt(n.x ** 2 + n.z ** 2), c = Math.sqrt(a.x ** 2 + a.z ** 2), l = Math.max(-1, Math.min(1, o / (h * c))), f = Math.acos(l) * 180 / Math.PI;
415
- return Math.min(f, 360 - f);
485
+ const n = { x: t.x - e.x, z: t.z - e.z }, r = { x: s.x - e.x, z: s.z - e.z }, a = n.x * r.x + n.z * r.z, h = Math.sqrt(n.x ** 2 + n.z ** 2), c = Math.sqrt(r.x ** 2 + r.z ** 2), u = Math.max(-1, Math.min(1, a / (h * c))), l = Math.acos(u) * 180 / Math.PI;
486
+ return Math.min(l, 360 - l);
416
487
  }
417
- static JSONParse(t) {
488
+ /**
489
+ * 从字符串解析点坐标 ("x,y,z")
490
+ * @param point 坐标字符串
491
+ * @returns Point对象
492
+ */
493
+ static toParse(t) {
418
494
  if (t) {
419
495
  const e = t == null ? void 0 : t.split(",").map((s) => Number(s) || 0);
420
496
  return new m({ x: e[0], y: e[1], z: e[2] });
421
497
  }
422
498
  }
423
- static JSONStringify(t) {
499
+ /**
500
+ * 将点坐标序列化为字符串 ("x,y,z")
501
+ * @param point 点对象
502
+ * @returns 坐标字符串
503
+ */
504
+ static toStringify(t) {
424
505
  return t ? `${t.x},${t.y},${t.z}` : "";
425
506
  }
426
507
  /**
427
- * 点的投射
428
- * @param r //映射关系
429
- * @param srcCoordinate 源坐标系
508
+ * 坐标投影转换
509
+ * @param r 映射关系
510
+ * @param srcCoordinate 源坐标系
430
511
  * @param dstCoordinate 目标坐标系
512
+ * @returns 转换后的点
513
+ * @throws AppError 当转换失败时抛出异常
431
514
  */
432
515
  projection(t, e, s) {
433
516
  try {
434
517
  if ((e == null ? void 0 : e.id) === (s == null ? void 0 : s.id))
435
518
  return new m(this);
436
- if ((e == null ? void 0 : e.modelType) === P.SkyMapModel) {
519
+ if ((e == null ? void 0 : e.modelType) === N.SkyMapModel) {
437
520
  const { refPoint: n } = (e == null ? void 0 : e.relativeMap) || {};
438
521
  if (this.hasGeo && n) {
439
- const a = I.LLHToXYZ(this, n);
440
- return this.x = a.x, this.y = a.y, this.z = a.z, this.hasXYZ = !0, this.project(t);
441
- } else
442
- throw new p(M.POINT_AND_GIS_NO_MAPPING, ",没有完成gis与其他空间的映射");
443
- } else if ((s == null ? void 0 : s.modelType) === P.SkyMapModel) {
444
- const { refPoint: n } = (s == null ? void 0 : s.relativeMap) || {}, a = this.project(t);
445
- if (a != null && a.hasXYZ && n) {
446
- const o = I.XYZToLLH(a, n);
447
- return a.lat = o.lat, a.lon = o.lon, a.alt = o.alt, a.hasGeo = !0, a;
448
- } else
449
- throw new p(M.POINT_AND_GIS_NO_MAPPING, "没有完成gis与其他空间的映射");
450
- } else
451
- return this.project(t);
522
+ const r = D.LLHToXYZ(this, n);
523
+ return this.x = r.x, this.y = r.y, this.z = r.z, this.hasXYZ = !0, this.project(t);
524
+ }
525
+ throw new y(w.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
526
+ }
527
+ if ((s == null ? void 0 : s.modelType) === N.SkyMapModel) {
528
+ const { refPoint: n } = (s == null ? void 0 : s.relativeMap) || {}, r = this.project(t);
529
+ if (r != null && r.hasXYZ && n) {
530
+ const a = D.XYZToLLH(r, n);
531
+ return r.lat = a.lat, r.lon = a.lon, r.alt = a.alt, r.hasGeo = !0, r;
532
+ }
533
+ throw new y(w.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
534
+ }
535
+ return this.project(t);
452
536
  } catch {
537
+ return;
453
538
  }
454
539
  }
540
+ /**
541
+ * 基础投影转换
542
+ * @param r 映射关系
543
+ * @returns 转换后的点
544
+ * @throws AppError 当没有坐标或平面无效时抛出异常
545
+ */
455
546
  project(t) {
456
- if (this.hasXYZ) {
457
- if (this.plane === "xz")
458
- return this.projectXZ(t);
459
- if (this.plane === "xy")
460
- return this.projectXY(t);
461
- throw new p(M.POINT_NO_PLANE, "点的plane应为xz或xy");
462
- }
547
+ if (!this.hasXYZ)
548
+ throw new y(w.PointNoXYZ, "点没有xxz坐标信息");
549
+ if (this.plane === "xz")
550
+ return this.projectXZ(t);
551
+ if (this.plane === "xy")
552
+ return this.projectXY(t);
553
+ throw new y(w.PointNoPlane, "点的plane应为xz或xy");
463
554
  }
555
+ /**
556
+ * XZ平面投影转换
557
+ * @param r 映射关系
558
+ * @returns 转换后的点
559
+ */
464
560
  projectXZ(t) {
465
561
  const e = new m(this);
466
562
  e.x *= t.scale, e.y *= t.scale, e.z *= t.scale, e.yaw !== void 0 && (e.yaw += t.yaw);
467
563
  const s = e.x * Math.cos(t.yaw) - e.z * Math.sin(t.yaw), n = e.x * Math.sin(t.yaw) + e.z * Math.cos(t.yaw);
468
564
  return e.x = s + t.x, e.y += t.y, e.z = n + t.z, e;
469
565
  }
566
+ /**
567
+ * XY平面投影转换
568
+ * @param r 映射关系
569
+ * @returns 转换后的点
570
+ */
470
571
  projectXY(t) {
471
572
  const e = new m(this);
472
573
  e.x *= t.scale, e.y *= t.scale, e.z *= t.scale, e.yaw !== void 0 && (e.yaw += t.yaw);
@@ -474,67 +575,67 @@ class m {
474
575
  return e.x = s + t.x, e.y = n + t.y, e.z += t.z, e;
475
576
  }
476
577
  }
477
- class I {
578
+ class D {
478
579
  //高度
479
580
  constructor(t) {
480
- r(this, "lat", 0);
581
+ o(this, "lat", 0);
481
582
  //经度
482
- r(this, "lon", 0);
583
+ o(this, "lon", 0);
483
584
  //纬度
484
- r(this, "alt", 0);
585
+ o(this, "alt", 0);
485
586
  const { lat: e = 0, lon: s = 0, alt: n = 0 } = t || {};
486
587
  this.lat = e, this.lon = s, this.alt = n;
487
588
  }
488
589
  static XYZToLLH(t, e) {
489
- const n = 0.0033528106647474805, a = n * (2 - n), o = m.toRadians(e.lat), h = 6378137 / Math.sqrt(1 - a * Math.sin(o) ** 2) + e.alt;
490
- let c, l, u;
590
+ const n = 0.0033528106647474805, r = n * (2 - n), a = m.toRadians(e.lat), h = 6378137 / Math.sqrt(1 - r * Math.sin(a) ** 2) + e.alt;
591
+ let c, u, f;
491
592
  if (t.plane === "xz") {
492
- const f = t.x / 1e3 / (h * Math.cos(o)), d = t.z / 1e3 / h;
493
- c = e.lon + m.toDegrees(f), l = e.lat - m.toDegrees(d), u = e.alt + t.y / 1e3;
593
+ const l = t.x / 1e3 / (h * Math.cos(a)), d = t.z / 1e3 / h;
594
+ c = e.lon + m.toDegrees(l), u = e.lat - m.toDegrees(d), f = e.alt + t.y / 1e3;
494
595
  } else if (t.plane === "xy") {
495
- const f = t.x / 1e3 / (h * Math.cos(o)), d = t.y / 1e3 / h;
496
- c = e.lon + m.toDegrees(f), l = e.lat - m.toDegrees(d), u = e.alt + t.z / 1e3;
596
+ const l = t.x / 1e3 / (h * Math.cos(a)), d = t.y / 1e3 / h;
597
+ c = e.lon + m.toDegrees(l), u = e.lat - m.toDegrees(d), f = e.alt + t.z / 1e3;
497
598
  } else
498
- throw new p(M.GEO_POINT_NO_PLANE, "点的plane应为xz或xy");
499
- return new I({
500
- lat: l,
599
+ throw new y(w.GeoPointNoPlane, "点的plane应为xz或xy");
600
+ return new D({
601
+ lat: u,
501
602
  lon: c,
502
- alt: u
603
+ alt: f
503
604
  });
504
605
  }
505
606
  static LLHToXYZ(t, e) {
506
- const n = 0.0033528106647474805, a = n * (2 - n), o = m.toRadians(e.lat), h = 6378137 / Math.sqrt(1 - a * Math.sin(o) ** 2) + e.alt, c = m.toRadians(t.lon - e.lon), l = m.toRadians(e.lat - t.lat), u = h * c * Math.cos(o), f = h * l;
607
+ const n = 0.0033528106647474805, r = n * (2 - n), a = m.toRadians(e.lat), h = 6378137 / Math.sqrt(1 - r * Math.sin(a) ** 2) + e.alt, c = m.toRadians(t.lon - e.lon), u = m.toRadians(e.lat - t.lat), f = h * c * Math.cos(a), l = h * u;
507
608
  if (t.plane === "xz")
508
609
  return new m({
509
- x: u * 1e3,
610
+ x: f * 1e3,
510
611
  y: (t.alt - e.alt) * 1e3,
511
- z: f * 1e3,
612
+ z: l * 1e3,
512
613
  plane: "xz"
513
614
  });
514
615
  if (t.plane === "xy")
515
616
  return new m({
516
- x: u * 1e3,
517
- y: f * 1e3,
617
+ x: f * 1e3,
618
+ y: l * 1e3,
518
619
  z: (t.alt - e.alt) * 1e3,
519
620
  plane: "xy"
520
621
  });
521
- throw new p(M.GEO_POINT_NO_PLANE, "点的plane应为xz或xy");
622
+ throw new y(w.GeoPointNoPlane, "点的plane应为xz或xy");
522
623
  }
523
624
  }
524
- class w {
625
+ class p {
525
626
  //参考点
526
627
  constructor(t) {
527
- r(this, "scale", 1);
528
- r(this, "yaw", 0);
529
- r(this, "x", 0);
530
- r(this, "y", 0);
531
- r(this, "z", 0);
532
- r(this, "start", 0);
533
- r(this, "end", -1);
534
- r(this, "plane", "xy");
535
- r(this, "refPoint");
628
+ o(this, "scale", 1);
629
+ o(this, "yaw", 0);
630
+ o(this, "x", 0);
631
+ o(this, "y", 0);
632
+ o(this, "z", 0);
633
+ o(this, "start", 0);
634
+ o(this, "end", -1);
635
+ o(this, "plane", "xy");
636
+ o(this, "refPoint");
536
637
  const { refPoint: e, ...s } = t || {};
537
- e && (this.refPoint = new I(e)), Object.assign(this, s);
638
+ e && (this.refPoint = new D(e)), Object.assign(this, s);
538
639
  }
539
640
  /**
540
641
  * 合并两个相对坐标系的映射关系
@@ -544,23 +645,23 @@ class w {
544
645
  */
545
646
  static addRelativeMap(t, e) {
546
647
  if (t.plane !== e.plane)
547
- throw new p(M.RELATIVE_MAP_MAPPING_SAME, "两个映射关系的plane应该相同");
548
- const s = t.scale * e.scale, n = t.yaw + e.yaw, a = Math.cos(e.yaw), o = Math.sin(e.yaw);
549
- let h = 0, c = 0, l = 0;
648
+ throw new y(w.RelativePlaneUnmatch, "两个映射关系的plane应该相同");
649
+ const s = t.scale * e.scale, n = t.yaw + e.yaw, r = Math.cos(e.yaw), a = Math.sin(e.yaw);
650
+ let h = 0, c = 0, u = 0;
550
651
  if (t.plane === "xz") {
551
- const u = t.x * a - t.z * o, f = t.y, d = t.x * o + t.z * a;
552
- h = e.x + u * e.scale, c = e.y + f * e.scale, l = e.z + d * e.scale;
652
+ const f = t.x * r - t.z * a, l = t.y, d = t.x * a + t.z * r;
653
+ h = e.x + f * e.scale, c = e.y + l * e.scale, u = e.z + d * e.scale;
553
654
  } else if (t.plane === "xy") {
554
- const u = t.x * a - t.y * o, f = t.x * o + t.y * a, d = t.z;
555
- h = e.x + u * e.scale, c = e.y + f * e.scale, l = e.z + d * e.scale;
655
+ const f = t.x * r - t.y * a, l = t.x * a + t.y * r, d = t.z;
656
+ h = e.x + f * e.scale, c = e.y + l * e.scale, u = e.z + d * e.scale;
556
657
  } else
557
- throw new p(M.RELATIVE_NO_PLANE, "映射关系的plane应为xz或xy");
558
- return new w({
658
+ throw new y(w.RelativeNoPlane, "映射关系的plane应为xz或xy");
659
+ return new p({
559
660
  scale: s,
560
661
  yaw: n,
561
662
  x: h,
562
663
  y: c,
563
- z: l,
664
+ z: u,
564
665
  start: t.start,
565
666
  end: t.end,
566
667
  plane: t.plane
@@ -572,18 +673,18 @@ class w {
572
673
  * @returns 逆映射
573
674
  */
574
675
  static inverseRelativeMap(t) {
575
- const e = 1 / t.scale, s = -t.yaw, n = Math.cos(-s), a = Math.sin(-s);
576
- let o = 0, h = 0, c = 0;
676
+ const e = 1 / t.scale, s = -t.yaw, n = Math.cos(-s), r = Math.sin(-s);
677
+ let a = 0, h = 0, c = 0;
577
678
  if (t.plane === "xz")
578
- o = -(t.x * n + t.z * a) * e, h = -t.y * e, c = -(t.z * n - t.x * a) * e;
679
+ a = -(t.x * n + t.z * r) * e, h = -t.y * e, c = -(t.z * n - t.x * r) * e;
579
680
  else if (t.plane === "xy")
580
- o = -(t.x * n + t.y * a) * e, h = -(t.y * n - t.x * a) * e, c = -t.z * e;
681
+ a = -(t.x * n + t.y * r) * e, h = -(t.y * n - t.x * r) * e, c = -t.z * e;
581
682
  else
582
- throw new p(M.RELATIVE_NO_PLANE, "映射关系的plane应为xz或xy");
583
- return new w({
683
+ throw new y(w.RelativeNoPlane, "映射关系的plane应为xz或xy");
684
+ return new p({
584
685
  scale: e,
585
686
  yaw: s,
586
- x: o,
687
+ x: a,
587
688
  y: h,
588
689
  z: c,
589
690
  start: t.start,
@@ -591,30 +692,30 @@ class w {
591
692
  plane: t.plane
592
693
  });
593
694
  }
594
- static JSONParse(t) {
695
+ static toParse(t) {
595
696
  try {
596
697
  let e = t ? JSON.parse(t) : void 0;
597
698
  const { reference_point: s } = e || {};
598
- return s && (e = { refPoint: s }), e ? new w(e) : void 0;
699
+ return s && (e = { refPoint: s }), e ? new p(e) : void 0;
599
700
  } catch {
600
- throw new p(M.RELATIVE_JSON_ERROR, "relativeMap格式化失败");
701
+ throw new y(w.RelativeJsonError, "relativeMap格式化失败");
601
702
  }
602
703
  }
603
- static JSONStringify(t) {
704
+ static toStringify(t) {
604
705
  return t ? JSON.stringify(t) : void 0;
605
706
  }
606
707
  }
607
- class y {
708
+ class g {
608
709
  /**
609
710
  * 获取坐标系树
610
711
  * @param projectId 项目id
611
712
  * @returns
612
713
  */
613
714
  static async getCoordinateTree(t) {
614
- const e = await Y({ projectId: t });
715
+ const e = await G({ projectId: t });
615
716
  if (e.length) {
616
- const s = y.handleCoordinateList(e);
617
- return y.buildCoordinateTree(s, 0);
717
+ const s = g.handleCoordinateList(e);
718
+ return g.buildCoordinateTree(s, 0);
618
719
  }
619
720
  }
620
721
  /**
@@ -624,18 +725,18 @@ class y {
624
725
  * @returns
625
726
  */
626
727
  static async addCoordinate(t, e) {
627
- const { projectId: s, id: n } = t, a = e.map((h) => {
628
- const { type: c, modelType: l, relativeMap: u, level: f, ...d } = h, E = u ? JSON.stringify(u) : void 0;
728
+ const { projectId: s, id: n } = t, r = e.map((h) => {
729
+ const { type: c, modelType: u, relativeMap: f, level: l, ...d } = h, b = f ? JSON.stringify(f) : void 0;
629
730
  return {
630
731
  ...d,
631
732
  projectId: s,
632
733
  parentId: n,
633
734
  coordinateType: c,
634
- renderType: l,
635
- relativePosition: E
735
+ renderType: u,
736
+ relativePosition: b
636
737
  };
637
- }), o = await A(a);
638
- return y.handleCoordinateList(o);
738
+ }), a = await L(r);
739
+ return g.handleCoordinateList(a);
639
740
  }
640
741
  /**
641
742
  * 删除坐标系
@@ -645,7 +746,7 @@ class y {
645
746
  */
646
747
  static async removeCoordinate(t, e) {
647
748
  const s = e.map((n) => n.id ?? -1);
648
- return await B(s);
749
+ return await _(s);
649
750
  }
650
751
  /**
651
752
  * 更新坐标系
@@ -654,11 +755,11 @@ class y {
654
755
  * @returns
655
756
  */
656
757
  static async updateCoordinate(t, e) {
657
- const { projectId: s, id: n } = t, a = e.map((h) => {
658
- const { type: c, relativeMap: l, level: u, ...f } = h, d = w.JSONStringify(l);
659
- return { ...f, relativePosition: d, projectId: s, parentId: n };
660
- }), o = await A(a);
661
- return y.handleCoordinateList(o);
758
+ const { projectId: s, id: n } = t, r = e.map((h) => {
759
+ const { type: c, relativeMap: u, level: f, ...l } = h, d = p.toStringify(u);
760
+ return { ...l, relativePosition: d, projectId: s, parentId: n };
761
+ }), a = await L(r);
762
+ return g.handleCoordinateList(a);
662
763
  }
663
764
  /**
664
765
  * 绑定坐标系
@@ -667,11 +768,11 @@ class y {
667
768
  * @returns
668
769
  */
669
770
  static async bindCoordinate(t, e) {
670
- const { projectId: s, id: n } = t, a = e.map((h) => {
771
+ const { projectId: s, id: n } = t, r = e.map((h) => {
671
772
  const { modelId: c } = h;
672
773
  return { modelId: c, parentId: n, projectId: s };
673
- }), o = await G(a);
674
- return y.handleCoordinateList(o);
774
+ }), a = await $(r);
775
+ return g.handleCoordinateList(a);
675
776
  }
676
777
  /**
677
778
  * 处理坐标系数据
@@ -683,14 +784,14 @@ class y {
683
784
  const {
684
785
  coordinateType: s,
685
786
  modelKey: n,
686
- renderType: a,
687
- relativePosition: o,
787
+ renderType: r,
788
+ relativePosition: a,
688
789
  ...h
689
- } = e, c = w.JSONParse(o);
690
- return new Lt({
790
+ } = e, c = p.toParse(a);
791
+ return new jt({
691
792
  ...h,
692
793
  type: s,
693
- modelType: a,
794
+ modelType: r,
694
795
  modelValue: n,
695
796
  relativeMap: c
696
797
  });
@@ -704,19 +805,19 @@ class y {
704
805
  */
705
806
  static buildCoordinateTree(t, e) {
706
807
  const s = /* @__PURE__ */ new Map(), n = [];
707
- return t.forEach((a) => {
708
- s.set(String(a.id), a);
709
- }), t.forEach((a) => {
808
+ return t.forEach((r) => {
809
+ s.set(String(r.id), r);
810
+ }), t.forEach((r) => {
710
811
  var h;
711
- const o = s.get(String(a.id));
712
- if (o)
713
- if (a.parentId === e)
714
- o.level = 0, n.push(o);
812
+ const a = s.get(String(r.id));
813
+ if (a)
814
+ if (r.parentId === e)
815
+ a.level = 0, n.push(a);
715
816
  else {
716
- const c = s.get(String(a.parentId ?? -1));
717
- c && (o.level = (Number(c.level) || 0) + 1, o.parent = c, (h = c.children) == null || h.push(o));
817
+ const c = s.get(String(r.parentId ?? -1));
818
+ c && (a.level = (Number(c.level) || 0) + 1, a.parent = c, (h = c.children) == null || h.push(a));
718
819
  }
719
- }), n.forEach(y.sortCoordinateTree), n[0];
820
+ }), n.forEach(g.sortCoordinateTree), n[0];
720
821
  }
721
822
  /**
722
823
  * 对子节点进行排序,首先按 status=0 升序,然后按 type=0 升序,最后按 createTime 降序
@@ -725,13 +826,13 @@ class y {
725
826
  */
726
827
  static sortCoordinateTree(t) {
727
828
  t.children && (t.children.sort((e, s) => {
728
- var n, a;
729
- if (e.type === x.Space) {
730
- const o = Number((n = s == null ? void 0 : s.relativeMap) == null ? void 0 : n.z) - Number((a = e == null ? void 0 : e.relativeMap) == null ? void 0 : a.z);
731
- return o !== 0 ? o : Number(s.createTime) - Number(e.createTime);
829
+ var n, r;
830
+ if (e.type === M.Space) {
831
+ const a = Number((n = s == null ? void 0 : s.relativeMap) == null ? void 0 : n.z) - Number((r = e == null ? void 0 : e.relativeMap) == null ? void 0 : r.z);
832
+ return a !== 0 ? a : Number(s.createTime) - Number(e.createTime);
732
833
  } else
733
834
  return e.status === 0 && s.status !== 0 ? -1 : s.status === 0 && e.status !== 0 ? 1 : Number(s.createTime) - Number(e.createTime);
734
- }), t.children.forEach(y.sortCoordinateTree));
835
+ }), t.children.forEach(g.sortCoordinateTree));
735
836
  }
736
837
  /**
737
838
  * 过滤空间坐标系树
@@ -740,85 +841,89 @@ class y {
740
841
  static filterSpaceTree(t) {
741
842
  const e = [];
742
843
  return t.forEach((s) => {
743
- const n = y.filterSpaceTree(s.children);
744
- s.children = n, s.disabled = s.disabled ?? !1, s.type !== x.Model && e.push(s);
844
+ const n = g.filterSpaceTree(s.children);
845
+ s.children = n, s.disabled = s.disabled ?? !1, s.type !== M.Model && e.push(s);
745
846
  }), e;
746
847
  }
747
848
  }
748
- class Lt {
849
+ class jt {
749
850
  constructor(t) {
750
- r(this, "id", 0);
851
+ o(this, "id", 0);
751
852
  //id
752
- r(this, "type", 0);
853
+ o(this, "type", 0);
753
854
  //0空间,1模型
754
- r(this, "children", []);
855
+ o(this, "children", []);
755
856
  //子节点
756
- r(this, "level");
857
+ o(this, "level");
757
858
  //空间的层级
758
- r(this, "relativeMap");
859
+ o(this, "relativeMap");
759
860
  //相对位置关系
760
- r(this, "no");
861
+ o(this, "no");
761
862
  //坐标系编号
762
- r(this, "name");
863
+ o(this, "name");
763
864
  //名称
764
- r(this, "shortName");
865
+ o(this, "shortName");
765
866
  //简称
766
- r(this, "status");
867
+ o(this, "status");
767
868
  //使用状态
768
- r(this, "modelId");
869
+ o(this, "modelId");
769
870
  // 模型ID
770
- r(this, "modelType");
871
+ o(this, "modelType");
771
872
  //模型的类型
772
- r(this, "modelValue");
873
+ o(this, "modelValue");
773
874
  // 模型value
774
- r(this, "projectId");
875
+ o(this, "projectId");
775
876
  //项目id
776
- r(this, "parentId");
877
+ o(this, "parentId");
777
878
  //父节点id
778
- r(this, "parent");
879
+ o(this, "parent");
779
880
  //父节点
780
- r(this, "groupUuid");
881
+ o(this, "groupUuid");
781
882
  //分组uuid
782
- r(this, "z");
883
+ o(this, "z");
783
884
  //坐标系高度
784
- r(this, "createTime");
885
+ o(this, "createTime");
785
886
  // 创建时间
786
- r(this, "disabled");
787
- const { relativeMap: e, parent: s, children: n, ...a } = t || {};
788
- e && (this.relativeMap = new w(e)), s && (this.parent = s), n != null && n.length && (this.children = n), Object.assign(this, a);
887
+ o(this, "disabled");
888
+ this.setOptions(t);
789
889
  }
790
890
  get spaceList() {
791
- return this.children.filter((t) => t.type === x.Space);
891
+ return this.children.filter((t) => t.type === M.Space);
792
892
  }
793
893
  get modelList() {
794
- return this.children.filter((t) => t.type === x.Model);
894
+ return this.children.filter((t) => t.type === M.Model);
795
895
  }
796
896
  get fullName() {
797
897
  const t = this.name ? `(${this.name})` : "";
798
898
  return this.shortName ? `${this.shortName}${t}` : this.name ?? "";
799
899
  }
900
+ //设置参数
901
+ setOptions(t) {
902
+ const { relativeMap: e, parent: s, children: n, ...r } = t || {};
903
+ e && (this.relativeMap = new p(e)), s && (this.parent = s), n != null && n.length && (this.children = n), Object.assign(this, r);
904
+ }
800
905
  //添加子节点
801
906
  async addChild(t) {
802
- const e = S(t) ? t : [t], s = await y.addCoordinate(this, e);
907
+ const e = P(t) ? t : [t], s = await g.addCoordinate(this, e);
803
908
  this.mergeChild(s);
804
909
  }
805
910
  //删除子节点
806
911
  async removeChild(t) {
807
- const e = S(t) ? t : [t];
808
- await y.removeCoordinate(this, e);
912
+ const e = P(t) ? t : [t];
913
+ await g.removeCoordinate(this, e);
809
914
  for (const s of e) {
810
- const n = this.children.findIndex((a) => a.id === s.id);
915
+ const n = this.children.findIndex((r) => r.id === s.id);
811
916
  n !== -1 && this.children.splice(n, 1);
812
917
  }
813
918
  }
814
919
  //更新子节点
815
920
  async updateChild(t) {
816
- const e = S(t) ? t : [t], s = await y.updateCoordinate(this, e);
921
+ const e = P(t) ? t : [t], s = await g.updateCoordinate(this, e);
817
922
  this.mergeChild(s);
818
923
  }
819
924
  //绑定子节点,不建立映射关系
820
925
  async bindChild(t) {
821
- const e = S(t) ? t : [t], s = await y.bindCoordinate(this, e);
926
+ const e = P(t) ? t : [t], s = await g.bindCoordinate(this, e);
822
927
  this.mergeChild(s);
823
928
  }
824
929
  // 合并子节点,没有查询到节点就插入
@@ -826,26 +931,26 @@ class Lt {
826
931
  t != null && t.length && t.forEach((e) => {
827
932
  const s = this.children.find((n) => n.id === e.id);
828
933
  if (s) {
829
- const { relativeMap: n, no: a, name: o, shortName: h, status: c, modelId: l, modelValue: u } = e;
934
+ const { relativeMap: n, no: r, name: a, shortName: h, status: c, modelId: u, modelValue: f } = e;
830
935
  Object.assign(s, {
831
936
  relativeMap: n,
832
- no: a,
833
- name: o,
937
+ no: r,
938
+ name: a,
834
939
  shortName: h,
835
940
  status: c,
836
- modelId: l,
837
- modelValue: u
941
+ modelId: u,
942
+ modelValue: f
838
943
  });
839
944
  } else this.id === e.parentId && (e.parent = this, this.children.unshift(e));
840
945
  });
841
946
  }
842
947
  //映射到(模型映射到空间,空间映射到空间)
843
948
  async mappingTo(t) {
844
- await U(t);
949
+ await Z(t);
845
950
  }
846
951
  // 来自映射(被映射过的源坐标系关系)
847
952
  async fromMapping() {
848
- const t = await $({ srcCsId: this.id });
953
+ const t = await q({ srcCsId: this.id });
849
954
  return t[t.length - 1];
850
955
  }
851
956
  /**
@@ -864,13 +969,13 @@ class Lt {
864
969
  * @param mapped 是否被映射
865
970
  * @returns
866
971
  */
867
- findChildModel(t = [P.CADModel, P.SkyMapModel], e = !0) {
972
+ findChildModel(t = [N.CADModel, N.SkyMapModel], e = !0) {
868
973
  var h, c;
869
- const s = S(t) ? t : [t];
870
- if (s.includes(this.modelType ?? -1) && this.status !== L.Disabled)
974
+ const s = P(t) ? t : [t];
975
+ if (s.includes(this.modelType ?? -1) && this.status !== O.Disabled)
871
976
  return this;
872
- const a = [x.Data, x.Model].includes(this.type) ? this.findParentSpace() : this, o = (c = (h = a == null ? void 0 : a.modelList) == null ? void 0 : h.filter((l) => s.includes(l.modelType ?? -1) ? e ? !!l.relativeMap : !0 : !1)) == null ? void 0 : c.sort((l, u) => Number(l.status) - Number(u.status));
873
- return o == null ? void 0 : o[0];
977
+ const r = [M.Data, M.Model].includes(this.type) ? this.findParentSpace() : this, a = (c = (h = r == null ? void 0 : r.modelList) == null ? void 0 : h.filter((u) => s.includes(u.modelType ?? -1) ? e ? !!u.relativeMap : !0 : !1)) == null ? void 0 : c.sort((u, f) => Number(u.status) - Number(f.status));
978
+ return a == null ? void 0 : a[0];
874
979
  }
875
980
  /**
876
981
  * 寻找与当前节点最近的一个模型节点,从当前节点遍历到根节点-广度优先遍历
@@ -878,35 +983,35 @@ class Lt {
878
983
  * @param excludeNodes //排除的坐标系
879
984
  * @returns
880
985
  */
881
- findLatestModel(t = P.CADModel, e) {
882
- var l;
986
+ findClosestModel(t = N.CADModel, e) {
987
+ var u;
883
988
  const s = /* @__PURE__ */ new Set();
884
- for (const u of e ?? [])
885
- s.add(String(u.id));
886
- const n = [{ node: this, distance: 0 }], a = S(t) ? t : [t], o = /* @__PURE__ */ new Set();
989
+ for (const f of e ?? [])
990
+ s.add(String(f.id));
991
+ const n = [{ node: this, distance: 0 }], r = P(t) ? t : [t], a = /* @__PURE__ */ new Set();
887
992
  let h, c = 1 / 0;
888
993
  for (; n.length > 0; ) {
889
- const u = n.shift();
890
- if (!u) break;
891
- const { node: f, distance: d } = u;
892
- if (s.has(String(f.id)))
994
+ const f = n.shift();
995
+ if (!f) break;
996
+ const { node: l, distance: d } = f;
997
+ if (s.has(String(l.id)))
893
998
  continue;
894
- if (a.includes(f.modelType ?? -1)) {
895
- if (d < c && (h = f, c = d, d <= 1))
999
+ if (r.includes(l.modelType ?? -1)) {
1000
+ if (d < c && (h = l, c = d, d <= 1))
896
1001
  break;
897
1002
  continue;
898
1003
  }
899
- o.add(f);
900
- const E = [];
901
- if ((l = f.parent) != null && l.children)
902
- for (const T of f.parent.children)
903
- T !== f && !o.has(T) && E.push(T);
904
- if (f.children)
905
- for (const T of f.children)
906
- o.has(T) || E.push(T);
907
- f.parent && !o.has(f.parent) && E.push(f.parent);
908
- for (const T of E)
909
- n.push({ node: T, distance: d + 1 });
1004
+ a.add(l);
1005
+ const b = [];
1006
+ if ((u = l.parent) != null && u.children)
1007
+ for (const S of l.parent.children)
1008
+ S !== l && !a.has(S) && b.push(S);
1009
+ if (l.children)
1010
+ for (const S of l.children)
1011
+ a.has(S) || b.push(S);
1012
+ l.parent && !a.has(l.parent) && b.push(l.parent);
1013
+ for (const S of b)
1014
+ n.push({ node: S, distance: d + 1 });
910
1015
  }
911
1016
  return h;
912
1017
  }
@@ -916,7 +1021,7 @@ class Lt {
916
1021
  */
917
1022
  findParentSpace() {
918
1023
  let t = this;
919
- for (; t && t.type !== x.Space; )
1024
+ for (; t && t.type !== M.Space; )
920
1025
  t = t.parent;
921
1026
  return t;
922
1027
  }
@@ -929,7 +1034,7 @@ class Lt {
929
1034
  const e = [];
930
1035
  let s = this;
931
1036
  for (; s && t > 0; )
932
- s.type === x.Space && (e.unshift(s.fullName), t--), s = s.parent;
1037
+ s.type === M.Space && (e.unshift(s.fullName), t--), s = s.parent;
933
1038
  return e;
934
1039
  }
935
1040
  // 寻找坐标系组, 有groupUuid表示坐标系组
@@ -985,10 +1090,10 @@ class Lt {
985
1090
  */
986
1091
  getMappedCsTree() {
987
1092
  function t(n) {
988
- var a;
989
- return (a = n.children) != null && a.length && (n.children = n.children.filter((o) => !!(o != null && o.relativeMap) && o.status !== L.Disabled).map((o) => t(o))), n;
1093
+ var r;
1094
+ return (r = n.children) != null && r.length && (n.children = n.children.filter((a) => !!(a != null && a.relativeMap) && a.status !== O.Disabled).map((a) => t(a))), n;
990
1095
  }
991
- const e = q(this.findRoot(!0)), s = t(e);
1096
+ const e = W(this.findRoot(!0)), s = t(e);
992
1097
  return s.parentId = 0, s.parent = void 0, s;
993
1098
  }
994
1099
  /**
@@ -997,15 +1102,15 @@ class Lt {
997
1102
  * @returns
998
1103
  */
999
1104
  getDestRelativeMap(t) {
1000
- var a;
1105
+ var r;
1001
1106
  if (this.id === t.id)
1002
- return new w();
1107
+ return new p();
1003
1108
  const e = this.getRelativeMaps(), s = t.getRelativeMaps();
1004
- let n = new w();
1005
- return e == null || e.forEach((o) => {
1006
- n = w.addRelativeMap(n, o);
1007
- }), (a = s == null ? void 0 : s.reverse()) == null || a.forEach((o) => {
1008
- n = w.addRelativeMap(n, w.inverseRelativeMap(o));
1109
+ let n = new p();
1110
+ return e == null || e.forEach((a) => {
1111
+ n = p.addRelativeMap(n, a);
1112
+ }), (r = s == null ? void 0 : s.reverse()) == null || r.forEach((a) => {
1113
+ n = p.addRelativeMap(n, p.inverseRelativeMap(a));
1009
1114
  }), n;
1010
1115
  }
1011
1116
  /**
@@ -1019,93 +1124,162 @@ class Lt {
1019
1124
  e.push(t.relativeMap), t = t.parent;
1020
1125
  return e;
1021
1126
  }
1127
+ /**
1128
+ * 过滤树对象,排除指定条件的节点
1129
+ * @param tree 要过滤的树对象
1130
+ * @param excludeIds 要排除的ID数组 (可选)
1131
+ * @param excludeTypes 要排除的模型Type数组 (可选)
1132
+ * @returns
1133
+ */
1134
+ static filterCoordinateTree(t, e = [], s = []) {
1135
+ var r;
1136
+ if (s.includes(t.id) || e.includes(t.type))
1137
+ return;
1138
+ const n = (r = t.children) == null ? void 0 : r.map((a) => this.filterCoordinateTree(a, e, s)).filter((a) => a !== void 0);
1139
+ return { ...t, children: n };
1140
+ }
1141
+ /**
1142
+ * 获取共同的空间坐标系
1143
+ * @param coordinateList 空间或模型坐标系集合
1144
+ * @returns
1145
+ */
1146
+ static getCommonCoordinate(t) {
1147
+ let e;
1148
+ const s = t.map((n) => n.getCsRoutes(!0).filter((a) => a.id && a.type === M.Space));
1149
+ for (; this.checkSameCoordinate(s); ) {
1150
+ const r = s.shift();
1151
+ r != null && r.length && (e = r[0]);
1152
+ }
1153
+ return e;
1154
+ }
1155
+ /**
1156
+ * 检查并列第一行是否相同,否则就返回
1157
+ * @param coordinateList 二维坐标系集合
1158
+ * @returns
1159
+ */
1160
+ static checkSameCoordinate(t) {
1161
+ if (t.length) {
1162
+ if (t.length === 1)
1163
+ return !0;
1164
+ for (let e = 0; e < t.length - 1; e++) {
1165
+ const s = t[e];
1166
+ if (!(s != null && s.length))
1167
+ return !1;
1168
+ const n = t[e + 1];
1169
+ if (!(n != null && n.length) || s[0].id !== n[0].id)
1170
+ return !1;
1171
+ }
1172
+ return !0;
1173
+ } else return !1;
1174
+ }
1022
1175
  }
1023
- class H {
1176
+ class K {
1024
1177
  //横滚角
1025
1178
  constructor(t) {
1026
- r(this, "yaw", 0);
1179
+ o(this, "yaw", 0);
1027
1180
  //偏航角
1028
- r(this, "pitch", 0);
1181
+ o(this, "pitch", 0);
1029
1182
  //俯仰角
1030
- r(this, "roll", 0);
1183
+ o(this, "roll", 0);
1031
1184
  const { yaw: e = 0, pitch: s = 0, roll: n = 0 } = t || {};
1032
1185
  this.yaw = Number(e) || 0, this.pitch = Number(s) || 0, this.roll = Number(n) || 0;
1033
1186
  }
1034
- static JSONParse(t) {
1187
+ static toParse(t) {
1035
1188
  if (t) {
1036
1189
  const e = t == null ? void 0 : t.split(",").map((s) => Number(s) || 0);
1037
- return new H({ yaw: e[0], pitch: e[1], roll: e[2] });
1190
+ return new K({ yaw: e[0], pitch: e[1], roll: e[2] });
1038
1191
  }
1039
1192
  }
1040
- static JSONStringify(t) {
1193
+ static toStringify(t) {
1041
1194
  return t ? `${t.yaw},${t.pitch},${t.roll}` : "";
1042
1195
  }
1043
1196
  }
1044
- class Rt {
1197
+ class tt {
1198
+ //z轴
1199
+ constructor(t) {
1200
+ o(this, "x", 0);
1201
+ //x轴
1202
+ o(this, "y", 0);
1203
+ //y轴
1204
+ o(this, "z", 0);
1205
+ const { x: e = 0, y: s = 0, z: n = 0 } = t || {};
1206
+ this.x = Number(e) || 0, this.y = Number(s) || 0, this.z = Number(n) || 0;
1207
+ }
1208
+ static toParse(t) {
1209
+ if (t) {
1210
+ const e = t == null ? void 0 : t.split(",").map((s) => Number(s) || 0);
1211
+ return new tt({ x: e[0], y: e[1], z: e[2] });
1212
+ }
1213
+ }
1214
+ static toStringify(t) {
1215
+ return t ? `${t.x},${t.y},${t.z}` : "";
1216
+ }
1217
+ }
1218
+ class Ft {
1045
1219
  //屏幕位置
1046
1220
  constructor(t) {
1047
- r(this, "canvas");
1048
- r(this, "ctx");
1049
- r(this, "options");
1050
- r(this, "offset", { x: 0, y: 0 });
1221
+ o(this, "canvas");
1222
+ o(this, "ctx");
1223
+ o(this, "options");
1224
+ o(this, "offset", { x: 0, y: 0 });
1051
1225
  // 拖动偏移
1052
- r(this, "curOffset", { x: 0, y: 0 });
1226
+ o(this, "curOffset", { x: 0, y: 0 });
1053
1227
  // 记录上一次的偏移量
1054
- r(this, "mousePosition", { x: -1, y: -1 });
1228
+ o(this, "mousePosition", { x: -1, y: -1 });
1055
1229
  // 记录鼠标坐标位置
1056
1230
  // 缩放
1057
- r(this, "MAX_SCALE", 60);
1058
- r(this, "MIN_SCALE", 1);
1059
- r(this, "STEP_SCALE", 0.5);
1231
+ o(this, "MAX_SCALE", 60);
1232
+ o(this, "MIN_SCALE", 1);
1233
+ o(this, "STEP_SCALE", 0.5);
1060
1234
  // 暂存缩放值
1061
- r(this, "scale", 1);
1062
- r(this, "preScale", 1);
1235
+ o(this, "scale", 1);
1236
+ o(this, "preScale", 1);
1063
1237
  // 画布大小
1064
- r(this, "width", 0);
1065
- r(this, "height", 0);
1066
- r(this, "x", 0);
1238
+ o(this, "width", 0);
1239
+ o(this, "height", 0);
1240
+ o(this, "x", 0);
1067
1241
  // 记录鼠标点击时的横坐标
1068
- r(this, "y", 0);
1242
+ o(this, "y", 0);
1069
1243
  // 记录鼠标点击时的纵坐标
1070
- r(this, "timeout", 0);
1244
+ o(this, "timeout", 0);
1071
1245
  // 单击
1072
1246
  // 移动端相关参数
1073
- r(this, "lastTouch");
1074
- r(this, "initialDistance", 0);
1247
+ o(this, "lastTouch");
1248
+ o(this, "initialDistance", 0);
1075
1249
  //初始距离
1076
- r(this, "touchMode", 0);
1077
- r(this, "isMouseover", !1);
1250
+ o(this, "touchMode", 0);
1251
+ o(this, "isMouseover", !1);
1078
1252
  //鼠标是否在元素上
1079
- r(this, "isBindEvent", !0);
1253
+ o(this, "isBindEvent", !0);
1080
1254
  // 是否绘制辅助线
1081
- r(this, "isDrawAssist", !1);
1255
+ o(this, "isDrawAssist", !1);
1082
1256
  // 是否绑定事件
1083
- r(this, "customDrawAssist");
1257
+ o(this, "customDrawAssist");
1084
1258
  // 绘制辅助线的方法
1085
- r(this, "isMoveRedrawing");
1259
+ o(this, "isMoveRedrawing");
1086
1260
  // 移动过程中是否重绘
1087
- r(this, "afterDraw");
1088
- r(this, "screenPos", { screenX: 0, screenY: 0 });
1261
+ o(this, "afterDraw");
1262
+ o(this, "screenPos", { screenX: 0, screenY: 0 });
1089
1263
  const {
1090
1264
  container: e,
1091
1265
  width: s = 300,
1092
1266
  height: n = 300,
1093
- isBindEvent: a = !0,
1094
- isDrawAssist: o = !1,
1267
+ isBindEvent: r = !0,
1268
+ isDrawAssist: a = !1,
1095
1269
  isMoveRedrawing: h,
1096
1270
  customDrawAssist: c,
1097
- afterDraw: l,
1098
- ...u
1271
+ afterDraw: u,
1272
+ ...f
1099
1273
  } = t;
1100
- this.canvas = e, this.ctx = this.canvas.getContext("2d"), this.width = s, this.height = n, this.canvas.width = s, this.canvas.height = n, this.isBindEvent = a, this.isDrawAssist = o, this.customDrawAssist = c, this.isMoveRedrawing = h ?? o, this.options = u, this.onMousedown = this.onMousedown.bind(this), this.onMousemove = this.onMousemove.bind(this), this.onMousemoveTemp = this.onMousemoveTemp.bind(this), this.onMouseup = this.onMouseup.bind(this), this.onMousewheel = this.onMousewheel.bind(this), this.onDblclick = this.onDblclick.bind(this), this.onTouchstart = this.onTouchstart.bind(this), this.onTouchmove = this.onTouchmove.bind(this), this.onTouchend = this.onTouchend.bind(this), this.onMouseout = this.onMouseout.bind(this), this.afterDraw = this.afterDraw, a && (this.canvas.addEventListener("DOMMouseScroll", this.onMousewheel), this.canvas.addEventListener("mousewheel", this.onMousewheel), this.canvas.addEventListener("mousedown", this.onMousedown), this.canvas.addEventListener("mousemove", this.onMousemove), this.canvas.addEventListener("mouseout", this.onMouseout), this.canvas.addEventListener("dblclick", this.onDblclick), this.canvas.addEventListener("touchstart", this.onTouchstart));
1274
+ this.canvas = e, this.ctx = this.canvas.getContext("2d"), this.width = s, this.height = n, this.canvas.width = s, this.canvas.height = n, this.isBindEvent = r, this.isDrawAssist = a, this.customDrawAssist = c, this.isMoveRedrawing = h ?? a, this.options = f, this.onMousedown = this.onMousedown.bind(this), this.onMousemove = this.onMousemove.bind(this), this.onMousemoveTemp = this.onMousemoveTemp.bind(this), this.onMouseup = this.onMouseup.bind(this), this.onMousewheel = this.onMousewheel.bind(this), this.onDblclick = this.onDblclick.bind(this), this.onTouchstart = this.onTouchstart.bind(this), this.onTouchmove = this.onTouchmove.bind(this), this.onTouchend = this.onTouchend.bind(this), this.onMouseout = this.onMouseout.bind(this), this.afterDraw = this.afterDraw, r && (this.canvas.addEventListener("DOMMouseScroll", this.onMousewheel), this.canvas.addEventListener("mousewheel", this.onMousewheel), this.canvas.addEventListener("mousedown", this.onMousedown), this.canvas.addEventListener("mousemove", this.onMousemove), this.canvas.addEventListener("mouseout", this.onMouseout), this.canvas.addEventListener("dblclick", this.onDblclick), this.canvas.addEventListener("touchstart", this.onTouchstart));
1101
1275
  }
1102
1276
  onClick(t) {
1103
1277
  const { screenX: e, screenY: s } = t;
1104
1278
  this.timeout && clearTimeout(this.timeout);
1105
1279
  const n = this.getPos(t);
1106
1280
  this.x = n.x, this.y = n.y, this.screenPos = { screenX: e, screenY: s }, this.options.onClick && (this.timeout = setTimeout(() => {
1107
- const a = parseFloat(((this.x - this.offset.x) / this.scale).toFixed(2)), o = parseFloat(((this.y - this.offset.y) / this.scale).toFixed(2));
1108
- this.options.onClick(a, o);
1281
+ const r = parseFloat(((this.x - this.offset.x) / this.scale).toFixed(2)), a = parseFloat(((this.y - this.offset.y) / this.scale).toFixed(2));
1282
+ this.options.onClick(r, a);
1109
1283
  }, 200));
1110
1284
  }
1111
1285
  onMouseout(t) {
@@ -1179,8 +1353,8 @@ class Rt {
1179
1353
  }
1180
1354
  // 触摸
1181
1355
  onTouch(t) {
1182
- const e = Date.now(), { lastTouchTime: s = 0, lastTouchX: n = 0, lastTouchY: a = 0 } = this.lastTouch || {};
1183
- e - s < 300 && Math.abs(t.clientX - n) < 30 && Math.abs(t.clientY - a) < 30 ? (this.onDblclick(t), this.lastTouch = {
1356
+ const e = Date.now(), { lastTouchTime: s = 0, lastTouchX: n = 0, lastTouchY: r = 0 } = this.lastTouch || {};
1357
+ e - s < 300 && Math.abs(t.clientX - n) < 30 && Math.abs(t.clientY - r) < 30 ? (this.onDblclick(t), this.lastTouch = {
1184
1358
  lastTouchTime: 0,
1185
1359
  lastTouchX: 0,
1186
1360
  lastTouchY: 0
@@ -1202,11 +1376,11 @@ class Rt {
1202
1376
  width: e = this.width,
1203
1377
  height: s = this.height,
1204
1378
  scale: n = 1,
1205
- preScale: a = 1,
1206
- offset: o = { x: 0, y: 0 },
1379
+ preScale: r = 1,
1380
+ offset: a = { x: 0, y: 0 },
1207
1381
  curOffset: h = { x: 0, y: 0 }
1208
1382
  } = t || {};
1209
- this.width = e, this.height = s, this.canvas.width = e, this.canvas.height = s, this.scale = n, this.preScale = a, this.offset = o, this.curOffset = h;
1383
+ this.width = e, this.height = s, this.canvas.width = e, this.canvas.height = s, this.scale = n, this.preScale = r, this.offset = a, this.curOffset = h;
1210
1384
  }
1211
1385
  // 辅助内容
1212
1386
  drawAssist() {
@@ -1227,22 +1401,22 @@ class Rt {
1227
1401
  this.isBindEvent && (this.canvas.removeEventListener("mousemove", this.onMousemove), this.canvas.removeEventListener("DOMMouseScroll", this.onMousewheel), this.canvas.removeEventListener("mousewheel", this.onMousewheel), this.canvas.removeEventListener("mousedown", this.onMousedown), this.canvas.removeEventListener("mouseout", this.onMouseout), this.canvas.removeEventListener("dblclick", this.onDblclick));
1228
1402
  }
1229
1403
  }
1230
- const j = {};
1231
- class jt {
1404
+ const X = {};
1405
+ class Ut {
1232
1406
  constructor(t) {
1233
- r(this, "type", "image");
1407
+ o(this, "type", "image");
1234
1408
  // 修改为更通用的名称
1235
- r(this, "x");
1236
- r(this, "y");
1237
- r(this, "width");
1238
- r(this, "height");
1239
- r(this, "img");
1240
- r(this, "src");
1241
- r(this, "redraw");
1409
+ o(this, "x");
1410
+ o(this, "y");
1411
+ o(this, "width");
1412
+ o(this, "height");
1413
+ o(this, "img");
1414
+ o(this, "src");
1415
+ o(this, "redraw");
1242
1416
  this.x = t.x || 0, this.y = t.y || 0, this.width = t.width || 0, this.height = t.height || 0, this.src = t.src, this.redraw = t.redraw, this.img = this.loadImage(t.onload);
1243
1417
  }
1244
1418
  loadImage(t) {
1245
- const e = j[this.src];
1419
+ const e = X[this.src];
1246
1420
  if (e)
1247
1421
  return queueMicrotask(() => {
1248
1422
  var s;
@@ -1252,7 +1426,7 @@ class jt {
1252
1426
  const s = new Image();
1253
1427
  return s.crossOrigin = "anonymous", s.src = this.src, s.onload = () => {
1254
1428
  var n;
1255
- j[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
1429
+ X[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
1256
1430
  }, s;
1257
1431
  }
1258
1432
  }
@@ -1265,18 +1439,18 @@ class jt {
1265
1439
  }
1266
1440
  }
1267
1441
  }
1268
- class kt {
1442
+ class Yt {
1269
1443
  constructor(t) {
1270
- r(this, "id", "");
1271
- r(this, "type", "point");
1272
- r(this, "x");
1273
- r(this, "y");
1274
- r(this, "r");
1275
- r(this, "text");
1276
- r(this, "backgroundColor");
1277
- r(this, "index");
1278
- r(this, "pIndex");
1279
- r(this, "parentId");
1444
+ o(this, "id", "");
1445
+ o(this, "type", "point");
1446
+ o(this, "x");
1447
+ o(this, "y");
1448
+ o(this, "r");
1449
+ o(this, "text");
1450
+ o(this, "backgroundColor");
1451
+ o(this, "index");
1452
+ o(this, "pIndex");
1453
+ o(this, "parentId");
1280
1454
  this.id = t.id, this.x = t.x, this.y = t.y, this.r = t.r || 15, this.text = t.text || "", this.index = t.index, this.pIndex = t.pIndex, this.parentId = t.parentId, this.backgroundColor = t.backgroundColor || "rgba(91, 179, 111, 0.8)";
1281
1455
  }
1282
1456
  draw(t, e) {
@@ -1285,28 +1459,28 @@ class kt {
1285
1459
  t.beginPath(), t.arc(this.x, this.y, this.r * s, 0, 2 * Math.PI), t.fillStyle = this.backgroundColor, t.fill(), t.font = `${this.r * s}px Microsoft YaHei`, t.textAlign = "center", t.fillStyle = "#FFFFFF", t.fillText(this.text, this.x, this.y + this.r * s / 3), t.restore();
1286
1460
  }
1287
1461
  }
1288
- const k = {};
1289
- class Ct {
1462
+ const F = {};
1463
+ class Bt {
1290
1464
  constructor(t) {
1291
- r(this, "id", "");
1292
- r(this, "type", "issue");
1465
+ o(this, "id", "");
1466
+ o(this, "type", "issue");
1293
1467
  //轨迹点上的事件
1294
- r(this, "x");
1295
- r(this, "y");
1296
- r(this, "width");
1297
- r(this, "height");
1298
- r(this, "src");
1299
- r(this, "img");
1300
- r(this, "index");
1301
- r(this, "pIndex");
1302
- r(this, "parentId");
1303
- r(this, "count");
1304
- r(this, "badgeR");
1305
- r(this, "redraw");
1468
+ o(this, "x");
1469
+ o(this, "y");
1470
+ o(this, "width");
1471
+ o(this, "height");
1472
+ o(this, "src");
1473
+ o(this, "img");
1474
+ o(this, "index");
1475
+ o(this, "pIndex");
1476
+ o(this, "parentId");
1477
+ o(this, "count");
1478
+ o(this, "badgeR");
1479
+ o(this, "redraw");
1306
1480
  this.id = t.id, this.x = t.x, this.y = t.y, this.width = t.width || 0, this.height = t.height || 0, this.index = t.index, this.pIndex = t.pIndex, this.parentId = t.parentId, this.count = t.count || 0, this.badgeR = 3, this.src = t.src, this.redraw = t.redraw, this.img = this.loadImage(t.onload);
1307
1481
  }
1308
1482
  loadImage(t) {
1309
- const e = k[this.src];
1483
+ const e = F[this.src];
1310
1484
  if (e)
1311
1485
  return queueMicrotask(() => {
1312
1486
  var s;
@@ -1316,34 +1490,34 @@ class Ct {
1316
1490
  const s = new Image();
1317
1491
  return s.src = this.src, s.crossOrigin = "anonymous", s.onload = () => {
1318
1492
  var n;
1319
- k[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
1493
+ F[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
1320
1494
  }, s;
1321
1495
  }
1322
1496
  }
1323
1497
  draw(t, e) {
1324
1498
  if (!this.img.complete) return;
1325
- const s = 1 / e.scale, n = this.width * s, a = this.height * s, o = this.x - n / 2, h = this.y - a, c = this.badgeR * s, l = c * 1.5;
1326
- t.save(), t.drawImage(this.img, o, h, n, a), t.beginPath(), this.count > 1 && (t.arc(this.x + n * 0.3, this.y - a * 0.8, c, 0, 2 * Math.PI), t.fillStyle = "red", t.fill(), t.font = `${l}px Microsoft YaHei`, t.textAlign = "center", t.fillStyle = "#FFFFFF", t.fillText(this.count.toString(), this.x + n * 0.3, this.y - a * 0.8 + c / 2)), t.restore();
1499
+ const s = 1 / e.scale, n = this.width * s, r = this.height * s, a = this.x - n / 2, h = this.y - r, c = this.badgeR * s, u = c * 1.5;
1500
+ t.save(), t.drawImage(this.img, a, h, n, r), t.beginPath(), this.count > 1 && (t.arc(this.x + n * 0.3, this.y - r * 0.8, c, 0, 2 * Math.PI), t.fillStyle = "red", t.fill(), t.font = `${u}px Microsoft YaHei`, t.textAlign = "center", t.fillStyle = "#FFFFFF", t.fillText(this.count.toString(), this.x + n * 0.3, this.y - r * 0.8 + c / 2)), t.restore();
1327
1501
  }
1328
1502
  }
1329
- const C = {};
1330
- class Xt {
1503
+ const U = {};
1504
+ class Gt {
1331
1505
  constructor(t) {
1332
- r(this, "type", "marker");
1333
- r(this, "x");
1334
- r(this, "y");
1335
- r(this, "url");
1336
- r(this, "width");
1337
- r(this, "height");
1338
- r(this, "anchor");
1339
- r(this, "img");
1340
- r(this, "scale");
1341
- r(this, "redraw");
1342
- r(this, "beforeDraw");
1506
+ o(this, "type", "marker");
1507
+ o(this, "x");
1508
+ o(this, "y");
1509
+ o(this, "url");
1510
+ o(this, "width");
1511
+ o(this, "height");
1512
+ o(this, "anchor");
1513
+ o(this, "img");
1514
+ o(this, "scale");
1515
+ o(this, "redraw");
1516
+ o(this, "beforeDraw");
1343
1517
  this.x = t.x, this.y = t.y, this.url = t.url, this.width = t.width ?? 0, this.height = t.height ?? 0, this.anchor = t.anchor, this.scale = t.scale ?? 1, t.redraw && (this.redraw = t.redraw), t.beforeDraw && (this.beforeDraw = t.beforeDraw), this.img = this.loadImage(t.onload);
1344
1518
  }
1345
1519
  loadImage(t) {
1346
- const e = C[this.url];
1520
+ const e = U[this.url];
1347
1521
  if (e)
1348
1522
  return queueMicrotask(() => {
1349
1523
  var s;
@@ -1353,7 +1527,7 @@ class Xt {
1353
1527
  const s = new Image();
1354
1528
  return s.src = this.url, s.crossOrigin = "anonymous", s.onload = () => {
1355
1529
  var n;
1356
- C[this.url] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
1530
+ U[this.url] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
1357
1531
  }, s;
1358
1532
  }
1359
1533
  }
@@ -1366,8 +1540,8 @@ class Xt {
1366
1540
  };
1367
1541
  }
1368
1542
  draw(t, e) {
1369
- var a, o;
1370
- if ((a = this.beforeDraw) == null || a.call(this, t, e), !((o = this.img) != null && o.complete)) return;
1543
+ var r, a;
1544
+ if ((r = this.beforeDraw) == null || r.call(this, t, e), !((a = this.img) != null && a.complete)) return;
1371
1545
  const { iconStartX: s, iconStartY: n } = this.calculateIconPosition();
1372
1546
  t.save();
1373
1547
  try {
@@ -1385,27 +1559,27 @@ class Xt {
1385
1559
  }
1386
1560
  }
1387
1561
  }
1388
- class Ft {
1562
+ class $t {
1389
1563
  constructor(t) {
1390
- r(this, "type", "radar");
1391
- r(this, "x");
1392
- r(this, "y");
1393
- r(this, "r");
1394
- r(this, "angle");
1395
- r(this, "text");
1396
- r(this, "hFov", 90);
1397
- r(this, "beforeDraw");
1564
+ o(this, "type", "radar");
1565
+ o(this, "x");
1566
+ o(this, "y");
1567
+ o(this, "r");
1568
+ o(this, "angle");
1569
+ o(this, "text");
1570
+ o(this, "hFov", 90);
1571
+ o(this, "beforeDraw");
1398
1572
  this.x = t.x, this.y = t.y, this.r = t.r || 15, this.angle = t.angle || 0, this.text = t.text || "", this.hFov = t.fovh || 90, this.beforeDraw = t.beforeDraw;
1399
1573
  }
1400
1574
  draw(t, e) {
1401
1575
  var h;
1402
1576
  (h = this.beforeDraw) == null || h.call(this, t, e);
1403
- const s = 1 / e.scale, [n, a] = [
1577
+ const s = 1 / e.scale, [n, r] = [
1404
1578
  (this.angle - this.hFov / 2) / 180 * Math.PI,
1405
1579
  (this.angle + this.hFov / 2) / 180 * Math.PI
1406
1580
  ];
1407
1581
  t.save();
1408
- const o = t.createRadialGradient(
1582
+ const a = t.createRadialGradient(
1409
1583
  this.x,
1410
1584
  this.y,
1411
1585
  0,
@@ -1413,66 +1587,67 @@ class Ft {
1413
1587
  this.y,
1414
1588
  this.r * s
1415
1589
  );
1416
- o.addColorStop(0, "rgba(180, 42, 42, 1)"), o.addColorStop(1, "rgba(180, 42, 42, 0.5)"), t.beginPath(), t.moveTo(this.x, this.y), t.arc(this.x, this.y, this.r * s, n, a), t.closePath(), t.fillStyle = o, t.fill(), t.restore();
1590
+ a.addColorStop(0, "rgba(180, 42, 42, 1)"), a.addColorStop(1, "rgba(180, 42, 42, 0.5)"), t.beginPath(), t.moveTo(this.x, this.y), t.arc(this.x, this.y, this.r * s, n, r), t.closePath(), t.fillStyle = a, t.fill(), t.restore();
1417
1591
  }
1418
1592
  }
1419
- class Yt {
1593
+ class _t {
1420
1594
  constructor(t) {
1421
- r(this, "type", "region");
1422
- r(this, "x");
1423
- r(this, "y");
1424
- r(this, "shape");
1425
- r(this, "areaPoints");
1426
- r(this, "backgroundColor");
1595
+ o(this, "type", "region");
1596
+ o(this, "x");
1597
+ o(this, "y");
1598
+ o(this, "shape");
1599
+ o(this, "areaPoints");
1600
+ o(this, "backgroundColor");
1427
1601
  if (this.x = t.x, this.y = t.y, this.shape = t.shape || "", this.backgroundColor = t.backgroundColor, t.areaPoints.length === 2) {
1428
- const [{ x: e, y: s }, {}, { x: n, y: a }] = t.areaPoints;
1602
+ const [{ x: e, y: s }, {}, { x: n, y: r }] = t.areaPoints;
1429
1603
  this.areaPoints = [
1430
- { x: Math.min(e, n), y: Math.min(s, a) },
1431
- { x: Math.max(e, n), y: Math.min(s, a) },
1432
- { x: Math.max(e, n), y: Math.max(s, a) },
1433
- { x: Math.min(e, n), y: Math.max(s, a) }
1604
+ { x: Math.min(e, n), y: Math.min(s, r) },
1605
+ { x: Math.max(e, n), y: Math.min(s, r) },
1606
+ { x: Math.max(e, n), y: Math.max(s, r) },
1607
+ { x: Math.min(e, n), y: Math.max(s, r) }
1434
1608
  ];
1435
1609
  } else
1436
1610
  this.areaPoints = t.areaPoints;
1437
1611
  }
1438
1612
  draw(t, e) {
1439
1613
  if (t.save(), t.beginPath(), t.globalAlpha = 0.3, t.fillStyle = this.backgroundColor, this.shape === "circle") {
1440
- const [{ x: s, y: n }, {}, { x: a, y: o }] = this.areaPoints, h = Math.abs(a - s) / 2, c = s + (a - s) / 2, l = n + (o - n) / 2;
1441
- t.arc(c, l, h, 0, 2 * Math.PI);
1614
+ const [{ x: s, y: n }, {}, { x: r, y: a }] = this.areaPoints, h = Math.abs(r - s) / 2, c = s + (r - s) / 2, u = n + (a - n) / 2;
1615
+ t.arc(c, u, h, 0, 2 * Math.PI);
1442
1616
  } else
1443
1617
  this.areaPoints.forEach((s, n) => {
1444
- const { x: a, y: o } = s;
1445
- n === 0 ? t.moveTo(a, o) : t.lineTo(a, o);
1618
+ const { x: r, y: a } = s;
1619
+ n === 0 ? t.moveTo(r, a) : t.lineTo(r, a);
1446
1620
  });
1447
1621
  t.fill(), t.restore();
1448
1622
  }
1449
1623
  }
1450
1624
  export {
1451
- et as APP_SETTING,
1452
- p as AppError,
1453
- M as AppErrorCode,
1454
- tt as AppObsType,
1455
- Rt as CanvasElement,
1456
- jt as CanvasImageElement,
1457
- Ct as CanvasIssueElement,
1458
- Xt as CanvasMarkerElement,
1459
- kt as CanvasPointElement,
1460
- Ft as CanvasRadarElement,
1461
- Yt as CanvasRegionElement,
1462
- Lt as Coordinate,
1463
- K as CoordinateLevel,
1464
- P as CoordinateModelType,
1465
- L as CoordinateStatus,
1466
- x as CoordinateType,
1467
- y as DataSource,
1468
- I as GeoPoint,
1625
+ rt as APP_SETTING,
1626
+ y as AppError,
1627
+ w as AppErrorCode,
1628
+ nt as AppObsType,
1629
+ Ft as CanvasElement,
1630
+ Ut as CanvasImageElement,
1631
+ Bt as CanvasIssueElement,
1632
+ Gt as CanvasMarkerElement,
1633
+ Yt as CanvasPointElement,
1634
+ $t as CanvasRadarElement,
1635
+ _t as CanvasRegionElement,
1636
+ jt as Coordinate,
1637
+ it as CoordinateLevel,
1638
+ N as CoordinateModelType,
1639
+ O as CoordinateStatus,
1640
+ M as CoordinateType,
1641
+ g as DataSource,
1642
+ D as GeoPoint,
1469
1643
  m as Point,
1470
- H as Position,
1471
- w as RelativeMap,
1472
- D as RequestContentType,
1473
- g as RequestMethod,
1474
- X as RequestResultCode,
1475
- _t as api,
1476
- At as http,
1477
- zt as utils
1644
+ K as Position,
1645
+ p as RelativeMap,
1646
+ R as RequestContentType,
1647
+ x as RequestMethod,
1648
+ Y as RequestResultCode,
1649
+ tt as Vector3,
1650
+ At as api,
1651
+ Ct as http,
1652
+ Xt as utils
1478
1653
  };