@vsleem-realsee-viewer/shared 1.1.4 → 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/README.md +2 -2
- package/dist/index.d.ts +85 -13
- package/dist/index.mjs +310 -227
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
var et = Object.defineProperty;
|
|
2
2
|
var st = (i, t, e) => t in i ? et(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
3
|
var o = (i, t, e) => st(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
|
|
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 || {});
|
|
5
19
|
const rt = {
|
|
6
20
|
baseUrl: "https://vsleem.com/api",
|
|
7
21
|
obsType: "hs"
|
|
@@ -11,13 +25,13 @@ const rt = {
|
|
|
11
25
|
withAuthorize: !0
|
|
12
26
|
}, at = {
|
|
13
27
|
url: "",
|
|
14
|
-
method:
|
|
28
|
+
method: x.GET,
|
|
15
29
|
headers: {}
|
|
16
|
-
},
|
|
30
|
+
}, B = { ...rt };
|
|
17
31
|
function ht(i) {
|
|
18
|
-
Object.assign(
|
|
32
|
+
Object.assign(B, i);
|
|
19
33
|
}
|
|
20
|
-
async function
|
|
34
|
+
async function T(i, t) {
|
|
21
35
|
const e = { ...ot, ...t }, s = { ...at, ...i };
|
|
22
36
|
try {
|
|
23
37
|
const n = ct(s, e), { url: r, ...a } = n, c = await (await window.fetch(r, a)).json();
|
|
@@ -27,16 +41,16 @@ async function E(i, t) {
|
|
|
27
41
|
}
|
|
28
42
|
}
|
|
29
43
|
function ct(i, t) {
|
|
30
|
-
const { baseUrl: e, authorizeCode: s } =
|
|
44
|
+
const { baseUrl: e, authorizeCode: s } = B, { joinBaseUrl: n, withAuthorize: r } = t;
|
|
31
45
|
let { url: a, method: h, headers: c = {}, params: u, data: f } = i;
|
|
32
46
|
n && e && (a = `${e}${a}`), h = h == null ? void 0 : h.toUpperCase();
|
|
33
47
|
const l = { ...c };
|
|
34
|
-
if (e && (l.PlatForm = new URL(e).hostname), r && s && (l.AuthorizationCode = s), h ===
|
|
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) {
|
|
35
49
|
const b = new URLSearchParams(u);
|
|
36
50
|
a += `?${b.toString()}`;
|
|
37
51
|
}
|
|
38
52
|
let d;
|
|
39
|
-
return h ===
|
|
53
|
+
return h === x.POST && (d = l["Content-Type"] === R.JSON ? JSON.stringify(f || {}) : f), {
|
|
40
54
|
url: a,
|
|
41
55
|
method: h,
|
|
42
56
|
headers: l,
|
|
@@ -47,75 +61,78 @@ function lt(i, t) {
|
|
|
47
61
|
if (!t.isTransformResponse)
|
|
48
62
|
return i;
|
|
49
63
|
if (!i)
|
|
50
|
-
throw new
|
|
64
|
+
throw new y(w.RequestResultError, "请求返回的结果错误");
|
|
51
65
|
const { code: e, data: s, msg: n } = i;
|
|
52
66
|
if (e === Y.SUCCESS)
|
|
53
67
|
return s;
|
|
54
|
-
throw new
|
|
68
|
+
throw new y(w.RequestCodeError, n || "请求返回的Code错误");
|
|
55
69
|
}
|
|
56
70
|
function ut(i) {
|
|
57
|
-
throw i instanceof Error ? i : new
|
|
71
|
+
throw i instanceof Error ? i : new y(
|
|
72
|
+
w.RequestUnknownError,
|
|
73
|
+
typeof i == "string" ? i : "未知的请求错误"
|
|
74
|
+
);
|
|
58
75
|
}
|
|
59
|
-
const
|
|
76
|
+
const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
60
77
|
__proto__: null,
|
|
61
|
-
request:
|
|
78
|
+
request: T,
|
|
62
79
|
setRequestGlobalConfig: ht
|
|
63
80
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
64
|
-
function
|
|
65
|
-
return
|
|
81
|
+
function G(i, t) {
|
|
82
|
+
return T(
|
|
66
83
|
{
|
|
67
84
|
url: "/project/jssdk/cs/list",
|
|
68
|
-
method:
|
|
85
|
+
method: x.GET,
|
|
69
86
|
params: i
|
|
70
87
|
},
|
|
71
88
|
t
|
|
72
89
|
);
|
|
73
90
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
91
|
+
function $(i, t) {
|
|
92
|
+
return T(
|
|
76
93
|
{
|
|
77
94
|
url: "/project/jssdk/cs/bind",
|
|
78
|
-
method:
|
|
95
|
+
method: x.POST,
|
|
79
96
|
data: i
|
|
80
97
|
},
|
|
81
98
|
t
|
|
82
99
|
);
|
|
83
100
|
}
|
|
84
101
|
function L(i, t) {
|
|
85
|
-
return
|
|
102
|
+
return T(
|
|
86
103
|
{
|
|
87
104
|
url: "/project/jssdk/cs/save",
|
|
88
|
-
method:
|
|
105
|
+
method: x.POST,
|
|
89
106
|
data: i
|
|
90
107
|
},
|
|
91
108
|
t
|
|
92
109
|
);
|
|
93
110
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
111
|
+
function _(i, t) {
|
|
112
|
+
return T(
|
|
96
113
|
{
|
|
97
114
|
url: "/project/jssdk/cs/delete",
|
|
98
|
-
method:
|
|
115
|
+
method: x.POST,
|
|
99
116
|
data: i
|
|
100
117
|
},
|
|
101
118
|
t
|
|
102
119
|
);
|
|
103
120
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
121
|
+
function Z(i, t) {
|
|
122
|
+
return T(
|
|
106
123
|
{
|
|
107
124
|
url: "/project/jssdk/cs/mapping",
|
|
108
|
-
method:
|
|
125
|
+
method: x.POST,
|
|
109
126
|
data: i
|
|
110
127
|
},
|
|
111
128
|
t
|
|
112
129
|
);
|
|
113
130
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
131
|
+
function q(i, t) {
|
|
132
|
+
return T(
|
|
116
133
|
{
|
|
117
134
|
url: "/project/jssdk/cs/mapping/query",
|
|
118
|
-
method:
|
|
135
|
+
method: x.GET,
|
|
119
136
|
params: i
|
|
120
137
|
},
|
|
121
138
|
t
|
|
@@ -126,37 +143,37 @@ function ft(i, t = {
|
|
|
126
143
|
joinBaseUrl: !1,
|
|
127
144
|
withAuthorize: !1
|
|
128
145
|
}) {
|
|
129
|
-
return
|
|
146
|
+
return T(
|
|
130
147
|
{
|
|
131
148
|
url: i,
|
|
132
|
-
method:
|
|
149
|
+
method: x.GET
|
|
133
150
|
},
|
|
134
151
|
t
|
|
135
152
|
);
|
|
136
153
|
}
|
|
137
|
-
const
|
|
154
|
+
const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
138
155
|
__proto__: null,
|
|
139
|
-
bindCoordinate:
|
|
140
|
-
getCoordinateList:
|
|
156
|
+
bindCoordinate: $,
|
|
157
|
+
getCoordinateList: G,
|
|
141
158
|
getImageInfo: ft,
|
|
142
|
-
getMappingRelation:
|
|
143
|
-
mapingCoordinate:
|
|
144
|
-
removeCoordinate:
|
|
159
|
+
getMappingRelation: q,
|
|
160
|
+
mapingCoordinate: Z,
|
|
161
|
+
removeCoordinate: _,
|
|
145
162
|
saveCoordinate: L
|
|
146
163
|
}, Symbol.toStringTag, { value: "Module" })), dt = typeof window < "u", mt = Object.prototype.toString;
|
|
147
164
|
function v(i, t) {
|
|
148
165
|
return mt.call(i) === `[object ${t}]`;
|
|
149
166
|
}
|
|
150
|
-
function
|
|
167
|
+
function J(i) {
|
|
151
168
|
return typeof i < "u";
|
|
152
169
|
}
|
|
153
|
-
function
|
|
154
|
-
return !
|
|
170
|
+
function H(i) {
|
|
171
|
+
return !J(i);
|
|
155
172
|
}
|
|
156
|
-
function
|
|
173
|
+
function A(i) {
|
|
157
174
|
return i !== null && v(i, "Object");
|
|
158
175
|
}
|
|
159
|
-
function
|
|
176
|
+
function V(i) {
|
|
160
177
|
return i === null;
|
|
161
178
|
}
|
|
162
179
|
function yt(i) {
|
|
@@ -165,7 +182,7 @@ function yt(i) {
|
|
|
165
182
|
function wt(i) {
|
|
166
183
|
return v(i, "String");
|
|
167
184
|
}
|
|
168
|
-
function
|
|
185
|
+
function j(i) {
|
|
169
186
|
return typeof i == "function";
|
|
170
187
|
}
|
|
171
188
|
function gt(i) {
|
|
@@ -174,34 +191,34 @@ function gt(i) {
|
|
|
174
191
|
function pt(i) {
|
|
175
192
|
return v(i, "RegExp");
|
|
176
193
|
}
|
|
177
|
-
function
|
|
194
|
+
function P(i) {
|
|
178
195
|
return i && Array.isArray(i);
|
|
179
196
|
}
|
|
180
|
-
function
|
|
197
|
+
function xt(i) {
|
|
181
198
|
return typeof window < "u" && v(i, "Window");
|
|
182
199
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
200
|
+
function Mt(i) {
|
|
201
|
+
return A(i) && !!i.tagName;
|
|
185
202
|
}
|
|
186
203
|
function vt(i) {
|
|
187
204
|
return typeof i == "number" || /^\d+(\.\d+)?$/.test(i);
|
|
188
205
|
}
|
|
189
|
-
function
|
|
206
|
+
function z(i) {
|
|
190
207
|
return v(Number(i), "Number");
|
|
191
208
|
}
|
|
192
209
|
function bt(i, t) {
|
|
193
210
|
return JSON.stringify(i) === JSON.stringify(t);
|
|
194
211
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
212
|
+
function St(i) {
|
|
213
|
+
return H(i) || V(i);
|
|
197
214
|
}
|
|
198
|
-
function
|
|
199
|
-
return v(i, "Promise") &&
|
|
215
|
+
function Tt(i) {
|
|
216
|
+
return v(i, "Promise") && A(i) && j(i.then) && j(i.catch);
|
|
200
217
|
}
|
|
201
218
|
function W(i) {
|
|
202
|
-
return
|
|
219
|
+
return E(i, /* @__PURE__ */ new WeakMap());
|
|
203
220
|
}
|
|
204
|
-
function
|
|
221
|
+
function E(i, t) {
|
|
205
222
|
if (typeof i != "object" || i === null)
|
|
206
223
|
return i;
|
|
207
224
|
if (t.has(i))
|
|
@@ -213,11 +230,11 @@ function N(i, t) {
|
|
|
213
230
|
return e = new RegExp(i), t.set(i, e), e;
|
|
214
231
|
if (i instanceof Map)
|
|
215
232
|
return e = /* @__PURE__ */ new Map(), t.set(i, e), i.forEach((n, r) => {
|
|
216
|
-
e.set(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(
|
|
237
|
+
e.add(E(n, t));
|
|
221
238
|
}), e;
|
|
222
239
|
if (ArrayBuffer.isView(i))
|
|
223
240
|
return e = new i.constructor(
|
|
@@ -230,18 +247,18 @@ 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] =
|
|
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] =
|
|
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] =
|
|
258
|
+
Object.prototype.propertyIsEnumerable.call(i, n) && (e[n] = E(i[n], t));
|
|
242
259
|
return e;
|
|
243
260
|
}
|
|
244
|
-
function
|
|
261
|
+
function Pt(i, t, e = !1) {
|
|
245
262
|
let s;
|
|
246
263
|
const n = function(...r) {
|
|
247
264
|
const a = this, h = e && !s;
|
|
@@ -253,7 +270,7 @@ function St(i, t, e = !1) {
|
|
|
253
270
|
s && clearTimeout(s), s = void 0;
|
|
254
271
|
}, n;
|
|
255
272
|
}
|
|
256
|
-
function
|
|
273
|
+
function Et(i, t, e = !1) {
|
|
257
274
|
let s, n;
|
|
258
275
|
const r = function(...a) {
|
|
259
276
|
const h = this;
|
|
@@ -268,15 +285,15 @@ function Nt(i, t, e = !1) {
|
|
|
268
285
|
clearTimeout(s), s = void 0, n = void 0;
|
|
269
286
|
}, r;
|
|
270
287
|
}
|
|
271
|
-
function
|
|
288
|
+
function k(i, ...t) {
|
|
272
289
|
if (!t.length) return i;
|
|
273
290
|
const e = t.shift();
|
|
274
|
-
return e === void 0 ? i : (
|
|
291
|
+
return e === void 0 ? i : (I(i) && I(e) && Object.keys(e).forEach((s) => {
|
|
275
292
|
const n = i[s], r = e[s];
|
|
276
|
-
Array.isArray(n) && Array.isArray(r) ? i[s] = [...n, ...r] :
|
|
277
|
-
}),
|
|
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));
|
|
278
295
|
}
|
|
279
|
-
function
|
|
296
|
+
function I(i) {
|
|
280
297
|
return i !== null && typeof i == "object" && !Array.isArray(i);
|
|
281
298
|
}
|
|
282
299
|
function Q(i, ...t) {
|
|
@@ -288,10 +305,10 @@ function Q(i, ...t) {
|
|
|
288
305
|
});
|
|
289
306
|
return i;
|
|
290
307
|
}
|
|
291
|
-
function
|
|
308
|
+
function Nt(i, t = {}) {
|
|
292
309
|
return new Promise((e, s) => {
|
|
293
|
-
const n =
|
|
294
|
-
if (
|
|
310
|
+
const n = C(i);
|
|
311
|
+
if (zt(n)) {
|
|
295
312
|
e(!0);
|
|
296
313
|
return;
|
|
297
314
|
}
|
|
@@ -305,11 +322,11 @@ function Pt(i, t = {}) {
|
|
|
305
322
|
}, document.head.appendChild(r);
|
|
306
323
|
});
|
|
307
324
|
}
|
|
308
|
-
function
|
|
309
|
-
const t =
|
|
310
|
-
return Array.from(document.scripts).some((e) =>
|
|
325
|
+
function zt(i) {
|
|
326
|
+
const t = C(i);
|
|
327
|
+
return Array.from(document.scripts).some((e) => C(e.src) === t);
|
|
311
328
|
}
|
|
312
|
-
function
|
|
329
|
+
function C(i) {
|
|
313
330
|
try {
|
|
314
331
|
const t = new URL(i, window.location.href);
|
|
315
332
|
return `${t.origin}${t.pathname}`;
|
|
@@ -317,7 +334,7 @@ function j(i) {
|
|
|
317
334
|
return i;
|
|
318
335
|
}
|
|
319
336
|
}
|
|
320
|
-
function
|
|
337
|
+
function Dt(i, t, e, s) {
|
|
321
338
|
const n = Math.min(i / e, t / s), r = e * n, a = s * n;
|
|
322
339
|
return {
|
|
323
340
|
scale: n,
|
|
@@ -329,166 +346,228 @@ function It(i, t, e, s) {
|
|
|
329
346
|
sh: a
|
|
330
347
|
};
|
|
331
348
|
}
|
|
332
|
-
function
|
|
349
|
+
function It(i, t, e) {
|
|
333
350
|
return {
|
|
334
351
|
x: i * e.scale + e.x,
|
|
335
352
|
// 缩放后加上偏移量
|
|
336
353
|
y: t * e.scale + e.y
|
|
337
354
|
};
|
|
338
355
|
}
|
|
339
|
-
function
|
|
356
|
+
function Ot(i, t, e) {
|
|
340
357
|
return {
|
|
341
358
|
x: (i - e.x) / e.scale,
|
|
342
359
|
// 减去偏移量后缩放到模型尺寸
|
|
343
360
|
y: (t - e.y) / e.scale
|
|
344
361
|
};
|
|
345
362
|
}
|
|
346
|
-
function
|
|
363
|
+
function Rt(i) {
|
|
347
364
|
console.warn(`[warn]:${i}`);
|
|
348
365
|
}
|
|
349
366
|
function Lt(i) {
|
|
350
367
|
throw new Error(`[error]:${i}`);
|
|
351
368
|
}
|
|
352
|
-
const
|
|
369
|
+
const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
353
370
|
__proto__: null,
|
|
354
371
|
cloneDeep: W,
|
|
355
|
-
debounce:
|
|
356
|
-
deepMerge:
|
|
372
|
+
debounce: Pt,
|
|
373
|
+
deepMerge: k,
|
|
357
374
|
deepMergeProps: Q,
|
|
358
375
|
error: Lt,
|
|
359
|
-
getImageTransform:
|
|
376
|
+
getImageTransform: Dt,
|
|
360
377
|
inBrowser: dt,
|
|
361
378
|
is: v,
|
|
362
|
-
isArray:
|
|
379
|
+
isArray: P,
|
|
363
380
|
isBoolean: gt,
|
|
364
381
|
isDate: yt,
|
|
365
|
-
isDef:
|
|
366
|
-
isElement:
|
|
367
|
-
isFunction:
|
|
368
|
-
isNull:
|
|
369
|
-
isNullOrUnDef:
|
|
370
|
-
isNumber:
|
|
382
|
+
isDef: J,
|
|
383
|
+
isElement: Mt,
|
|
384
|
+
isFunction: j,
|
|
385
|
+
isNull: V,
|
|
386
|
+
isNullOrUnDef: St,
|
|
387
|
+
isNumber: z,
|
|
371
388
|
isNumeric: vt,
|
|
372
|
-
isObject:
|
|
373
|
-
isPromise:
|
|
389
|
+
isObject: A,
|
|
390
|
+
isPromise: Tt,
|
|
374
391
|
isRegExp: pt,
|
|
375
392
|
isSameValue: bt,
|
|
376
393
|
isString: wt,
|
|
377
|
-
isUnDef:
|
|
378
|
-
isWindow:
|
|
379
|
-
loadScript:
|
|
380
|
-
throttle:
|
|
381
|
-
toCanvasCoord:
|
|
382
|
-
toModelCoord:
|
|
383
|
-
warn:
|
|
394
|
+
isUnDef: H,
|
|
395
|
+
isWindow: xt,
|
|
396
|
+
loadScript: Nt,
|
|
397
|
+
throttle: Et,
|
|
398
|
+
toCanvasCoord: It,
|
|
399
|
+
toModelCoord: Ot,
|
|
400
|
+
warn: Rt
|
|
384
401
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
385
|
-
class p extends Error {
|
|
386
|
-
constructor(t, e, s) {
|
|
387
|
-
super(e), this.code = t, this.message = e, this.details = s, this.name = "Apprror", Object.setPrototypeOf(this, p.prototype);
|
|
388
|
-
}
|
|
389
|
-
// 可选的:转换成 JSON 格式,方便返回给调用方
|
|
390
|
-
toJSON() {
|
|
391
|
-
return {
|
|
392
|
-
code: this.code,
|
|
393
|
-
message: this.message,
|
|
394
|
-
details: this.details,
|
|
395
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
402
|
class m {
|
|
403
|
+
// 默认平面 ('xy' 或 'xz')
|
|
400
404
|
constructor(t) {
|
|
405
|
+
// 直角坐标系坐标
|
|
401
406
|
o(this, "x", 0);
|
|
402
407
|
o(this, "y", 0);
|
|
403
408
|
o(this, "z", 0);
|
|
409
|
+
// 地理坐标系坐标
|
|
404
410
|
o(this, "lat", 0);
|
|
405
|
-
|
|
411
|
+
// 经度 (longitude)
|
|
406
412
|
o(this, "lon", 0);
|
|
407
|
-
|
|
413
|
+
// 纬度 (latitude)
|
|
408
414
|
o(this, "alt", 0);
|
|
409
|
-
|
|
415
|
+
// 高度 (altitude)
|
|
416
|
+
// 欧拉角
|
|
410
417
|
o(this, "yaw", 0);
|
|
418
|
+
// 偏航角
|
|
411
419
|
o(this, "pitch", 0);
|
|
420
|
+
// 俯仰角
|
|
412
421
|
o(this, "roll", 0);
|
|
422
|
+
// 翻滚角
|
|
423
|
+
// 状态标志
|
|
413
424
|
o(this, "hasXYZ", !1);
|
|
425
|
+
// 是否有直角坐标
|
|
414
426
|
o(this, "hasGeo", !1);
|
|
427
|
+
// 是否有地理坐标
|
|
415
428
|
o(this, "hasAngle", !1);
|
|
429
|
+
// 是否有角度信息
|
|
416
430
|
o(this, "plane", "xy");
|
|
417
431
|
const { x: e, y: s, z: n, lat: r, lon: a, alt: h, yaw: c, pitch: u, roll: f, plane: l = "xy" } = t || {};
|
|
418
|
-
|
|
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);
|
|
419
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* 计算两点之间的三维距离
|
|
436
|
+
* @param p1 点1
|
|
437
|
+
* @param p2 点2
|
|
438
|
+
* @returns 距离值
|
|
439
|
+
*/
|
|
420
440
|
static dist(t, e) {
|
|
421
|
-
return Math.
|
|
441
|
+
return Math.hypot(t.x - e.x, t.y - e.y, t.z - e.z);
|
|
422
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* 计算两点在XZ平面上的距离
|
|
445
|
+
* @param p1 点1
|
|
446
|
+
* @param p2 点2
|
|
447
|
+
* @returns 距离值
|
|
448
|
+
*/
|
|
423
449
|
static distXZ(t, e) {
|
|
424
|
-
return Math.
|
|
450
|
+
return Math.hypot(t.x - e.x, t.z - e.z);
|
|
425
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* 计算两点在XY平面上的距离
|
|
454
|
+
* @param p1 点1
|
|
455
|
+
* @param p2 点2
|
|
456
|
+
* @returns 距离值
|
|
457
|
+
*/
|
|
426
458
|
static distXY(t, e) {
|
|
427
|
-
return Math.
|
|
459
|
+
return Math.hypot(t.x - e.x, t.y - e.y);
|
|
428
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* 角度转弧度
|
|
463
|
+
* @param degrees 角度值
|
|
464
|
+
* @returns 弧度值
|
|
465
|
+
*/
|
|
429
466
|
static toRadians(t) {
|
|
430
467
|
return (Number(t) || 0) * Math.PI / 180;
|
|
431
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* 弧度转角度
|
|
471
|
+
* @param radians 弧度值
|
|
472
|
+
* @returns 角度值
|
|
473
|
+
*/
|
|
432
474
|
static toDegrees(t) {
|
|
433
475
|
return (Number(t) || 0) * 180 / Math.PI;
|
|
434
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* 计算三点在XZ平面上的夹角 (以pb为顶点)
|
|
479
|
+
* @param pa 点A
|
|
480
|
+
* @param pb 点B (顶点)
|
|
481
|
+
* @param pc 点C
|
|
482
|
+
* @returns 夹角角度 (0-180度)
|
|
483
|
+
*/
|
|
435
484
|
static angleXZ(t, e, s) {
|
|
436
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;
|
|
437
486
|
return Math.min(l, 360 - l);
|
|
438
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* 从字符串解析点坐标 ("x,y,z")
|
|
490
|
+
* @param point 坐标字符串
|
|
491
|
+
* @returns Point对象
|
|
492
|
+
*/
|
|
439
493
|
static toParse(t) {
|
|
440
494
|
if (t) {
|
|
441
495
|
const e = t == null ? void 0 : t.split(",").map((s) => Number(s) || 0);
|
|
442
496
|
return new m({ x: e[0], y: e[1], z: e[2] });
|
|
443
497
|
}
|
|
444
498
|
}
|
|
499
|
+
/**
|
|
500
|
+
* 将点坐标序列化为字符串 ("x,y,z")
|
|
501
|
+
* @param point 点对象
|
|
502
|
+
* @returns 坐标字符串
|
|
503
|
+
*/
|
|
445
504
|
static toStringify(t) {
|
|
446
505
|
return t ? `${t.x},${t.y},${t.z}` : "";
|
|
447
506
|
}
|
|
448
507
|
/**
|
|
449
|
-
*
|
|
450
|
-
* @param r
|
|
451
|
-
* @param srcCoordinate
|
|
508
|
+
* 坐标投影转换
|
|
509
|
+
* @param r 映射关系
|
|
510
|
+
* @param srcCoordinate 源坐标系
|
|
452
511
|
* @param dstCoordinate 目标坐标系
|
|
512
|
+
* @returns 转换后的点
|
|
513
|
+
* @throws AppError 当转换失败时抛出异常
|
|
453
514
|
*/
|
|
454
515
|
projection(t, e, s) {
|
|
455
516
|
try {
|
|
456
517
|
if ((e == null ? void 0 : e.id) === (s == null ? void 0 : s.id))
|
|
457
518
|
return new m(this);
|
|
458
|
-
if ((e == null ? void 0 : e.modelType) ===
|
|
519
|
+
if ((e == null ? void 0 : e.modelType) === N.SkyMapModel) {
|
|
459
520
|
const { refPoint: n } = (e == null ? void 0 : e.relativeMap) || {};
|
|
460
521
|
if (this.hasGeo && n) {
|
|
461
|
-
const r =
|
|
522
|
+
const r = D.LLHToXYZ(this, n);
|
|
462
523
|
return this.x = r.x, this.y = r.y, this.z = r.z, this.hasXYZ = !0, this.project(t);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
}
|
|
524
|
+
}
|
|
525
|
+
throw new y(w.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
|
|
526
|
+
}
|
|
527
|
+
if ((s == null ? void 0 : s.modelType) === N.SkyMapModel) {
|
|
466
528
|
const { refPoint: n } = (s == null ? void 0 : s.relativeMap) || {}, r = this.project(t);
|
|
467
529
|
if (r != null && r.hasXYZ && n) {
|
|
468
|
-
const a =
|
|
530
|
+
const a = D.XYZToLLH(r, n);
|
|
469
531
|
return r.lat = a.lat, r.lon = a.lon, r.alt = a.alt, r.hasGeo = !0, r;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
|
|
532
|
+
}
|
|
533
|
+
throw new y(w.PointUnmappedGIS, "没有完成GIS与其他空间的映射");
|
|
534
|
+
}
|
|
535
|
+
return this.project(t);
|
|
474
536
|
} catch {
|
|
537
|
+
return;
|
|
475
538
|
}
|
|
476
539
|
}
|
|
540
|
+
/**
|
|
541
|
+
* 基础投影转换
|
|
542
|
+
* @param r 映射关系
|
|
543
|
+
* @returns 转换后的点
|
|
544
|
+
* @throws AppError 当没有坐标或平面无效时抛出异常
|
|
545
|
+
*/
|
|
477
546
|
project(t) {
|
|
478
|
-
if (this.hasXYZ)
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
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");
|
|
485
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* XZ平面投影转换
|
|
557
|
+
* @param r 映射关系
|
|
558
|
+
* @returns 转换后的点
|
|
559
|
+
*/
|
|
486
560
|
projectXZ(t) {
|
|
487
561
|
const e = new m(this);
|
|
488
562
|
e.x *= t.scale, e.y *= t.scale, e.z *= t.scale, e.yaw !== void 0 && (e.yaw += t.yaw);
|
|
489
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);
|
|
490
564
|
return e.x = s + t.x, e.y += t.y, e.z = n + t.z, e;
|
|
491
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* XY平面投影转换
|
|
568
|
+
* @param r 映射关系
|
|
569
|
+
* @returns 转换后的点
|
|
570
|
+
*/
|
|
492
571
|
projectXY(t) {
|
|
493
572
|
const e = new m(this);
|
|
494
573
|
e.x *= t.scale, e.y *= t.scale, e.z *= t.scale, e.yaw !== void 0 && (e.yaw += t.yaw);
|
|
@@ -496,7 +575,7 @@ class m {
|
|
|
496
575
|
return e.x = s + t.x, e.y = n + t.y, e.z += t.z, e;
|
|
497
576
|
}
|
|
498
577
|
}
|
|
499
|
-
class
|
|
578
|
+
class D {
|
|
500
579
|
//高度
|
|
501
580
|
constructor(t) {
|
|
502
581
|
o(this, "lat", 0);
|
|
@@ -517,8 +596,8 @@ class I {
|
|
|
517
596
|
const l = t.x / 1e3 / (h * Math.cos(a)), d = t.y / 1e3 / h;
|
|
518
597
|
c = e.lon + m.toDegrees(l), u = e.lat - m.toDegrees(d), f = e.alt + t.z / 1e3;
|
|
519
598
|
} else
|
|
520
|
-
throw new
|
|
521
|
-
return new
|
|
599
|
+
throw new y(w.GeoPointNoPlane, "点的plane应为xz或xy");
|
|
600
|
+
return new D({
|
|
522
601
|
lat: u,
|
|
523
602
|
lon: c,
|
|
524
603
|
alt: f
|
|
@@ -540,10 +619,10 @@ class I {
|
|
|
540
619
|
z: (t.alt - e.alt) * 1e3,
|
|
541
620
|
plane: "xy"
|
|
542
621
|
});
|
|
543
|
-
throw new
|
|
622
|
+
throw new y(w.GeoPointNoPlane, "点的plane应为xz或xy");
|
|
544
623
|
}
|
|
545
624
|
}
|
|
546
|
-
class
|
|
625
|
+
class p {
|
|
547
626
|
//参考点
|
|
548
627
|
constructor(t) {
|
|
549
628
|
o(this, "scale", 1);
|
|
@@ -556,7 +635,7 @@ class w {
|
|
|
556
635
|
o(this, "plane", "xy");
|
|
557
636
|
o(this, "refPoint");
|
|
558
637
|
const { refPoint: e, ...s } = t || {};
|
|
559
|
-
e && (this.refPoint = new
|
|
638
|
+
e && (this.refPoint = new D(e)), Object.assign(this, s);
|
|
560
639
|
}
|
|
561
640
|
/**
|
|
562
641
|
* 合并两个相对坐标系的映射关系
|
|
@@ -566,7 +645,7 @@ class w {
|
|
|
566
645
|
*/
|
|
567
646
|
static addRelativeMap(t, e) {
|
|
568
647
|
if (t.plane !== e.plane)
|
|
569
|
-
throw new
|
|
648
|
+
throw new y(w.RelativePlaneUnmatch, "两个映射关系的plane应该相同");
|
|
570
649
|
const s = t.scale * e.scale, n = t.yaw + e.yaw, r = Math.cos(e.yaw), a = Math.sin(e.yaw);
|
|
571
650
|
let h = 0, c = 0, u = 0;
|
|
572
651
|
if (t.plane === "xz") {
|
|
@@ -576,8 +655,8 @@ class w {
|
|
|
576
655
|
const f = t.x * r - t.y * a, l = t.x * a + t.y * r, d = t.z;
|
|
577
656
|
h = e.x + f * e.scale, c = e.y + l * e.scale, u = e.z + d * e.scale;
|
|
578
657
|
} else
|
|
579
|
-
throw new
|
|
580
|
-
return new
|
|
658
|
+
throw new y(w.RelativeNoPlane, "映射关系的plane应为xz或xy");
|
|
659
|
+
return new p({
|
|
581
660
|
scale: s,
|
|
582
661
|
yaw: n,
|
|
583
662
|
x: h,
|
|
@@ -601,8 +680,8 @@ class w {
|
|
|
601
680
|
else if (t.plane === "xy")
|
|
602
681
|
a = -(t.x * n + t.y * r) * e, h = -(t.y * n - t.x * r) * e, c = -t.z * e;
|
|
603
682
|
else
|
|
604
|
-
throw new
|
|
605
|
-
return new
|
|
683
|
+
throw new y(w.RelativeNoPlane, "映射关系的plane应为xz或xy");
|
|
684
|
+
return new p({
|
|
606
685
|
scale: e,
|
|
607
686
|
yaw: s,
|
|
608
687
|
x: a,
|
|
@@ -617,26 +696,26 @@ class w {
|
|
|
617
696
|
try {
|
|
618
697
|
let e = t ? JSON.parse(t) : void 0;
|
|
619
698
|
const { reference_point: s } = e || {};
|
|
620
|
-
return s && (e = { refPoint: s }), e ? new
|
|
699
|
+
return s && (e = { refPoint: s }), e ? new p(e) : void 0;
|
|
621
700
|
} catch {
|
|
622
|
-
throw new
|
|
701
|
+
throw new y(w.RelativeJsonError, "relativeMap格式化失败");
|
|
623
702
|
}
|
|
624
703
|
}
|
|
625
704
|
static toStringify(t) {
|
|
626
705
|
return t ? JSON.stringify(t) : void 0;
|
|
627
706
|
}
|
|
628
707
|
}
|
|
629
|
-
class
|
|
708
|
+
class g {
|
|
630
709
|
/**
|
|
631
710
|
* 获取坐标系树
|
|
632
711
|
* @param projectId 项目id
|
|
633
712
|
* @returns
|
|
634
713
|
*/
|
|
635
714
|
static async getCoordinateTree(t) {
|
|
636
|
-
const e = await
|
|
715
|
+
const e = await G({ projectId: t });
|
|
637
716
|
if (e.length) {
|
|
638
|
-
const s =
|
|
639
|
-
return
|
|
717
|
+
const s = g.handleCoordinateList(e);
|
|
718
|
+
return g.buildCoordinateTree(s, 0);
|
|
640
719
|
}
|
|
641
720
|
}
|
|
642
721
|
/**
|
|
@@ -657,7 +736,7 @@ class y {
|
|
|
657
736
|
relativePosition: b
|
|
658
737
|
};
|
|
659
738
|
}), a = await L(r);
|
|
660
|
-
return
|
|
739
|
+
return g.handleCoordinateList(a);
|
|
661
740
|
}
|
|
662
741
|
/**
|
|
663
742
|
* 删除坐标系
|
|
@@ -667,7 +746,7 @@ class y {
|
|
|
667
746
|
*/
|
|
668
747
|
static async removeCoordinate(t, e) {
|
|
669
748
|
const s = e.map((n) => n.id ?? -1);
|
|
670
|
-
return await
|
|
749
|
+
return await _(s);
|
|
671
750
|
}
|
|
672
751
|
/**
|
|
673
752
|
* 更新坐标系
|
|
@@ -677,10 +756,10 @@ class y {
|
|
|
677
756
|
*/
|
|
678
757
|
static async updateCoordinate(t, e) {
|
|
679
758
|
const { projectId: s, id: n } = t, r = e.map((h) => {
|
|
680
|
-
const { type: c, relativeMap: u, level: f, ...l } = h, d =
|
|
759
|
+
const { type: c, relativeMap: u, level: f, ...l } = h, d = p.toStringify(u);
|
|
681
760
|
return { ...l, relativePosition: d, projectId: s, parentId: n };
|
|
682
761
|
}), a = await L(r);
|
|
683
|
-
return
|
|
762
|
+
return g.handleCoordinateList(a);
|
|
684
763
|
}
|
|
685
764
|
/**
|
|
686
765
|
* 绑定坐标系
|
|
@@ -692,8 +771,8 @@ class y {
|
|
|
692
771
|
const { projectId: s, id: n } = t, r = e.map((h) => {
|
|
693
772
|
const { modelId: c } = h;
|
|
694
773
|
return { modelId: c, parentId: n, projectId: s };
|
|
695
|
-
}), a = await
|
|
696
|
-
return
|
|
774
|
+
}), a = await $(r);
|
|
775
|
+
return g.handleCoordinateList(a);
|
|
697
776
|
}
|
|
698
777
|
/**
|
|
699
778
|
* 处理坐标系数据
|
|
@@ -708,8 +787,8 @@ class y {
|
|
|
708
787
|
renderType: r,
|
|
709
788
|
relativePosition: a,
|
|
710
789
|
...h
|
|
711
|
-
} = e, c =
|
|
712
|
-
return new
|
|
790
|
+
} = e, c = p.toParse(a);
|
|
791
|
+
return new jt({
|
|
713
792
|
...h,
|
|
714
793
|
type: s,
|
|
715
794
|
modelType: r,
|
|
@@ -738,7 +817,7 @@ class y {
|
|
|
738
817
|
const c = s.get(String(r.parentId ?? -1));
|
|
739
818
|
c && (a.level = (Number(c.level) || 0) + 1, a.parent = c, (h = c.children) == null || h.push(a));
|
|
740
819
|
}
|
|
741
|
-
}), n.forEach(
|
|
820
|
+
}), n.forEach(g.sortCoordinateTree), n[0];
|
|
742
821
|
}
|
|
743
822
|
/**
|
|
744
823
|
* 对子节点进行排序,首先按 status=0 升序,然后按 type=0 升序,最后按 createTime 降序
|
|
@@ -753,7 +832,7 @@ class y {
|
|
|
753
832
|
return a !== 0 ? a : Number(s.createTime) - Number(e.createTime);
|
|
754
833
|
} else
|
|
755
834
|
return e.status === 0 && s.status !== 0 ? -1 : s.status === 0 && e.status !== 0 ? 1 : Number(s.createTime) - Number(e.createTime);
|
|
756
|
-
}), t.children.forEach(
|
|
835
|
+
}), t.children.forEach(g.sortCoordinateTree));
|
|
757
836
|
}
|
|
758
837
|
/**
|
|
759
838
|
* 过滤空间坐标系树
|
|
@@ -762,12 +841,12 @@ class y {
|
|
|
762
841
|
static filterSpaceTree(t) {
|
|
763
842
|
const e = [];
|
|
764
843
|
return t.forEach((s) => {
|
|
765
|
-
const n =
|
|
844
|
+
const n = g.filterSpaceTree(s.children);
|
|
766
845
|
s.children = n, s.disabled = s.disabled ?? !1, s.type !== M.Model && e.push(s);
|
|
767
846
|
}), e;
|
|
768
847
|
}
|
|
769
848
|
}
|
|
770
|
-
class
|
|
849
|
+
class jt {
|
|
771
850
|
constructor(t) {
|
|
772
851
|
o(this, "id", 0);
|
|
773
852
|
//id
|
|
@@ -806,8 +885,7 @@ class _t {
|
|
|
806
885
|
o(this, "createTime");
|
|
807
886
|
// 创建时间
|
|
808
887
|
o(this, "disabled");
|
|
809
|
-
|
|
810
|
-
e && (this.relativeMap = new w(e)), s && (this.parent = s), n != null && n.length && (this.children = n), Object.assign(this, r);
|
|
888
|
+
this.setOptions(t);
|
|
811
889
|
}
|
|
812
890
|
get spaceList() {
|
|
813
891
|
return this.children.filter((t) => t.type === M.Space);
|
|
@@ -819,15 +897,20 @@ class _t {
|
|
|
819
897
|
const t = this.name ? `(${this.name})` : "";
|
|
820
898
|
return this.shortName ? `${this.shortName}${t}` : this.name ?? "";
|
|
821
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
|
+
}
|
|
822
905
|
//添加子节点
|
|
823
906
|
async addChild(t) {
|
|
824
|
-
const e =
|
|
907
|
+
const e = P(t) ? t : [t], s = await g.addCoordinate(this, e);
|
|
825
908
|
this.mergeChild(s);
|
|
826
909
|
}
|
|
827
910
|
//删除子节点
|
|
828
911
|
async removeChild(t) {
|
|
829
|
-
const e =
|
|
830
|
-
await
|
|
912
|
+
const e = P(t) ? t : [t];
|
|
913
|
+
await g.removeCoordinate(this, e);
|
|
831
914
|
for (const s of e) {
|
|
832
915
|
const n = this.children.findIndex((r) => r.id === s.id);
|
|
833
916
|
n !== -1 && this.children.splice(n, 1);
|
|
@@ -835,12 +918,12 @@ class _t {
|
|
|
835
918
|
}
|
|
836
919
|
//更新子节点
|
|
837
920
|
async updateChild(t) {
|
|
838
|
-
const e =
|
|
921
|
+
const e = P(t) ? t : [t], s = await g.updateCoordinate(this, e);
|
|
839
922
|
this.mergeChild(s);
|
|
840
923
|
}
|
|
841
924
|
//绑定子节点,不建立映射关系
|
|
842
925
|
async bindChild(t) {
|
|
843
|
-
const e =
|
|
926
|
+
const e = P(t) ? t : [t], s = await g.bindCoordinate(this, e);
|
|
844
927
|
this.mergeChild(s);
|
|
845
928
|
}
|
|
846
929
|
// 合并子节点,没有查询到节点就插入
|
|
@@ -863,11 +946,11 @@ class _t {
|
|
|
863
946
|
}
|
|
864
947
|
//映射到(模型映射到空间,空间映射到空间)
|
|
865
948
|
async mappingTo(t) {
|
|
866
|
-
await
|
|
949
|
+
await Z(t);
|
|
867
950
|
}
|
|
868
951
|
// 来自映射(被映射过的源坐标系关系)
|
|
869
952
|
async fromMapping() {
|
|
870
|
-
const t = await
|
|
953
|
+
const t = await q({ srcCsId: this.id });
|
|
871
954
|
return t[t.length - 1];
|
|
872
955
|
}
|
|
873
956
|
/**
|
|
@@ -886,10 +969,10 @@ class _t {
|
|
|
886
969
|
* @param mapped 是否被映射
|
|
887
970
|
* @returns
|
|
888
971
|
*/
|
|
889
|
-
findChildModel(t = [
|
|
972
|
+
findChildModel(t = [N.CADModel, N.SkyMapModel], e = !0) {
|
|
890
973
|
var h, c;
|
|
891
|
-
const s =
|
|
892
|
-
if (s.includes(this.modelType ?? -1) && this.status !==
|
|
974
|
+
const s = P(t) ? t : [t];
|
|
975
|
+
if (s.includes(this.modelType ?? -1) && this.status !== O.Disabled)
|
|
893
976
|
return this;
|
|
894
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));
|
|
895
978
|
return a == null ? void 0 : a[0];
|
|
@@ -900,12 +983,12 @@ class _t {
|
|
|
900
983
|
* @param excludeNodes //排除的坐标系
|
|
901
984
|
* @returns
|
|
902
985
|
*/
|
|
903
|
-
findClosestModel(t =
|
|
986
|
+
findClosestModel(t = N.CADModel, e) {
|
|
904
987
|
var u;
|
|
905
988
|
const s = /* @__PURE__ */ new Set();
|
|
906
989
|
for (const f of e ?? [])
|
|
907
990
|
s.add(String(f.id));
|
|
908
|
-
const n = [{ node: this, distance: 0 }], r =
|
|
991
|
+
const n = [{ node: this, distance: 0 }], r = P(t) ? t : [t], a = /* @__PURE__ */ new Set();
|
|
909
992
|
let h, c = 1 / 0;
|
|
910
993
|
for (; n.length > 0; ) {
|
|
911
994
|
const f = n.shift();
|
|
@@ -921,14 +1004,14 @@ class _t {
|
|
|
921
1004
|
a.add(l);
|
|
922
1005
|
const b = [];
|
|
923
1006
|
if ((u = l.parent) != null && u.children)
|
|
924
|
-
for (const
|
|
925
|
-
|
|
1007
|
+
for (const S of l.parent.children)
|
|
1008
|
+
S !== l && !a.has(S) && b.push(S);
|
|
926
1009
|
if (l.children)
|
|
927
|
-
for (const
|
|
928
|
-
a.has(
|
|
1010
|
+
for (const S of l.children)
|
|
1011
|
+
a.has(S) || b.push(S);
|
|
929
1012
|
l.parent && !a.has(l.parent) && b.push(l.parent);
|
|
930
|
-
for (const
|
|
931
|
-
n.push({ node:
|
|
1013
|
+
for (const S of b)
|
|
1014
|
+
n.push({ node: S, distance: d + 1 });
|
|
932
1015
|
}
|
|
933
1016
|
return h;
|
|
934
1017
|
}
|
|
@@ -1008,7 +1091,7 @@ class _t {
|
|
|
1008
1091
|
getMappedCsTree() {
|
|
1009
1092
|
function t(n) {
|
|
1010
1093
|
var r;
|
|
1011
|
-
return (r = n.children) != null && r.length && (n.children = n.children.filter((a) => !!(a != null && a.relativeMap) && a.status !==
|
|
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;
|
|
1012
1095
|
}
|
|
1013
1096
|
const e = W(this.findRoot(!0)), s = t(e);
|
|
1014
1097
|
return s.parentId = 0, s.parent = void 0, s;
|
|
@@ -1021,13 +1104,13 @@ class _t {
|
|
|
1021
1104
|
getDestRelativeMap(t) {
|
|
1022
1105
|
var r;
|
|
1023
1106
|
if (this.id === t.id)
|
|
1024
|
-
return new
|
|
1107
|
+
return new p();
|
|
1025
1108
|
const e = this.getRelativeMaps(), s = t.getRelativeMaps();
|
|
1026
|
-
let n = new
|
|
1109
|
+
let n = new p();
|
|
1027
1110
|
return e == null || e.forEach((a) => {
|
|
1028
|
-
n =
|
|
1111
|
+
n = p.addRelativeMap(n, a);
|
|
1029
1112
|
}), (r = s == null ? void 0 : s.reverse()) == null || r.forEach((a) => {
|
|
1030
|
-
n =
|
|
1113
|
+
n = p.addRelativeMap(n, p.inverseRelativeMap(a));
|
|
1031
1114
|
}), n;
|
|
1032
1115
|
}
|
|
1033
1116
|
/**
|
|
@@ -1132,7 +1215,7 @@ class tt {
|
|
|
1132
1215
|
return t ? `${t.x},${t.y},${t.z}` : "";
|
|
1133
1216
|
}
|
|
1134
1217
|
}
|
|
1135
|
-
class
|
|
1218
|
+
class Ft {
|
|
1136
1219
|
//屏幕位置
|
|
1137
1220
|
constructor(t) {
|
|
1138
1221
|
o(this, "canvas");
|
|
@@ -1318,8 +1401,8 @@ class Xt {
|
|
|
1318
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));
|
|
1319
1402
|
}
|
|
1320
1403
|
}
|
|
1321
|
-
const
|
|
1322
|
-
class
|
|
1404
|
+
const X = {};
|
|
1405
|
+
class Ut {
|
|
1323
1406
|
constructor(t) {
|
|
1324
1407
|
o(this, "type", "image");
|
|
1325
1408
|
// 修改为更通用的名称
|
|
@@ -1333,7 +1416,7 @@ class Ft {
|
|
|
1333
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);
|
|
1334
1417
|
}
|
|
1335
1418
|
loadImage(t) {
|
|
1336
|
-
const e =
|
|
1419
|
+
const e = X[this.src];
|
|
1337
1420
|
if (e)
|
|
1338
1421
|
return queueMicrotask(() => {
|
|
1339
1422
|
var s;
|
|
@@ -1343,7 +1426,7 @@ class Ft {
|
|
|
1343
1426
|
const s = new Image();
|
|
1344
1427
|
return s.crossOrigin = "anonymous", s.src = this.src, s.onload = () => {
|
|
1345
1428
|
var n;
|
|
1346
|
-
|
|
1429
|
+
X[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
|
|
1347
1430
|
}, s;
|
|
1348
1431
|
}
|
|
1349
1432
|
}
|
|
@@ -1376,8 +1459,8 @@ class Yt {
|
|
|
1376
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();
|
|
1377
1460
|
}
|
|
1378
1461
|
}
|
|
1379
|
-
const
|
|
1380
|
-
class
|
|
1462
|
+
const F = {};
|
|
1463
|
+
class Bt {
|
|
1381
1464
|
constructor(t) {
|
|
1382
1465
|
o(this, "id", "");
|
|
1383
1466
|
o(this, "type", "issue");
|
|
@@ -1397,7 +1480,7 @@ class Gt {
|
|
|
1397
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);
|
|
1398
1481
|
}
|
|
1399
1482
|
loadImage(t) {
|
|
1400
|
-
const e =
|
|
1483
|
+
const e = F[this.src];
|
|
1401
1484
|
if (e)
|
|
1402
1485
|
return queueMicrotask(() => {
|
|
1403
1486
|
var s;
|
|
@@ -1407,7 +1490,7 @@ class Gt {
|
|
|
1407
1490
|
const s = new Image();
|
|
1408
1491
|
return s.src = this.src, s.crossOrigin = "anonymous", s.onload = () => {
|
|
1409
1492
|
var n;
|
|
1410
|
-
|
|
1493
|
+
F[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
|
|
1411
1494
|
}, s;
|
|
1412
1495
|
}
|
|
1413
1496
|
}
|
|
@@ -1417,8 +1500,8 @@ class Gt {
|
|
|
1417
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();
|
|
1418
1501
|
}
|
|
1419
1502
|
}
|
|
1420
|
-
const
|
|
1421
|
-
class
|
|
1503
|
+
const U = {};
|
|
1504
|
+
class Gt {
|
|
1422
1505
|
constructor(t) {
|
|
1423
1506
|
o(this, "type", "marker");
|
|
1424
1507
|
o(this, "x");
|
|
@@ -1434,7 +1517,7 @@ class Bt {
|
|
|
1434
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);
|
|
1435
1518
|
}
|
|
1436
1519
|
loadImage(t) {
|
|
1437
|
-
const e =
|
|
1520
|
+
const e = U[this.url];
|
|
1438
1521
|
if (e)
|
|
1439
1522
|
return queueMicrotask(() => {
|
|
1440
1523
|
var s;
|
|
@@ -1444,7 +1527,7 @@ class Bt {
|
|
|
1444
1527
|
const s = new Image();
|
|
1445
1528
|
return s.src = this.url, s.crossOrigin = "anonymous", s.onload = () => {
|
|
1446
1529
|
var n;
|
|
1447
|
-
|
|
1530
|
+
U[this.url] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
|
|
1448
1531
|
}, s;
|
|
1449
1532
|
}
|
|
1450
1533
|
}
|
|
@@ -1476,7 +1559,7 @@ class Bt {
|
|
|
1476
1559
|
}
|
|
1477
1560
|
}
|
|
1478
1561
|
}
|
|
1479
|
-
class
|
|
1562
|
+
class $t {
|
|
1480
1563
|
constructor(t) {
|
|
1481
1564
|
o(this, "type", "radar");
|
|
1482
1565
|
o(this, "x");
|
|
@@ -1507,7 +1590,7 @@ class Ut {
|
|
|
1507
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();
|
|
1508
1591
|
}
|
|
1509
1592
|
}
|
|
1510
|
-
class
|
|
1593
|
+
class _t {
|
|
1511
1594
|
constructor(t) {
|
|
1512
1595
|
o(this, "type", "region");
|
|
1513
1596
|
o(this, "x");
|
|
@@ -1540,31 +1623,31 @@ class $t {
|
|
|
1540
1623
|
}
|
|
1541
1624
|
export {
|
|
1542
1625
|
rt as APP_SETTING,
|
|
1543
|
-
|
|
1544
|
-
|
|
1626
|
+
y as AppError,
|
|
1627
|
+
w as AppErrorCode,
|
|
1545
1628
|
nt as AppObsType,
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1629
|
+
Ft as CanvasElement,
|
|
1630
|
+
Ut as CanvasImageElement,
|
|
1631
|
+
Bt as CanvasIssueElement,
|
|
1632
|
+
Gt as CanvasMarkerElement,
|
|
1550
1633
|
Yt as CanvasPointElement,
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1634
|
+
$t as CanvasRadarElement,
|
|
1635
|
+
_t as CanvasRegionElement,
|
|
1636
|
+
jt as Coordinate,
|
|
1554
1637
|
it as CoordinateLevel,
|
|
1555
|
-
|
|
1556
|
-
|
|
1638
|
+
N as CoordinateModelType,
|
|
1639
|
+
O as CoordinateStatus,
|
|
1557
1640
|
M as CoordinateType,
|
|
1558
|
-
|
|
1559
|
-
|
|
1641
|
+
g as DataSource,
|
|
1642
|
+
D as GeoPoint,
|
|
1560
1643
|
m as Point,
|
|
1561
1644
|
K as Position,
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1645
|
+
p as RelativeMap,
|
|
1646
|
+
R as RequestContentType,
|
|
1647
|
+
x as RequestMethod,
|
|
1565
1648
|
Y as RequestResultCode,
|
|
1566
1649
|
tt as Vector3,
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1650
|
+
At as api,
|
|
1651
|
+
Ct as http,
|
|
1652
|
+
Xt as utils
|
|
1570
1653
|
};
|