@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/README.md +20 -20
- package/dist/index.d.ts +162 -20
- package/dist/index.mjs +727 -552
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,207 +1,224 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
},
|
|
22
|
+
}, ot = {
|
|
9
23
|
isTransformResponse: !0,
|
|
10
24
|
joinBaseUrl: !0,
|
|
11
25
|
withAuthorize: !0
|
|
12
|
-
},
|
|
26
|
+
}, at = {
|
|
13
27
|
url: "",
|
|
14
|
-
method:
|
|
28
|
+
method: x.GET,
|
|
15
29
|
headers: {}
|
|
16
|
-
},
|
|
17
|
-
function
|
|
18
|
-
Object.assign(
|
|
30
|
+
}, B = { ...rt };
|
|
31
|
+
function ht(i) {
|
|
32
|
+
Object.assign(B, i);
|
|
19
33
|
}
|
|
20
|
-
async function
|
|
21
|
-
const e = { ...
|
|
34
|
+
async function T(i, t) {
|
|
35
|
+
const e = { ...ot, ...t }, s = { ...at, ...i };
|
|
22
36
|
try {
|
|
23
|
-
const n =
|
|
24
|
-
return
|
|
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
|
|
40
|
+
return ut(n);
|
|
27
41
|
}
|
|
28
42
|
}
|
|
29
|
-
function
|
|
30
|
-
const { baseUrl: e, authorizeCode: s } =
|
|
31
|
-
let { url: a, method:
|
|
32
|
-
n && e && (a = `${e}${a}`),
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
a += `?${
|
|
37
|
-
}
|
|
38
|
-
let
|
|
39
|
-
return
|
|
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:
|
|
42
|
-
headers:
|
|
43
|
-
body:
|
|
55
|
+
method: h,
|
|
56
|
+
headers: l,
|
|
57
|
+
body: d
|
|
44
58
|
};
|
|
45
59
|
}
|
|
46
|
-
function
|
|
60
|
+
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
|
-
if (e ===
|
|
66
|
+
if (e === Y.SUCCESS)
|
|
53
67
|
return s;
|
|
54
|
-
throw new
|
|
68
|
+
throw new y(w.RequestCodeError, n || "请求返回的Code错误");
|
|
55
69
|
}
|
|
56
|
-
function
|
|
57
|
-
throw i instanceof Error ? i : new
|
|
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
|
|
76
|
+
const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
60
77
|
__proto__: null,
|
|
61
|
-
request:
|
|
62
|
-
setRequestGlobalConfig:
|
|
78
|
+
request: T,
|
|
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
|
-
function
|
|
85
|
-
return
|
|
101
|
+
function L(i, t) {
|
|
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
|
|
122
139
|
);
|
|
123
140
|
}
|
|
124
|
-
function
|
|
141
|
+
function ft(i, t = {
|
|
125
142
|
isTransformResponse: !1,
|
|
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:
|
|
141
|
-
getImageInfo:
|
|
142
|
-
getMappingRelation:
|
|
143
|
-
mapingCoordinate:
|
|
144
|
-
removeCoordinate:
|
|
145
|
-
saveCoordinate:
|
|
146
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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
|
|
165
|
+
return mt.call(i) === `[object ${t}]`;
|
|
149
166
|
}
|
|
150
167
|
function J(i) {
|
|
151
168
|
return typeof i < "u";
|
|
152
169
|
}
|
|
153
|
-
function
|
|
170
|
+
function H(i) {
|
|
154
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
|
-
function
|
|
179
|
+
function yt(i) {
|
|
163
180
|
return v(i, "Date");
|
|
164
181
|
}
|
|
165
|
-
function
|
|
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
|
-
function
|
|
188
|
+
function gt(i) {
|
|
172
189
|
return v(i, "Boolean");
|
|
173
190
|
}
|
|
174
|
-
function
|
|
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
|
-
function
|
|
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
|
-
function
|
|
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
|
-
function
|
|
202
|
-
return
|
|
218
|
+
function W(i) {
|
|
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))
|
|
@@ -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,
|
|
216
|
-
e.set(
|
|
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(
|
|
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] =
|
|
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
|
-
const n = function(...
|
|
247
|
-
const
|
|
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(
|
|
250
|
-
}, t), h && i.apply(
|
|
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
|
|
273
|
+
function Et(i, t, e = !1) {
|
|
257
274
|
let s, n;
|
|
258
|
-
const
|
|
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,
|
|
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,
|
|
282
|
+
)) : (e && i.apply(h, a), n = Date.now());
|
|
266
283
|
};
|
|
267
|
-
return
|
|
284
|
+
return r.cancel = () => {
|
|
268
285
|
clearTimeout(s), s = void 0, n = void 0;
|
|
269
|
-
},
|
|
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
|
|
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 =
|
|
274
|
-
if (
|
|
310
|
+
const n = C(i);
|
|
311
|
+
if (zt(n)) {
|
|
275
312
|
e(!0);
|
|
276
313
|
return;
|
|
277
314
|
}
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
h !== !1 &&
|
|
281
|
-
}),
|
|
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
|
-
},
|
|
284
|
-
document.head.removeChild(
|
|
285
|
-
}, document.head.appendChild(
|
|
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
|
|
289
|
-
const t =
|
|
290
|
-
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);
|
|
291
328
|
}
|
|
292
|
-
function
|
|
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
|
|
301
|
-
const n = Math.min(i / e, t / s),
|
|
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 -
|
|
341
|
+
x: (i - r) / 2,
|
|
305
342
|
// 居中计算的X起点
|
|
306
|
-
y: (t -
|
|
343
|
+
y: (t - a) / 2,
|
|
307
344
|
// 居中计算的Y起点
|
|
308
|
-
sw:
|
|
309
|
-
sh:
|
|
345
|
+
sw: r,
|
|
346
|
+
sh: a
|
|
310
347
|
};
|
|
311
348
|
}
|
|
312
|
-
function
|
|
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
|
|
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
|
|
363
|
+
function Rt(i) {
|
|
327
364
|
console.warn(`[warn]:${i}`);
|
|
328
365
|
}
|
|
329
|
-
function
|
|
366
|
+
function Lt(i) {
|
|
330
367
|
throw new Error(`[error]:${i}`);
|
|
331
368
|
}
|
|
332
|
-
const
|
|
369
|
+
const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
333
370
|
__proto__: null,
|
|
334
|
-
cloneDeep:
|
|
335
|
-
debounce:
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
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:
|
|
341
|
-
isBoolean:
|
|
342
|
-
isDate:
|
|
379
|
+
isArray: P,
|
|
380
|
+
isBoolean: gt,
|
|
381
|
+
isDate: yt,
|
|
343
382
|
isDef: J,
|
|
344
|
-
isElement:
|
|
345
|
-
isFunction:
|
|
346
|
-
isNull:
|
|
347
|
-
isNullOrUnDef:
|
|
348
|
-
isNumber:
|
|
349
|
-
isNumeric:
|
|
350
|
-
isObject:
|
|
351
|
-
isPromise:
|
|
352
|
-
isRegExp:
|
|
353
|
-
isSameValue:
|
|
354
|
-
isString:
|
|
355
|
-
isUnDef:
|
|
356
|
-
isWindow:
|
|
357
|
-
loadScript:
|
|
358
|
-
throttle:
|
|
359
|
-
toCanvasCoord:
|
|
360
|
-
toModelCoord:
|
|
361
|
-
warn:
|
|
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
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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 },
|
|
415
|
-
return Math.min(
|
|
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
|
-
|
|
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
|
-
|
|
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) ===
|
|
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
|
|
440
|
-
return this.x =
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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
|
|
578
|
+
class D {
|
|
478
579
|
//高度
|
|
479
580
|
constructor(t) {
|
|
480
|
-
|
|
581
|
+
o(this, "lat", 0);
|
|
481
582
|
//经度
|
|
482
|
-
|
|
583
|
+
o(this, "lon", 0);
|
|
483
584
|
//纬度
|
|
484
|
-
|
|
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,
|
|
490
|
-
let c,
|
|
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
|
|
493
|
-
c = e.lon + m.toDegrees(
|
|
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
|
|
496
|
-
c = e.lon + m.toDegrees(
|
|
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
|
|
499
|
-
return new
|
|
500
|
-
lat:
|
|
599
|
+
throw new y(w.GeoPointNoPlane, "点的plane应为xz或xy");
|
|
600
|
+
return new D({
|
|
601
|
+
lat: u,
|
|
501
602
|
lon: c,
|
|
502
|
-
alt:
|
|
603
|
+
alt: f
|
|
503
604
|
});
|
|
504
605
|
}
|
|
505
606
|
static LLHToXYZ(t, e) {
|
|
506
|
-
const n = 0.0033528106647474805,
|
|
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:
|
|
610
|
+
x: f * 1e3,
|
|
510
611
|
y: (t.alt - e.alt) * 1e3,
|
|
511
|
-
z:
|
|
612
|
+
z: l * 1e3,
|
|
512
613
|
plane: "xz"
|
|
513
614
|
});
|
|
514
615
|
if (t.plane === "xy")
|
|
515
616
|
return new m({
|
|
516
|
-
x:
|
|
517
|
-
y:
|
|
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
|
|
622
|
+
throw new y(w.GeoPointNoPlane, "点的plane应为xz或xy");
|
|
522
623
|
}
|
|
523
624
|
}
|
|
524
|
-
class
|
|
625
|
+
class p {
|
|
525
626
|
//参考点
|
|
526
627
|
constructor(t) {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
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
|
|
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
|
|
548
|
-
const s = t.scale * e.scale, n = t.yaw + e.yaw,
|
|
549
|
-
let h = 0, c = 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
|
|
552
|
-
h = e.x +
|
|
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
|
|
555
|
-
h = e.x +
|
|
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
|
|
558
|
-
return new
|
|
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:
|
|
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),
|
|
576
|
-
let
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
583
|
-
return new
|
|
683
|
+
throw new y(w.RelativeNoPlane, "映射关系的plane应为xz或xy");
|
|
684
|
+
return new p({
|
|
584
685
|
scale: e,
|
|
585
686
|
yaw: s,
|
|
586
|
-
x:
|
|
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
|
|
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
|
|
699
|
+
return s && (e = { refPoint: s }), e ? new p(e) : void 0;
|
|
599
700
|
} catch {
|
|
600
|
-
throw new
|
|
701
|
+
throw new y(w.RelativeJsonError, "relativeMap格式化失败");
|
|
601
702
|
}
|
|
602
703
|
}
|
|
603
|
-
static
|
|
704
|
+
static toStringify(t) {
|
|
604
705
|
return t ? JSON.stringify(t) : void 0;
|
|
605
706
|
}
|
|
606
707
|
}
|
|
607
|
-
class
|
|
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
|
|
715
|
+
const e = await G({ projectId: t });
|
|
615
716
|
if (e.length) {
|
|
616
|
-
const s =
|
|
617
|
-
return
|
|
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,
|
|
628
|
-
const { type: c, modelType:
|
|
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:
|
|
635
|
-
relativePosition:
|
|
735
|
+
renderType: u,
|
|
736
|
+
relativePosition: b
|
|
636
737
|
};
|
|
637
|
-
}),
|
|
638
|
-
return
|
|
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
|
|
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,
|
|
658
|
-
const { type: c, relativeMap:
|
|
659
|
-
return { ...
|
|
660
|
-
}),
|
|
661
|
-
return
|
|
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,
|
|
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
|
-
}),
|
|
674
|
-
return
|
|
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:
|
|
687
|
-
relativePosition:
|
|
787
|
+
renderType: r,
|
|
788
|
+
relativePosition: a,
|
|
688
789
|
...h
|
|
689
|
-
} = e, c =
|
|
690
|
-
return new
|
|
790
|
+
} = e, c = p.toParse(a);
|
|
791
|
+
return new jt({
|
|
691
792
|
...h,
|
|
692
793
|
type: s,
|
|
693
|
-
modelType:
|
|
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((
|
|
708
|
-
s.set(String(
|
|
709
|
-
}), t.forEach((
|
|
808
|
+
return t.forEach((r) => {
|
|
809
|
+
s.set(String(r.id), r);
|
|
810
|
+
}), t.forEach((r) => {
|
|
710
811
|
var h;
|
|
711
|
-
const
|
|
712
|
-
if (
|
|
713
|
-
if (
|
|
714
|
-
|
|
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(
|
|
717
|
-
c && (
|
|
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(
|
|
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,
|
|
729
|
-
if (e.type ===
|
|
730
|
-
const
|
|
731
|
-
return
|
|
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(
|
|
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 =
|
|
744
|
-
s.children = n, s.disabled = s.disabled ?? !1, s.type !==
|
|
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
|
|
849
|
+
class jt {
|
|
749
850
|
constructor(t) {
|
|
750
|
-
|
|
851
|
+
o(this, "id", 0);
|
|
751
852
|
//id
|
|
752
|
-
|
|
853
|
+
o(this, "type", 0);
|
|
753
854
|
//0空间,1模型
|
|
754
|
-
|
|
855
|
+
o(this, "children", []);
|
|
755
856
|
//子节点
|
|
756
|
-
|
|
857
|
+
o(this, "level");
|
|
757
858
|
//空间的层级
|
|
758
|
-
|
|
859
|
+
o(this, "relativeMap");
|
|
759
860
|
//相对位置关系
|
|
760
|
-
|
|
861
|
+
o(this, "no");
|
|
761
862
|
//坐标系编号
|
|
762
|
-
|
|
863
|
+
o(this, "name");
|
|
763
864
|
//名称
|
|
764
|
-
|
|
865
|
+
o(this, "shortName");
|
|
765
866
|
//简称
|
|
766
|
-
|
|
867
|
+
o(this, "status");
|
|
767
868
|
//使用状态
|
|
768
|
-
|
|
869
|
+
o(this, "modelId");
|
|
769
870
|
// 模型ID
|
|
770
|
-
|
|
871
|
+
o(this, "modelType");
|
|
771
872
|
//模型的类型
|
|
772
|
-
|
|
873
|
+
o(this, "modelValue");
|
|
773
874
|
// 模型value
|
|
774
|
-
|
|
875
|
+
o(this, "projectId");
|
|
775
876
|
//项目id
|
|
776
|
-
|
|
877
|
+
o(this, "parentId");
|
|
777
878
|
//父节点id
|
|
778
|
-
|
|
879
|
+
o(this, "parent");
|
|
779
880
|
//父节点
|
|
780
|
-
|
|
881
|
+
o(this, "groupUuid");
|
|
781
882
|
//分组uuid
|
|
782
|
-
|
|
883
|
+
o(this, "z");
|
|
783
884
|
//坐标系高度
|
|
784
|
-
|
|
885
|
+
o(this, "createTime");
|
|
785
886
|
// 创建时间
|
|
786
|
-
|
|
787
|
-
|
|
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 ===
|
|
891
|
+
return this.children.filter((t) => t.type === M.Space);
|
|
792
892
|
}
|
|
793
893
|
get modelList() {
|
|
794
|
-
return this.children.filter((t) => t.type ===
|
|
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 =
|
|
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 =
|
|
808
|
-
await
|
|
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((
|
|
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 =
|
|
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 =
|
|
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:
|
|
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:
|
|
833
|
-
name:
|
|
937
|
+
no: r,
|
|
938
|
+
name: a,
|
|
834
939
|
shortName: h,
|
|
835
940
|
status: c,
|
|
836
|
-
modelId:
|
|
837
|
-
modelValue:
|
|
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
|
|
949
|
+
await Z(t);
|
|
845
950
|
}
|
|
846
951
|
// 来自映射(被映射过的源坐标系关系)
|
|
847
952
|
async fromMapping() {
|
|
848
|
-
const t = await
|
|
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 = [
|
|
972
|
+
findChildModel(t = [N.CADModel, N.SkyMapModel], e = !0) {
|
|
868
973
|
var h, c;
|
|
869
|
-
const s =
|
|
870
|
-
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)
|
|
871
976
|
return this;
|
|
872
|
-
const
|
|
873
|
-
return
|
|
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
|
-
|
|
882
|
-
var
|
|
986
|
+
findClosestModel(t = N.CADModel, e) {
|
|
987
|
+
var u;
|
|
883
988
|
const s = /* @__PURE__ */ new Set();
|
|
884
|
-
for (const
|
|
885
|
-
s.add(String(
|
|
886
|
-
const n = [{ node: this, distance: 0 }],
|
|
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
|
|
890
|
-
if (!
|
|
891
|
-
const { node:
|
|
892
|
-
if (s.has(String(
|
|
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 (
|
|
895
|
-
if (d < c && (h =
|
|
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
|
-
|
|
900
|
-
const
|
|
901
|
-
if ((
|
|
902
|
-
for (const
|
|
903
|
-
|
|
904
|
-
if (
|
|
905
|
-
for (const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
for (const
|
|
909
|
-
n.push({ node:
|
|
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 !==
|
|
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 ===
|
|
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
|
|
989
|
-
return (
|
|
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 =
|
|
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
|
|
1105
|
+
var r;
|
|
1001
1106
|
if (this.id === t.id)
|
|
1002
|
-
return new
|
|
1107
|
+
return new p();
|
|
1003
1108
|
const e = this.getRelativeMaps(), s = t.getRelativeMaps();
|
|
1004
|
-
let n = new
|
|
1005
|
-
return e == null || e.forEach((
|
|
1006
|
-
n =
|
|
1007
|
-
}), (
|
|
1008
|
-
n =
|
|
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
|
|
1176
|
+
class K {
|
|
1024
1177
|
//横滚角
|
|
1025
1178
|
constructor(t) {
|
|
1026
|
-
|
|
1179
|
+
o(this, "yaw", 0);
|
|
1027
1180
|
//偏航角
|
|
1028
|
-
|
|
1181
|
+
o(this, "pitch", 0);
|
|
1029
1182
|
//俯仰角
|
|
1030
|
-
|
|
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
|
|
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
|
|
1190
|
+
return new K({ yaw: e[0], pitch: e[1], roll: e[2] });
|
|
1038
1191
|
}
|
|
1039
1192
|
}
|
|
1040
|
-
static
|
|
1193
|
+
static toStringify(t) {
|
|
1041
1194
|
return t ? `${t.yaw},${t.pitch},${t.roll}` : "";
|
|
1042
1195
|
}
|
|
1043
1196
|
}
|
|
1044
|
-
class
|
|
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
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1221
|
+
o(this, "canvas");
|
|
1222
|
+
o(this, "ctx");
|
|
1223
|
+
o(this, "options");
|
|
1224
|
+
o(this, "offset", { x: 0, y: 0 });
|
|
1051
1225
|
// 拖动偏移
|
|
1052
|
-
|
|
1226
|
+
o(this, "curOffset", { x: 0, y: 0 });
|
|
1053
1227
|
// 记录上一次的偏移量
|
|
1054
|
-
|
|
1228
|
+
o(this, "mousePosition", { x: -1, y: -1 });
|
|
1055
1229
|
// 记录鼠标坐标位置
|
|
1056
1230
|
// 缩放
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1231
|
+
o(this, "MAX_SCALE", 60);
|
|
1232
|
+
o(this, "MIN_SCALE", 1);
|
|
1233
|
+
o(this, "STEP_SCALE", 0.5);
|
|
1060
1234
|
// 暂存缩放值
|
|
1061
|
-
|
|
1062
|
-
|
|
1235
|
+
o(this, "scale", 1);
|
|
1236
|
+
o(this, "preScale", 1);
|
|
1063
1237
|
// 画布大小
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1238
|
+
o(this, "width", 0);
|
|
1239
|
+
o(this, "height", 0);
|
|
1240
|
+
o(this, "x", 0);
|
|
1067
1241
|
// 记录鼠标点击时的横坐标
|
|
1068
|
-
|
|
1242
|
+
o(this, "y", 0);
|
|
1069
1243
|
// 记录鼠标点击时的纵坐标
|
|
1070
|
-
|
|
1244
|
+
o(this, "timeout", 0);
|
|
1071
1245
|
// 单击
|
|
1072
1246
|
// 移动端相关参数
|
|
1073
|
-
|
|
1074
|
-
|
|
1247
|
+
o(this, "lastTouch");
|
|
1248
|
+
o(this, "initialDistance", 0);
|
|
1075
1249
|
//初始距离
|
|
1076
|
-
|
|
1077
|
-
|
|
1250
|
+
o(this, "touchMode", 0);
|
|
1251
|
+
o(this, "isMouseover", !1);
|
|
1078
1252
|
//鼠标是否在元素上
|
|
1079
|
-
|
|
1253
|
+
o(this, "isBindEvent", !0);
|
|
1080
1254
|
// 是否绘制辅助线
|
|
1081
|
-
|
|
1255
|
+
o(this, "isDrawAssist", !1);
|
|
1082
1256
|
// 是否绑定事件
|
|
1083
|
-
|
|
1257
|
+
o(this, "customDrawAssist");
|
|
1084
1258
|
// 绘制辅助线的方法
|
|
1085
|
-
|
|
1259
|
+
o(this, "isMoveRedrawing");
|
|
1086
1260
|
// 移动过程中是否重绘
|
|
1087
|
-
|
|
1088
|
-
|
|
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:
|
|
1094
|
-
isDrawAssist:
|
|
1267
|
+
isBindEvent: r = !0,
|
|
1268
|
+
isDrawAssist: a = !1,
|
|
1095
1269
|
isMoveRedrawing: h,
|
|
1096
1270
|
customDrawAssist: c,
|
|
1097
|
-
afterDraw:
|
|
1098
|
-
...
|
|
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 =
|
|
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
|
|
1108
|
-
this.options.onClick(
|
|
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:
|
|
1183
|
-
e - s < 300 && Math.abs(t.clientX - n) < 30 && Math.abs(t.clientY -
|
|
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:
|
|
1206
|
-
offset:
|
|
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 =
|
|
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
|
|
1231
|
-
class
|
|
1404
|
+
const X = {};
|
|
1405
|
+
class Ut {
|
|
1232
1406
|
constructor(t) {
|
|
1233
|
-
|
|
1407
|
+
o(this, "type", "image");
|
|
1234
1408
|
// 修改为更通用的名称
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
1442
|
+
class Yt {
|
|
1269
1443
|
constructor(t) {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
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
|
|
1289
|
-
class
|
|
1462
|
+
const F = {};
|
|
1463
|
+
class Bt {
|
|
1290
1464
|
constructor(t) {
|
|
1291
|
-
|
|
1292
|
-
|
|
1465
|
+
o(this, "id", "");
|
|
1466
|
+
o(this, "type", "issue");
|
|
1293
1467
|
//轨迹点上的事件
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
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 =
|
|
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
|
-
|
|
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,
|
|
1326
|
-
t.save(), t.drawImage(this.img,
|
|
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
|
|
1330
|
-
class
|
|
1503
|
+
const U = {};
|
|
1504
|
+
class Gt {
|
|
1331
1505
|
constructor(t) {
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
1370
|
-
if ((
|
|
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
|
|
1562
|
+
class $t {
|
|
1389
1563
|
constructor(t) {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
|
1593
|
+
class _t {
|
|
1420
1594
|
constructor(t) {
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
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:
|
|
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,
|
|
1431
|
-
{ x: Math.max(e, n), y: Math.min(s,
|
|
1432
|
-
{ x: Math.max(e, n), y: Math.max(s,
|
|
1433
|
-
{ x: Math.min(e, n), y: Math.max(s,
|
|
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:
|
|
1441
|
-
t.arc(c,
|
|
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:
|
|
1445
|
-
n === 0 ? t.moveTo(
|
|
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
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
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
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
At as
|
|
1477
|
-
|
|
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
|
};
|