@vsleem-realsee-viewer/shared 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +132 -132
- package/dist/index.umd.js +1 -1
- package/package.json +1 -11
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ declare namespace api {
|
|
|
11
11
|
}
|
|
12
12
|
export { api }
|
|
13
13
|
|
|
14
|
+
export declare const APP_SETTING: {
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
obsType: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
14
19
|
export declare class AppError extends Error {
|
|
15
20
|
code: number;
|
|
16
21
|
message: string;
|
|
@@ -479,11 +484,6 @@ declare function debounce<T extends (...args: any[]) => void>(func: T, wait: num
|
|
|
479
484
|
cancel: () => void;
|
|
480
485
|
};
|
|
481
486
|
|
|
482
|
-
export declare const DEFAULT_APP_SETTING: {
|
|
483
|
-
baseUrl: string;
|
|
484
|
-
obsType: string;
|
|
485
|
-
};
|
|
486
|
-
|
|
487
487
|
declare function error(message: string): void;
|
|
488
488
|
|
|
489
489
|
export declare class GeoPoint {
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var W = Object.defineProperty;
|
|
2
2
|
var Q = (i, t, e) => t in i ? W(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
3
|
var r = (i, t, e) => Q(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
var P = /* @__PURE__ */ ((i) => (i[i.CADModel = 5] = "CADModel", i[i.BimfaceModel = 6] = "BimfaceModel", i[i.ForgeModel = 7] = "ForgeModel", i[i.ThreeDModel = 8] = "ThreeDModel", i[i.SkyMapModel = 9] = "SkyMapModel", i[i.ScaleModel = 10] = "ScaleModel", i))(P || {}), K = /* @__PURE__ */ ((i) => (i[i.Global = 0] = "Global", i))(K || {}), x = /* @__PURE__ */ ((i) => (i[i.Space = 0] = "Space", i[i.Model = 1] = "Model", i[i.Data = 2] = "Data", i))(x || {}), L = /* @__PURE__ */ ((i) => (i[i.Used = 0] = "Used", i[i.Enabled = 1] = "Enabled", i[i.Disabled = 2] = "Disabled", i))(L || {}),
|
|
4
|
+
var P = /* @__PURE__ */ ((i) => (i[i.CADModel = 5] = "CADModel", i[i.BimfaceModel = 6] = "BimfaceModel", i[i.ForgeModel = 7] = "ForgeModel", i[i.ThreeDModel = 8] = "ThreeDModel", i[i.SkyMapModel = 9] = "SkyMapModel", i[i.ScaleModel = 10] = "ScaleModel", i))(P || {}), K = /* @__PURE__ */ ((i) => (i[i.Global = 0] = "Global", i))(K || {}), x = /* @__PURE__ */ ((i) => (i[i.Space = 0] = "Space", i[i.Model = 1] = "Model", i[i.Data = 2] = "Data", i))(x || {}), L = /* @__PURE__ */ ((i) => (i[i.Used = 0] = "Used", i[i.Enabled = 1] = "Enabled", i[i.Disabled = 2] = "Disabled", i))(L || {}), C = /* @__PURE__ */ ((i) => (i[i.SUCCESS = 200] = "SUCCESS", i[i.ERROR = -1] = "ERROR", i[i.TIMEOUT = 401] = "TIMEOUT", i))(C || {}), p = /* @__PURE__ */ ((i) => (i.GET = "GET", i.POST = "POST", i))(p || {}), X = /* @__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))(X || {}), tt = /* @__PURE__ */ ((i) => (i.Hw = "huawei", i.Ali = "aliyun", i.Hs = "hs", i.Aws = "amazon", i.Minio = "minio", i))(tt || {}), M = /* @__PURE__ */ ((i) => (i[i.GEO_POINT_NO_PLANE = 9e3] = "GEO_POINT_NO_PLANE", i[i.POINT_AND_GIS_NO_MAPPING = 9010] = "POINT_AND_GIS_NO_MAPPING", i[i.POINT_NO_PLANE = 9011] = "POINT_NO_PLANE", i[i.RELATIVE_MAP_MAPPING_SAME = 9020] = "RELATIVE_MAP_MAPPING_SAME", i[i.RELATIVE_NO_PLANE = 9021] = "RELATIVE_NO_PLANE", i[i.RELATIVE_JSON_ERROR = 9022] = "RELATIVE_JSON_ERROR", i))(M || {});
|
|
5
5
|
const et = {
|
|
6
6
|
baseUrl: "https://vsleem.com/api",
|
|
7
7
|
obsType: "hs"
|
|
@@ -11,13 +11,13 @@ const et = {
|
|
|
11
11
|
withAuthorize: !0
|
|
12
12
|
}, it = {
|
|
13
13
|
url: "",
|
|
14
|
-
method:
|
|
14
|
+
method: p.GET,
|
|
15
15
|
headers: {}
|
|
16
16
|
}, F = { ...et };
|
|
17
17
|
function nt(i) {
|
|
18
18
|
Object.assign(F, i);
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
20
|
+
async function b(i, t) {
|
|
21
21
|
const e = { ...st, ...t }, s = { ...it, ...i };
|
|
22
22
|
try {
|
|
23
23
|
const n = rt(s, e), { url: a, ...o } = n, c = await (await window.fetch(a, o)).json();
|
|
@@ -27,20 +27,20 @@ async function E(i, t) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
function rt(i, t) {
|
|
30
|
-
const { baseUrl: e, authorizeCode: s } = F, { joinBaseUrl: n
|
|
31
|
-
let { url:
|
|
32
|
-
n && e && (
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
let
|
|
39
|
-
return
|
|
40
|
-
url:
|
|
41
|
-
method:
|
|
42
|
-
headers:
|
|
43
|
-
body:
|
|
30
|
+
const { baseUrl: e, authorizeCode: s } = F, { joinBaseUrl: n } = t;
|
|
31
|
+
let { url: a, method: o, headers: h = {}, params: c, data: l } = i;
|
|
32
|
+
n && e && (a = `${e}${a}`), o = o == null ? void 0 : o.toUpperCase();
|
|
33
|
+
const f = { ...h };
|
|
34
|
+
if (o === p.GET && c) {
|
|
35
|
+
const d = new URLSearchParams(c);
|
|
36
|
+
a += `?${d.toString()}`;
|
|
37
|
+
}
|
|
38
|
+
let u;
|
|
39
|
+
return o === p.POST && (u = f["Content-Type"] === X.JSON ? JSON.stringify(l || {}) : l), {
|
|
40
|
+
url: a,
|
|
41
|
+
method: o,
|
|
42
|
+
headers: f,
|
|
43
|
+
body: u
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
function at(i, t) {
|
|
@@ -49,73 +49,73 @@ function at(i, t) {
|
|
|
49
49
|
if (!i)
|
|
50
50
|
throw new Error("Request no return data!");
|
|
51
51
|
const { code: e, data: s, msg: n } = i;
|
|
52
|
-
if (e ===
|
|
52
|
+
if (e === C.SUCCESS)
|
|
53
53
|
return s;
|
|
54
54
|
throw new Error(n || "Request error!");
|
|
55
55
|
}
|
|
56
56
|
function ot(i) {
|
|
57
57
|
throw i instanceof Error ? i : new Error(typeof i == "string" ? i : "Unknown request error");
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
60
60
|
__proto__: null,
|
|
61
|
-
request:
|
|
61
|
+
request: b,
|
|
62
62
|
setRequestGlobalConfig: nt
|
|
63
63
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
64
64
|
function Y(i, t) {
|
|
65
|
-
return
|
|
65
|
+
return b(
|
|
66
66
|
{
|
|
67
67
|
url: "/project/jssdk/cs/list",
|
|
68
|
-
method:
|
|
68
|
+
method: p.GET,
|
|
69
69
|
params: i
|
|
70
70
|
},
|
|
71
71
|
t
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
function G(i, t) {
|
|
75
|
-
return
|
|
75
|
+
return b(
|
|
76
76
|
{
|
|
77
77
|
url: "/project/jssdk/cs/bind",
|
|
78
|
-
method:
|
|
78
|
+
method: p.POST,
|
|
79
79
|
data: i
|
|
80
80
|
},
|
|
81
81
|
t
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
function D(i, t) {
|
|
85
|
-
return
|
|
85
|
+
return b(
|
|
86
86
|
{
|
|
87
87
|
url: "/project/jssdk/cs/save",
|
|
88
|
-
method:
|
|
88
|
+
method: p.POST,
|
|
89
89
|
data: i
|
|
90
90
|
},
|
|
91
91
|
t
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
94
|
+
function B(i, t) {
|
|
95
|
+
return b(
|
|
96
96
|
{
|
|
97
97
|
url: "/project/jssdk/cs/delete",
|
|
98
|
-
method:
|
|
98
|
+
method: p.POST,
|
|
99
99
|
data: i
|
|
100
100
|
},
|
|
101
101
|
t
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
104
|
+
function U(i, t) {
|
|
105
|
+
return b(
|
|
106
106
|
{
|
|
107
107
|
url: "/project/jssdk/cs/mapping",
|
|
108
|
-
method:
|
|
108
|
+
method: p.POST,
|
|
109
109
|
data: i
|
|
110
110
|
},
|
|
111
111
|
t
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
function $(i, t) {
|
|
115
|
-
return
|
|
115
|
+
return b(
|
|
116
116
|
{
|
|
117
117
|
url: "/project/jssdk/cs/mapping/query",
|
|
118
|
-
method:
|
|
118
|
+
method: p.GET,
|
|
119
119
|
params: i
|
|
120
120
|
},
|
|
121
121
|
t
|
|
@@ -126,10 +126,10 @@ function ht(i, t = {
|
|
|
126
126
|
joinBaseUrl: !1,
|
|
127
127
|
withAuthorize: !1
|
|
128
128
|
}) {
|
|
129
|
-
return
|
|
129
|
+
return b(
|
|
130
130
|
{
|
|
131
131
|
url: i,
|
|
132
|
-
method:
|
|
132
|
+
method: p.GET
|
|
133
133
|
},
|
|
134
134
|
t
|
|
135
135
|
);
|
|
@@ -140,8 +140,8 @@ const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
140
140
|
getCoordinateList: Y,
|
|
141
141
|
getImageInfo: ht,
|
|
142
142
|
getMappingRelation: $,
|
|
143
|
-
mapingCoordinate:
|
|
144
|
-
removeCoordinate:
|
|
143
|
+
mapingCoordinate: U,
|
|
144
|
+
removeCoordinate: B,
|
|
145
145
|
saveCoordinate: D
|
|
146
146
|
}, Symbol.toStringTag, { value: "Module" })), ct = typeof window < "u", lt = Object.prototype.toString;
|
|
147
147
|
function v(i, t) {
|
|
@@ -153,7 +153,7 @@ function J(i) {
|
|
|
153
153
|
function V(i) {
|
|
154
154
|
return !J(i);
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function z(i) {
|
|
157
157
|
return i !== null && v(i, "Object");
|
|
158
158
|
}
|
|
159
159
|
function Z(i) {
|
|
@@ -165,7 +165,7 @@ function ut(i) {
|
|
|
165
165
|
function ft(i) {
|
|
166
166
|
return v(i, "String");
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function A(i) {
|
|
169
169
|
return typeof i == "function";
|
|
170
170
|
}
|
|
171
171
|
function dt(i) {
|
|
@@ -174,14 +174,14 @@ function dt(i) {
|
|
|
174
174
|
function mt(i) {
|
|
175
175
|
return v(i, "RegExp");
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function E(i) {
|
|
178
178
|
return i && Array.isArray(i);
|
|
179
179
|
}
|
|
180
180
|
function yt(i) {
|
|
181
181
|
return typeof window < "u" && v(i, "Window");
|
|
182
182
|
}
|
|
183
183
|
function wt(i) {
|
|
184
|
-
return
|
|
184
|
+
return z(i) && !!i.tagName;
|
|
185
185
|
}
|
|
186
186
|
function gt(i) {
|
|
187
187
|
return typeof i == "number" || /^\d+(\.\d+)?$/.test(i);
|
|
@@ -196,7 +196,7 @@ function Mt(i) {
|
|
|
196
196
|
return V(i) || Z(i);
|
|
197
197
|
}
|
|
198
198
|
function xt(i) {
|
|
199
|
-
return v(i, "Promise") &&
|
|
199
|
+
return v(i, "Promise") && z(i) && A(i.then) && A(i.catch);
|
|
200
200
|
}
|
|
201
201
|
function q(i) {
|
|
202
202
|
return N(i, /* @__PURE__ */ new WeakMap());
|
|
@@ -270,7 +270,7 @@ function Tt(i, t, e = !1) {
|
|
|
270
270
|
}
|
|
271
271
|
function bt(i, t = {}) {
|
|
272
272
|
return new Promise((e, s) => {
|
|
273
|
-
const n =
|
|
273
|
+
const n = _(i);
|
|
274
274
|
if (Et(n)) {
|
|
275
275
|
e(!0);
|
|
276
276
|
return;
|
|
@@ -286,10 +286,10 @@ function bt(i, t = {}) {
|
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
function Et(i) {
|
|
289
|
-
const t =
|
|
290
|
-
return Array.from(document.scripts).some((e) =>
|
|
289
|
+
const t = _(i);
|
|
290
|
+
return Array.from(document.scripts).some((e) => _(e.src) === t);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function _(i) {
|
|
293
293
|
try {
|
|
294
294
|
const t = new URL(i, window.location.href);
|
|
295
295
|
return `${t.origin}${t.pathname}`;
|
|
@@ -337,17 +337,17 @@ const zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
337
337
|
getImageTransform: St,
|
|
338
338
|
inBrowser: ct,
|
|
339
339
|
is: v,
|
|
340
|
-
isArray:
|
|
340
|
+
isArray: E,
|
|
341
341
|
isBoolean: dt,
|
|
342
342
|
isDate: ut,
|
|
343
343
|
isDef: J,
|
|
344
344
|
isElement: wt,
|
|
345
|
-
isFunction:
|
|
345
|
+
isFunction: A,
|
|
346
346
|
isNull: Z,
|
|
347
347
|
isNullOrUnDef: Mt,
|
|
348
348
|
isNumber: O,
|
|
349
349
|
isNumeric: gt,
|
|
350
|
-
isObject:
|
|
350
|
+
isObject: z,
|
|
351
351
|
isPromise: xt,
|
|
352
352
|
isRegExp: mt,
|
|
353
353
|
isSameValue: pt,
|
|
@@ -360,9 +360,9 @@ const zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
360
360
|
toModelCoord: Pt,
|
|
361
361
|
warn: Ot
|
|
362
362
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
363
|
-
class
|
|
363
|
+
class g extends Error {
|
|
364
364
|
constructor(t, e, s) {
|
|
365
|
-
super(e), this.code = t, this.message = e, this.details = s, this.name = "Apprror", Object.setPrototypeOf(this,
|
|
365
|
+
super(e), this.code = t, this.message = e, this.details = s, this.name = "Apprror", Object.setPrototypeOf(this, g.prototype);
|
|
366
366
|
}
|
|
367
367
|
// 可选的:转换成 JSON 格式,方便返回给调用方
|
|
368
368
|
toJSON() {
|
|
@@ -392,8 +392,8 @@ class m {
|
|
|
392
392
|
r(this, "hasGeo", !1);
|
|
393
393
|
r(this, "hasAngle", !1);
|
|
394
394
|
r(this, "plane", "xy");
|
|
395
|
-
const { x: e, y: s, z: n, lat: a, lon: o, alt: h, yaw: c, pitch:
|
|
396
|
-
O(e) && O(s) && (this.x = Number(e) || 0, this.y = Number(s) || 0, this.z = Number(n) || 0, this.plane =
|
|
395
|
+
const { x: e, y: s, z: n, lat: a, lon: o, alt: h, yaw: c, pitch: l, roll: f, plane: u = "xy" } = t || {};
|
|
396
|
+
O(e) && O(s) && (this.x = Number(e) || 0, this.y = Number(s) || 0, this.z = Number(n) || 0, this.plane = u, this.hasXYZ = !0), O(a) && O(o) && Number(a) !== 0 && Number(o) !== 0 && (this.lat = Number(a) || 0, this.lon = Number(o) || 0, this.alt = Number(h) || 0, this.hasGeo = !0), (c !== void 0 || l !== void 0 || f !== void 0) && (this.yaw = Number(c) || 0, this.pitch = Number(l) || 0, this.roll = Number(f) || 0, this.hasAngle = !0);
|
|
397
397
|
}
|
|
398
398
|
static dist(t, e) {
|
|
399
399
|
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2 + (t.z - e.z) ** 2);
|
|
@@ -411,8 +411,8 @@ class m {
|
|
|
411
411
|
return (Number(t) || 0) * 180 / Math.PI;
|
|
412
412
|
}
|
|
413
413
|
static angleXZ(t, e, s) {
|
|
414
|
-
const n = { x: t.x - e.x, z: t.z - e.z }, a = { x: s.x - e.x, z: s.z - e.z }, o = n.x * a.x + n.z * a.z, h = Math.sqrt(n.x ** 2 + n.z ** 2), c = Math.sqrt(a.x ** 2 + a.z ** 2),
|
|
415
|
-
return Math.min(
|
|
414
|
+
const n = { x: t.x - e.x, z: t.z - e.z }, a = { x: s.x - e.x, z: s.z - e.z }, o = n.x * a.x + n.z * a.z, h = Math.sqrt(n.x ** 2 + n.z ** 2), c = Math.sqrt(a.x ** 2 + a.z ** 2), l = Math.max(-1, Math.min(1, o / (h * c))), u = Math.acos(l) * 180 / Math.PI;
|
|
415
|
+
return Math.min(u, 360 - u);
|
|
416
416
|
}
|
|
417
417
|
static JSONParse(t) {
|
|
418
418
|
if (t) {
|
|
@@ -439,14 +439,14 @@ class m {
|
|
|
439
439
|
const a = I.LLHToXYZ(this, n);
|
|
440
440
|
return this.x = a.x, this.y = a.y, this.z = a.z, this.hasXYZ = !0, this.project(t);
|
|
441
441
|
} else
|
|
442
|
-
throw new
|
|
442
|
+
throw new g(M.POINT_AND_GIS_NO_MAPPING, ",没有完成gis与其他空间的映射");
|
|
443
443
|
} else if ((s == null ? void 0 : s.modelType) === P.SkyMapModel) {
|
|
444
444
|
const { refPoint: n } = (s == null ? void 0 : s.relativeMap) || {}, a = this.project(t);
|
|
445
445
|
if (a != null && a.hasXYZ && n) {
|
|
446
446
|
const o = I.XYZToLLH(a, n);
|
|
447
447
|
return a.lat = o.lat, a.lon = o.lon, a.alt = o.alt, a.hasGeo = !0, a;
|
|
448
448
|
} else
|
|
449
|
-
throw new
|
|
449
|
+
throw new g(M.POINT_AND_GIS_NO_MAPPING, "没有完成gis与其他空间的映射");
|
|
450
450
|
} else
|
|
451
451
|
return this.project(t);
|
|
452
452
|
} catch {
|
|
@@ -458,7 +458,7 @@ class m {
|
|
|
458
458
|
return this.projectXZ(t);
|
|
459
459
|
if (this.plane === "xy")
|
|
460
460
|
return this.projectXY(t);
|
|
461
|
-
throw new
|
|
461
|
+
throw new g(M.POINT_NO_PLANE, "点的plane应为xz或xy");
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
projectXZ(t) {
|
|
@@ -487,38 +487,38 @@ class I {
|
|
|
487
487
|
}
|
|
488
488
|
static XYZToLLH(t, e) {
|
|
489
489
|
const n = 0.0033528106647474805, a = n * (2 - n), o = m.toRadians(e.lat), h = 6378137 / Math.sqrt(1 - a * Math.sin(o) ** 2) + e.alt;
|
|
490
|
-
let c,
|
|
490
|
+
let c, l, f;
|
|
491
491
|
if (t.plane === "xz") {
|
|
492
|
-
const
|
|
493
|
-
c = e.lon + m.toDegrees(
|
|
492
|
+
const u = t.x / 1e3 / (h * Math.cos(o)), d = t.z / 1e3 / h;
|
|
493
|
+
c = e.lon + m.toDegrees(u), l = e.lat - m.toDegrees(d), f = e.alt + t.y / 1e3;
|
|
494
494
|
} else if (t.plane === "xy") {
|
|
495
|
-
const
|
|
496
|
-
c = e.lon + m.toDegrees(
|
|
495
|
+
const u = t.x / 1e3 / (h * Math.cos(o)), d = t.y / 1e3 / h;
|
|
496
|
+
c = e.lon + m.toDegrees(u), l = e.lat - m.toDegrees(d), f = e.alt + t.z / 1e3;
|
|
497
497
|
} else
|
|
498
|
-
throw new
|
|
498
|
+
throw new g(M.GEO_POINT_NO_PLANE, "点的plane应为xz或xy");
|
|
499
499
|
return new I({
|
|
500
|
-
lat:
|
|
500
|
+
lat: l,
|
|
501
501
|
lon: c,
|
|
502
502
|
alt: f
|
|
503
503
|
});
|
|
504
504
|
}
|
|
505
505
|
static LLHToXYZ(t, e) {
|
|
506
|
-
const n = 0.0033528106647474805, a = n * (2 - n), o = m.toRadians(e.lat), h = 6378137 / Math.sqrt(1 - a * Math.sin(o) ** 2) + e.alt, c = m.toRadians(t.lon - e.lon),
|
|
506
|
+
const n = 0.0033528106647474805, a = n * (2 - n), o = m.toRadians(e.lat), h = 6378137 / Math.sqrt(1 - a * Math.sin(o) ** 2) + e.alt, c = m.toRadians(t.lon - e.lon), l = m.toRadians(e.lat - t.lat), f = h * c * Math.cos(o), u = h * l;
|
|
507
507
|
if (t.plane === "xz")
|
|
508
508
|
return new m({
|
|
509
509
|
x: f * 1e3,
|
|
510
510
|
y: (t.alt - e.alt) * 1e3,
|
|
511
|
-
z:
|
|
511
|
+
z: u * 1e3,
|
|
512
512
|
plane: "xz"
|
|
513
513
|
});
|
|
514
514
|
if (t.plane === "xy")
|
|
515
515
|
return new m({
|
|
516
516
|
x: f * 1e3,
|
|
517
|
-
y:
|
|
517
|
+
y: u * 1e3,
|
|
518
518
|
z: (t.alt - e.alt) * 1e3,
|
|
519
519
|
plane: "xy"
|
|
520
520
|
});
|
|
521
|
-
throw new
|
|
521
|
+
throw new g(M.GEO_POINT_NO_PLANE, "点的plane应为xz或xy");
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
class w {
|
|
@@ -544,23 +544,23 @@ class w {
|
|
|
544
544
|
*/
|
|
545
545
|
static addRelativeMap(t, e) {
|
|
546
546
|
if (t.plane !== e.plane)
|
|
547
|
-
throw new
|
|
547
|
+
throw new g(M.RELATIVE_MAP_MAPPING_SAME, "两个映射关系的plane应该相同");
|
|
548
548
|
const s = t.scale * e.scale, n = t.yaw + e.yaw, a = Math.cos(e.yaw), o = Math.sin(e.yaw);
|
|
549
|
-
let h = 0, c = 0,
|
|
549
|
+
let h = 0, c = 0, l = 0;
|
|
550
550
|
if (t.plane === "xz") {
|
|
551
|
-
const f = t.x * a - t.z * o,
|
|
552
|
-
h = e.x + f * e.scale, c = e.y +
|
|
551
|
+
const f = t.x * a - t.z * o, u = t.y, d = t.x * o + t.z * a;
|
|
552
|
+
h = e.x + f * e.scale, c = e.y + u * e.scale, l = e.z + d * e.scale;
|
|
553
553
|
} else if (t.plane === "xy") {
|
|
554
|
-
const f = t.x * a - t.y * o,
|
|
555
|
-
h = e.x + f * e.scale, c = e.y +
|
|
554
|
+
const f = t.x * a - t.y * o, u = t.x * o + t.y * a, d = t.z;
|
|
555
|
+
h = e.x + f * e.scale, c = e.y + u * e.scale, l = e.z + d * e.scale;
|
|
556
556
|
} else
|
|
557
|
-
throw new
|
|
557
|
+
throw new g(M.RELATIVE_NO_PLANE, "映射关系的plane应为xz或xy");
|
|
558
558
|
return new w({
|
|
559
559
|
scale: s,
|
|
560
560
|
yaw: n,
|
|
561
561
|
x: h,
|
|
562
562
|
y: c,
|
|
563
|
-
z:
|
|
563
|
+
z: l,
|
|
564
564
|
start: t.start,
|
|
565
565
|
end: t.end,
|
|
566
566
|
plane: t.plane
|
|
@@ -579,7 +579,7 @@ class w {
|
|
|
579
579
|
else if (t.plane === "xy")
|
|
580
580
|
o = -(t.x * n + t.y * a) * e, h = -(t.y * n - t.x * a) * e, c = -t.z * e;
|
|
581
581
|
else
|
|
582
|
-
throw new
|
|
582
|
+
throw new g(M.RELATIVE_NO_PLANE, "映射关系的plane应为xz或xy");
|
|
583
583
|
return new w({
|
|
584
584
|
scale: e,
|
|
585
585
|
yaw: s,
|
|
@@ -597,7 +597,7 @@ class w {
|
|
|
597
597
|
const { reference_point: s } = e || {};
|
|
598
598
|
return s && (e = { refPoint: s }), e ? new w(e) : void 0;
|
|
599
599
|
} catch {
|
|
600
|
-
throw new
|
|
600
|
+
throw new g(M.RELATIVE_JSON_ERROR, "relativeMap格式化失败");
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
static JSONStringify(t) {
|
|
@@ -625,14 +625,14 @@ class y {
|
|
|
625
625
|
*/
|
|
626
626
|
static async addCoordinate(t, e) {
|
|
627
627
|
const { projectId: s, id: n } = t, a = e.map((h) => {
|
|
628
|
-
const { type: c, modelType:
|
|
628
|
+
const { type: c, modelType: l, relativeMap: f, level: u, ...d } = h, S = f ? JSON.stringify(f) : void 0;
|
|
629
629
|
return {
|
|
630
630
|
...d,
|
|
631
631
|
projectId: s,
|
|
632
632
|
parentId: n,
|
|
633
633
|
coordinateType: c,
|
|
634
|
-
renderType:
|
|
635
|
-
relativePosition:
|
|
634
|
+
renderType: l,
|
|
635
|
+
relativePosition: S
|
|
636
636
|
};
|
|
637
637
|
}), o = await D(a);
|
|
638
638
|
return y.handleCoordinateList(o);
|
|
@@ -645,7 +645,7 @@ class y {
|
|
|
645
645
|
*/
|
|
646
646
|
static async removeCoordinate(t, e) {
|
|
647
647
|
const s = e.map((n) => n.id ?? -1);
|
|
648
|
-
return await
|
|
648
|
+
return await B(s);
|
|
649
649
|
}
|
|
650
650
|
/**
|
|
651
651
|
* 更新坐标系
|
|
@@ -655,8 +655,8 @@ class y {
|
|
|
655
655
|
*/
|
|
656
656
|
static async updateCoordinate(t, e) {
|
|
657
657
|
const { projectId: s, id: n } = t, a = e.map((h) => {
|
|
658
|
-
const { type: c, relativeMap:
|
|
659
|
-
return { ...
|
|
658
|
+
const { type: c, relativeMap: l, level: f, ...u } = h, d = w.JSONStringify(l);
|
|
659
|
+
return { ...u, relativePosition: d, projectId: s, parentId: n };
|
|
660
660
|
}), o = await D(a);
|
|
661
661
|
return y.handleCoordinateList(o);
|
|
662
662
|
}
|
|
@@ -799,12 +799,12 @@ class Lt {
|
|
|
799
799
|
}
|
|
800
800
|
//添加子节点
|
|
801
801
|
async addChild(t) {
|
|
802
|
-
const e =
|
|
802
|
+
const e = E(t) ? t : [t], s = await y.addCoordinate(this, e);
|
|
803
803
|
this.mergeChild(s);
|
|
804
804
|
}
|
|
805
805
|
//删除子节点
|
|
806
806
|
async removeChild(t) {
|
|
807
|
-
const e =
|
|
807
|
+
const e = E(t) ? t : [t];
|
|
808
808
|
await y.removeCoordinate(this, e);
|
|
809
809
|
for (const s of e) {
|
|
810
810
|
const n = this.children.findIndex((a) => a.id === s.id);
|
|
@@ -813,12 +813,12 @@ class Lt {
|
|
|
813
813
|
}
|
|
814
814
|
//更新子节点
|
|
815
815
|
async updateChild(t) {
|
|
816
|
-
const e =
|
|
816
|
+
const e = E(t) ? t : [t], s = await y.updateCoordinate(this, e);
|
|
817
817
|
this.mergeChild(s);
|
|
818
818
|
}
|
|
819
819
|
//绑定子节点,不建立映射关系
|
|
820
820
|
async bindChild(t) {
|
|
821
|
-
const e =
|
|
821
|
+
const e = E(t) ? t : [t], s = await y.bindCoordinate(this, e);
|
|
822
822
|
this.mergeChild(s);
|
|
823
823
|
}
|
|
824
824
|
// 合并子节点,没有查询到节点就插入
|
|
@@ -826,14 +826,14 @@ class Lt {
|
|
|
826
826
|
t != null && t.length && t.forEach((e) => {
|
|
827
827
|
const s = this.children.find((n) => n.id === e.id);
|
|
828
828
|
if (s) {
|
|
829
|
-
const { relativeMap: n, no: a, name: o, shortName: h, status: c, modelId:
|
|
829
|
+
const { relativeMap: n, no: a, name: o, shortName: h, status: c, modelId: l, modelValue: f } = e;
|
|
830
830
|
Object.assign(s, {
|
|
831
831
|
relativeMap: n,
|
|
832
832
|
no: a,
|
|
833
833
|
name: o,
|
|
834
834
|
shortName: h,
|
|
835
835
|
status: c,
|
|
836
|
-
modelId:
|
|
836
|
+
modelId: l,
|
|
837
837
|
modelValue: f
|
|
838
838
|
});
|
|
839
839
|
} else this.id === e.parentId && (e.parent = this, this.children.unshift(e));
|
|
@@ -841,7 +841,7 @@ class Lt {
|
|
|
841
841
|
}
|
|
842
842
|
//映射到(模型映射到空间,空间映射到空间)
|
|
843
843
|
async mappingTo(t) {
|
|
844
|
-
await
|
|
844
|
+
await U(t);
|
|
845
845
|
}
|
|
846
846
|
// 来自映射(被映射过的源坐标系关系)
|
|
847
847
|
async fromMapping() {
|
|
@@ -866,10 +866,10 @@ class Lt {
|
|
|
866
866
|
*/
|
|
867
867
|
findChildModel(t = [P.CADModel, P.SkyMapModel], e = !0) {
|
|
868
868
|
var h, c;
|
|
869
|
-
const s =
|
|
869
|
+
const s = E(t) ? t : [t];
|
|
870
870
|
if (s.includes(this.modelType ?? -1) && this.status !== L.Disabled)
|
|
871
871
|
return this;
|
|
872
|
-
const a = [x.Data, x.Model].includes(this.type) ? this.findParentSpace() : this, o = (c = (h = a == null ? void 0 : a.modelList) == null ? void 0 : h.filter((
|
|
872
|
+
const a = [x.Data, x.Model].includes(this.type) ? this.findParentSpace() : this, o = (c = (h = a == null ? void 0 : a.modelList) == null ? void 0 : h.filter((l) => s.includes(l.modelType ?? -1) ? e ? !!l.relativeMap : !0 : !1)) == null ? void 0 : c.sort((l, f) => Number(l.status) - Number(f.status));
|
|
873
873
|
return o == null ? void 0 : o[0];
|
|
874
874
|
}
|
|
875
875
|
/**
|
|
@@ -879,34 +879,34 @@ class Lt {
|
|
|
879
879
|
* @returns
|
|
880
880
|
*/
|
|
881
881
|
findLatestModel(t = P.CADModel, e) {
|
|
882
|
-
var
|
|
882
|
+
var l;
|
|
883
883
|
const s = /* @__PURE__ */ new Set();
|
|
884
884
|
for (const f of e ?? [])
|
|
885
885
|
s.add(String(f.id));
|
|
886
|
-
const n = [{ node: this, distance: 0 }], a =
|
|
886
|
+
const n = [{ node: this, distance: 0 }], a = E(t) ? t : [t], o = /* @__PURE__ */ new Set();
|
|
887
887
|
let h, c = 1 / 0;
|
|
888
888
|
for (; n.length > 0; ) {
|
|
889
889
|
const f = n.shift();
|
|
890
890
|
if (!f) break;
|
|
891
|
-
const { node:
|
|
892
|
-
if (s.has(String(
|
|
891
|
+
const { node: u, distance: d } = f;
|
|
892
|
+
if (s.has(String(u.id)))
|
|
893
893
|
continue;
|
|
894
|
-
if (a.includes(
|
|
895
|
-
if (d < c && (h =
|
|
894
|
+
if (a.includes(u.modelType ?? -1)) {
|
|
895
|
+
if (d < c && (h = u, c = d, d <= 1))
|
|
896
896
|
break;
|
|
897
897
|
continue;
|
|
898
898
|
}
|
|
899
|
-
o.add(
|
|
900
|
-
const
|
|
901
|
-
if ((
|
|
902
|
-
for (const
|
|
903
|
-
|
|
904
|
-
if (
|
|
905
|
-
for (const
|
|
906
|
-
o.has(
|
|
907
|
-
|
|
908
|
-
for (const
|
|
909
|
-
n.push({ node:
|
|
899
|
+
o.add(u);
|
|
900
|
+
const S = [];
|
|
901
|
+
if ((l = u.parent) != null && l.children)
|
|
902
|
+
for (const T of u.parent.children)
|
|
903
|
+
T !== u && !o.has(T) && S.push(T);
|
|
904
|
+
if (u.children)
|
|
905
|
+
for (const T of u.children)
|
|
906
|
+
o.has(T) || S.push(T);
|
|
907
|
+
u.parent && !o.has(u.parent) && S.push(u.parent);
|
|
908
|
+
for (const T of S)
|
|
909
|
+
n.push({ node: T, distance: d + 1 });
|
|
910
910
|
}
|
|
911
911
|
return h;
|
|
912
912
|
}
|
|
@@ -1094,7 +1094,7 @@ class Rt {
|
|
|
1094
1094
|
isDrawAssist: o = !1,
|
|
1095
1095
|
isMoveRedrawing: h,
|
|
1096
1096
|
customDrawAssist: c,
|
|
1097
|
-
afterDraw:
|
|
1097
|
+
afterDraw: l,
|
|
1098
1098
|
...f
|
|
1099
1099
|
} = t;
|
|
1100
1100
|
this.canvas = e, this.ctx = this.canvas.getContext("2d"), this.width = s, this.height = n, this.canvas.width = s, this.canvas.height = n, this.isBindEvent = a, this.isDrawAssist = o, this.customDrawAssist = c, this.isMoveRedrawing = h ?? o, this.options = 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, a && (this.canvas.addEventListener("DOMMouseScroll", this.onMousewheel), this.canvas.addEventListener("mousewheel", this.onMousewheel), this.canvas.addEventListener("mousedown", this.onMousedown), this.canvas.addEventListener("mousemove", this.onMousemove), this.canvas.addEventListener("mouseout", this.onMouseout), this.canvas.addEventListener("dblclick", this.onDblclick), this.canvas.addEventListener("touchstart", this.onTouchstart));
|
|
@@ -1227,7 +1227,7 @@ class Rt {
|
|
|
1227
1227
|
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
1228
|
}
|
|
1229
1229
|
}
|
|
1230
|
-
const
|
|
1230
|
+
const R = {};
|
|
1231
1231
|
class jt {
|
|
1232
1232
|
constructor(t) {
|
|
1233
1233
|
r(this, "type", "image");
|
|
@@ -1242,7 +1242,7 @@ class jt {
|
|
|
1242
1242
|
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
1243
|
}
|
|
1244
1244
|
loadImage(t) {
|
|
1245
|
-
const e =
|
|
1245
|
+
const e = R[this.src];
|
|
1246
1246
|
if (e)
|
|
1247
1247
|
return queueMicrotask(() => {
|
|
1248
1248
|
var s;
|
|
@@ -1252,7 +1252,7 @@ class jt {
|
|
|
1252
1252
|
const s = new Image();
|
|
1253
1253
|
return s.crossOrigin = "anonymous", s.src = this.src, s.onload = () => {
|
|
1254
1254
|
var n;
|
|
1255
|
-
|
|
1255
|
+
R[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
|
|
1256
1256
|
}, s;
|
|
1257
1257
|
}
|
|
1258
1258
|
}
|
|
@@ -1285,7 +1285,7 @@ class kt {
|
|
|
1285
1285
|
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
1286
|
}
|
|
1287
1287
|
}
|
|
1288
|
-
const
|
|
1288
|
+
const j = {};
|
|
1289
1289
|
class Ct {
|
|
1290
1290
|
constructor(t) {
|
|
1291
1291
|
r(this, "id", "");
|
|
@@ -1306,7 +1306,7 @@ class Ct {
|
|
|
1306
1306
|
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
1307
|
}
|
|
1308
1308
|
loadImage(t) {
|
|
1309
|
-
const e =
|
|
1309
|
+
const e = j[this.src];
|
|
1310
1310
|
if (e)
|
|
1311
1311
|
return queueMicrotask(() => {
|
|
1312
1312
|
var s;
|
|
@@ -1316,17 +1316,17 @@ class Ct {
|
|
|
1316
1316
|
const s = new Image();
|
|
1317
1317
|
return s.src = this.src, s.crossOrigin = "anonymous", s.onload = () => {
|
|
1318
1318
|
var n;
|
|
1319
|
-
|
|
1319
|
+
j[this.src] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
|
|
1320
1320
|
}, s;
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
1323
|
draw(t, e) {
|
|
1324
1324
|
if (!this.img.complete) return;
|
|
1325
|
-
const s = 1 / e.scale, n = this.width * s, a = this.height * s, o = this.x - n / 2, h = this.y - a, c = this.badgeR * s,
|
|
1326
|
-
t.save(), t.drawImage(this.img, o, h, n, a), t.beginPath(), this.count > 1 && (t.arc(this.x + n * 0.3, this.y - a * 0.8, c, 0, 2 * Math.PI), t.fillStyle = "red", t.fill(), t.font = `${
|
|
1325
|
+
const s = 1 / e.scale, n = this.width * s, a = this.height * s, o = this.x - n / 2, h = this.y - a, c = this.badgeR * s, l = c * 1.5;
|
|
1326
|
+
t.save(), t.drawImage(this.img, o, h, n, a), t.beginPath(), this.count > 1 && (t.arc(this.x + n * 0.3, this.y - a * 0.8, c, 0, 2 * Math.PI), t.fillStyle = "red", t.fill(), t.font = `${l}px Microsoft YaHei`, t.textAlign = "center", t.fillStyle = "#FFFFFF", t.fillText(this.count.toString(), this.x + n * 0.3, this.y - a * 0.8 + c / 2)), t.restore();
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
const
|
|
1329
|
+
const k = {};
|
|
1330
1330
|
class Xt {
|
|
1331
1331
|
constructor(t) {
|
|
1332
1332
|
r(this, "type", "marker");
|
|
@@ -1343,7 +1343,7 @@ class Xt {
|
|
|
1343
1343
|
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
1344
|
}
|
|
1345
1345
|
loadImage(t) {
|
|
1346
|
-
const e =
|
|
1346
|
+
const e = k[this.url];
|
|
1347
1347
|
if (e)
|
|
1348
1348
|
return queueMicrotask(() => {
|
|
1349
1349
|
var s;
|
|
@@ -1353,7 +1353,7 @@ class Xt {
|
|
|
1353
1353
|
const s = new Image();
|
|
1354
1354
|
return s.src = this.url, s.crossOrigin = "anonymous", s.onload = () => {
|
|
1355
1355
|
var n;
|
|
1356
|
-
|
|
1356
|
+
k[this.url] = s, t == null || t(s), (n = this.redraw) == null || n.call(this);
|
|
1357
1357
|
}, s;
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
@@ -1437,8 +1437,8 @@ class Yt {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
draw(t, e) {
|
|
1439
1439
|
if (t.save(), t.beginPath(), t.globalAlpha = 0.3, t.fillStyle = this.backgroundColor, this.shape === "circle") {
|
|
1440
|
-
const [{ x: s, y: n }, {}, { x: a, y: o }] = this.areaPoints, h = Math.abs(a - s) / 2, c = s + (a - s) / 2,
|
|
1441
|
-
t.arc(c,
|
|
1440
|
+
const [{ x: s, y: n }, {}, { x: a, y: o }] = this.areaPoints, h = Math.abs(a - s) / 2, c = s + (a - s) / 2, l = n + (o - n) / 2;
|
|
1441
|
+
t.arc(c, l, h, 0, 2 * Math.PI);
|
|
1442
1442
|
} else
|
|
1443
1443
|
this.areaPoints.forEach((s, n) => {
|
|
1444
1444
|
const { x: a, y: o } = s;
|
|
@@ -1448,7 +1448,8 @@ class Yt {
|
|
|
1448
1448
|
}
|
|
1449
1449
|
}
|
|
1450
1450
|
export {
|
|
1451
|
-
|
|
1451
|
+
et as APP_SETTING,
|
|
1452
|
+
g as AppError,
|
|
1452
1453
|
M as AppErrorCode,
|
|
1453
1454
|
tt as AppObsType,
|
|
1454
1455
|
Rt as CanvasElement,
|
|
@@ -1463,16 +1464,15 @@ export {
|
|
|
1463
1464
|
P as CoordinateModelType,
|
|
1464
1465
|
L as CoordinateStatus,
|
|
1465
1466
|
x as CoordinateType,
|
|
1466
|
-
et as DEFAULT_APP_SETTING,
|
|
1467
1467
|
y as DataSource,
|
|
1468
1468
|
I as GeoPoint,
|
|
1469
1469
|
m as Point,
|
|
1470
1470
|
H as Position,
|
|
1471
1471
|
w as RelativeMap,
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1472
|
+
X as RequestContentType,
|
|
1473
|
+
p as RequestMethod,
|
|
1474
|
+
C as RequestResultCode,
|
|
1475
1475
|
_t as api,
|
|
1476
|
-
|
|
1476
|
+
At as http,
|
|
1477
1477
|
zt as utils
|
|
1478
1478
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.Shared={}))})(this,function(l){"use strict";var Ft=Object.defineProperty;var Gt=(l,m,P)=>m in l?Ft(l,m,{enumerable:!0,configurable:!0,writable:!0,value:P}):l[m]=P;var r=(l,m,P)=>Gt(l,typeof m!="symbol"?m+"":m,P);var m=(i=>(i[i.CADModel=5]="CADModel",i[i.BimfaceModel=6]="BimfaceModel",i[i.ForgeModel=7]="ForgeModel",i[i.ThreeDModel=8]="ThreeDModel",i[i.SkyMapModel=9]="SkyMapModel",i[i.ScaleModel=10]="ScaleModel",i))(m||{}),P=(i=>(i[i.Global=0]="Global",i))(P||{}),T=(i=>(i[i.Space=0]="Space",i[i.Model=1]="Model",i[i.Data=2]="Data",i))(T||{}),D=(i=>(i[i.Used=0]="Used",i[i.Enabled=1]="Enabled",i[i.Disabled=2]="Disabled",i))(D||{}),z=(i=>(i[i.SUCCESS=200]="SUCCESS",i[i.ERROR=-1]="ERROR",i[i.TIMEOUT=401]="TIMEOUT",i))(z||{}),M=(i=>(i.GET="GET",i.POST="POST",i))(M||{}),_=(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))(_||{}),F=(i=>(i.Hw="huawei",i.Ali="aliyun",i.Hs="hs",i.Aws="amazon",i.Minio="minio",i))(F||{}),x=(i=>(i[i.GEO_POINT_NO_PLANE=9e3]="GEO_POINT_NO_PLANE",i[i.POINT_AND_GIS_NO_MAPPING=9010]="POINT_AND_GIS_NO_MAPPING",i[i.POINT_NO_PLANE=9011]="POINT_NO_PLANE",i[i.RELATIVE_MAP_MAPPING_SAME=9020]="RELATIVE_MAP_MAPPING_SAME",i[i.RELATIVE_NO_PLANE=9021]="RELATIVE_NO_PLANE",i[i.RELATIVE_JSON_ERROR=9022]="RELATIVE_JSON_ERROR",i))(x||{});const G={baseUrl:"https://vsleem.com/api",obsType:"hs"},st={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},it={url:"",method:M.GET,headers:{}},Y={...G};function nt(i){Object.assign(Y,i)}async function b(i,t){const e={...st,...t},s={...it,...i};try{const n=rt(s,e),{url:a,...o}=n,c=await(await window.fetch(a,o)).json();return at(c,e)}catch(n){return ot(n)}}function rt(i,t){const{baseUrl:e,authorizeCode:s}=Y,{joinBaseUrl:n,withAuthorize:a}=t;let{url:o,method:h,headers:c={},params:d,data:f}=i;n&&e&&(o=`${e}${o}`),h=h==null?void 0:h.toUpperCase();const u={...c};if(a&&s&&(u.Authorization=`Bearer ${s}`),h===M.POST&&!u["Content-Type"]&&(u["Content-Type"]=_.JSON),h===M.GET&&d){const S=new URLSearchParams(d);o+=`?${S.toString()}`}let y;return h===M.POST&&(y=u["Content-Type"]===_.JSON?JSON.stringify(f||{}):f),{url:o,method:h,headers:u,body:y}}function at(i,t){if(!t.isTransformResponse)return i;if(!i)throw new Error("Request no return data!");const{code:e,data:s,msg:n}=i;if(e===z.SUCCESS)return s;throw new Error(n||"Request error!")}function ot(i){throw i instanceof Error?i:new Error(typeof i=="string"?i:"Unknown request error")}const ht=Object.freeze(Object.defineProperty({__proto__:null,request:b,setRequestGlobalConfig:nt},Symbol.toStringTag,{value:"Module"}));function U(i,t){return b({url:"/project/jssdk/cs/list",method:M.GET,params:i},t)}function B(i,t){return b({url:"/project/jssdk/cs/bind",method:M.POST,data:i},t)}function R(i,t){return b({url:"/project/jssdk/cs/save",method:M.POST,data:i},t)}function $(i,t){return b({url:"/project/jssdk/cs/delete",method:M.POST,data:i},t)}function J(i,t){return b({url:"/project/jssdk/cs/mapping",method:M.POST,data:i},t)}function q(i,t){return b({url:"/project/jssdk/cs/mapping/query",method:M.GET,params:i},t)}function ct(i,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return b({url:i,method:M.GET},t)}const lt=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:B,getCoordinateList:U,getImageInfo:ct,getMappingRelation:q,mapingCoordinate:J,removeCoordinate:$,saveCoordinate:R},Symbol.toStringTag,{value:"Module"})),ut=typeof window<"u",dt=Object.prototype.toString;function E(i,t){return dt.call(i)===`[object ${t}]`}function V(i){return typeof i<"u"}function Z(i){return!V(i)}function C(i){return i!==null&&E(i,"Object")}function H(i){return i===null}function ft(i){return E(i,"Date")}function mt(i){return E(i,"String")}function j(i){return typeof i=="function"}function yt(i){return E(i,"Boolean")}function wt(i){return E(i,"RegExp")}function O(i){return i&&Array.isArray(i)}function gt(i){return typeof window<"u"&&E(i,"Window")}function Mt(i){return C(i)&&!!i.tagName}function pt(i){return typeof i=="number"||/^\d+(\.\d+)?$/.test(i)}function L(i){return E(Number(i),"Number")}function vt(i,t){return JSON.stringify(i)===JSON.stringify(t)}function xt(i){return Z(i)||H(i)}function Tt(i){return E(i,"Promise")&&C(i)&&j(i.then)&&j(i.catch)}function W(i){return I(i,new WeakMap)}function I(i,t){if(typeof i!="object"||i===null)return i;if(t.has(i))return t.get(i);let e;if(i instanceof Date)return e=new Date(i),t.set(i,e),e;if(i instanceof RegExp)return e=new RegExp(i),t.set(i,e),e;if(i instanceof Map)return e=new Map,t.set(i,e),i.forEach((n,a)=>{e.set(a,I(n,t))}),e;if(i instanceof Set)return e=new Set,t.set(i,e),i.forEach(n=>{e.add(I(n,t))}),e;if(ArrayBuffer.isView(i))return e=new i.constructor(i.buffer.slice(0),i.byteOffset,i.byteLength),t.set(i,e),e;if(i instanceof ArrayBuffer)return e=i.slice(0),t.set(i,e),e;if(Array.isArray(i)){e=[],t.set(i,e);for(let n=0;n<i.length;n++)n in i&&(e[n]=I(i[n],t));return e}e=Object.create(Object.getPrototypeOf(i)),t.set(i,e);for(const n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=I(i[n],t));const s=Object.getOwnPropertySymbols(i);for(const n of s)Object.prototype.propertyIsEnumerable.call(i,n)&&(e[n]=I(i[n],t));return e}function Et(i,t,e=!1){let s;const n=function(...a){const o=this,h=e&&!s;s&&clearTimeout(s),s=setTimeout(()=>{s=void 0,e||i.apply(o,a)},t),h&&i.apply(o,a)};return n.cancel=()=>{s&&clearTimeout(s),s=void 0},n}function bt(i,t,e=!1){let s,n;const a=function(...o){const h=this;n?(clearTimeout(s),s=setTimeout(()=>{Date.now()-n>=t&&(i.apply(h,o),n=Date.now())},t-(Date.now()-n))):(e&&i.apply(h,o),n=Date.now())};return a.cancel=()=>{clearTimeout(s),s=void 0,n=void 0},a}function St(i,t={}){return new Promise((e,s)=>{const n=k(i);if(Nt(n)){e(!0);return}const a=document.createElement("script");a.src=i,Object.entries(t).forEach(([o,h])=>{h!==!1&&a.setAttribute(o,h===!0?"":String(h))}),a.onload=()=>{e(!0)},a.onerror=()=>{document.head.removeChild(a),s(new Error(`Failed to load script: ${i}`))},document.head.appendChild(a)})}function Nt(i){const t=k(i);return Array.from(document.scripts).some(e=>k(e.src)===t)}function k(i){try{const t=new URL(i,window.location.href);return`${t.origin}${t.pathname}`}catch{return i}}function Pt(i,t,e,s){const n=Math.min(i/e,t/s),a=e*n,o=s*n;return{scale:n,x:(i-a)/2,y:(t-o)/2,sw:a,sh:o}}function Ot(i,t,e){return{x:i*e.scale+e.x,y:t*e.scale+e.y}}function It(i,t,e){return{x:(i-e.x)/e.scale,y:(t-e.y)/e.scale}}function At(i){console.warn(`[warn]:${i}`)}function Lt(i){throw new Error(`[error]:${i}`)}const Dt=Object.freeze(Object.defineProperty({__proto__:null,cloneDeep:W,debounce:Et,error:Lt,getImageTransform:Pt,inBrowser:ut,is:E,isArray:O,isBoolean:yt,isDate:ft,isDef:V,isElement:Mt,isFunction:j,isNull:H,isNullOrUnDef:xt,isNumber:L,isNumeric:pt,isObject:C,isPromise:Tt,isRegExp:wt,isSameValue:vt,isString:mt,isUnDef:Z,isWindow:gt,loadScript:St,throttle:bt,toCanvasCoord:Ot,toModelCoord:It,warn:At},Symbol.toStringTag,{value:"Module"}));class v extends Error{constructor(t,e,s){super(e),this.code=t,this.message=e,this.details=s,this.name="Apprror",Object.setPrototypeOf(this,v.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}class w{constructor(t){r(this,"x",0);r(this,"y",0);r(this,"z",0);r(this,"lat",0);r(this,"lon",0);r(this,"alt",0);r(this,"yaw",0);r(this,"pitch",0);r(this,"roll",0);r(this,"hasXYZ",!1);r(this,"hasGeo",!1);r(this,"hasAngle",!1);r(this,"plane","xy");const{x:e,y:s,z:n,lat:a,lon:o,alt:h,yaw:c,pitch:d,roll:f,plane:u="xy"}=t||{};L(e)&&L(s)&&(this.x=Number(e)||0,this.y=Number(s)||0,this.z=Number(n)||0,this.plane=u,this.hasXYZ=!0),L(a)&&L(o)&&Number(a)!==0&&Number(o)!==0&&(this.lat=Number(a)||0,this.lon=Number(o)||0,this.alt=Number(h)||0,this.hasGeo=!0),(c!==void 0||d!==void 0||f!==void 0)&&(this.yaw=Number(c)||0,this.pitch=Number(d)||0,this.roll=Number(f)||0,this.hasAngle=!0)}static dist(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2+(t.z-e.z)**2)}static distXZ(t,e){return Math.sqrt((t.x-e.x)**2+(t.z-e.z)**2)}static distXY(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,s){const n={x:t.x-e.x,z:t.z-e.z},a={x:s.x-e.x,z:s.z-e.z},o=n.x*a.x+n.z*a.z,h=Math.sqrt(n.x**2+n.z**2),c=Math.sqrt(a.x**2+a.z**2),d=Math.max(-1,Math.min(1,o/(h*c))),u=Math.acos(d)*180/Math.PI;return Math.min(u,360-u)}static JSONParse(t){if(t){const e=t==null?void 0:t.split(",").map(s=>Number(s)||0);return new w({x:e[0],y:e[1],z:e[2]})}}static JSONStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,s){try{if((e==null?void 0:e.id)===(s==null?void 0:s.id))return new w(this);if((e==null?void 0:e.modelType)===m.SkyMapModel){const{refPoint:n}=(e==null?void 0:e.relativeMap)||{};if(this.hasGeo&&n){const a=A.LLHToXYZ(this,n);return this.x=a.x,this.y=a.y,this.z=a.z,this.hasXYZ=!0,this.project(t)}else throw new v(x.POINT_AND_GIS_NO_MAPPING,",没有完成gis与其他空间的映射")}else if((s==null?void 0:s.modelType)===m.SkyMapModel){const{refPoint:n}=(s==null?void 0:s.relativeMap)||{},a=this.project(t);if(a!=null&&a.hasXYZ&&n){const o=A.XYZToLLH(a,n);return a.lat=o.lat,a.lon=o.lon,a.alt=o.alt,a.hasGeo=!0,a}else throw new v(x.POINT_AND_GIS_NO_MAPPING,"没有完成gis与其他空间的映射")}else return this.project(t)}catch{}}project(t){if(this.hasXYZ){if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new v(x.POINT_NO_PLANE,"点的plane应为xz或xy")}}projectXZ(t){const e=new w(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);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);return e.x=s+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new w(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const s=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=s+t.x,e.y=n+t.y,e.z+=t.z,e}}class A{constructor(t){r(this,"lat",0);r(this,"lon",0);r(this,"alt",0);const{lat:e=0,lon:s=0,alt:n=0}=t||{};this.lat=e,this.lon=s,this.alt=n}static XYZToLLH(t,e){const n=.0033528106647474805,a=n*(2-n),o=w.toRadians(e.lat),h=6378137/Math.sqrt(1-a*Math.sin(o)**2)+e.alt;let c,d,f;if(t.plane==="xz"){const u=t.x/1e3/(h*Math.cos(o)),y=t.z/1e3/h;c=e.lon+w.toDegrees(u),d=e.lat-w.toDegrees(y),f=e.alt+t.y/1e3}else if(t.plane==="xy"){const u=t.x/1e3/(h*Math.cos(o)),y=t.y/1e3/h;c=e.lon+w.toDegrees(u),d=e.lat-w.toDegrees(y),f=e.alt+t.z/1e3}else throw new v(x.GEO_POINT_NO_PLANE,"点的plane应为xz或xy");return new A({lat:d,lon:c,alt:f})}static LLHToXYZ(t,e){const n=.0033528106647474805,a=n*(2-n),o=w.toRadians(e.lat),h=6378137/Math.sqrt(1-a*Math.sin(o)**2)+e.alt,c=w.toRadians(t.lon-e.lon),d=w.toRadians(e.lat-t.lat),f=h*c*Math.cos(o),u=h*d;if(t.plane==="xz")return new w({x:f*1e3,y:(t.alt-e.alt)*1e3,z:u*1e3,plane:"xz"});if(t.plane==="xy")return new w({x:f*1e3,y:u*1e3,z:(t.alt-e.alt)*1e3,plane:"xy"});throw new v(x.GEO_POINT_NO_PLANE,"点的plane应为xz或xy")}}class p{constructor(t){r(this,"scale",1);r(this,"yaw",0);r(this,"x",0);r(this,"y",0);r(this,"z",0);r(this,"start",0);r(this,"end",-1);r(this,"plane","xy");r(this,"refPoint");const{refPoint:e,...s}=t||{};e&&(this.refPoint=new A(e)),Object.assign(this,s)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new v(x.RELATIVE_MAP_MAPPING_SAME,"两个映射关系的plane应该相同");const s=t.scale*e.scale,n=t.yaw+e.yaw,a=Math.cos(e.yaw),o=Math.sin(e.yaw);let h=0,c=0,d=0;if(t.plane==="xz"){const f=t.x*a-t.z*o,u=t.y,y=t.x*o+t.z*a;h=e.x+f*e.scale,c=e.y+u*e.scale,d=e.z+y*e.scale}else if(t.plane==="xy"){const f=t.x*a-t.y*o,u=t.x*o+t.y*a,y=t.z;h=e.x+f*e.scale,c=e.y+u*e.scale,d=e.z+y*e.scale}else throw new v(x.RELATIVE_NO_PLANE,"映射关系的plane应为xz或xy");return new p({scale:s,yaw:n,x:h,y:c,z:d,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,s=-t.yaw,n=Math.cos(-s),a=Math.sin(-s);let o=0,h=0,c=0;if(t.plane==="xz")o=-(t.x*n+t.z*a)*e,h=-t.y*e,c=-(t.z*n-t.x*a)*e;else if(t.plane==="xy")o=-(t.x*n+t.y*a)*e,h=-(t.y*n-t.x*a)*e,c=-t.z*e;else throw new v(x.RELATIVE_NO_PLANE,"映射关系的plane应为xz或xy");return new p({scale:e,yaw:s,x:o,y:h,z:c,start:t.start,end:t.end,plane:t.plane})}static JSONParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:s}=e||{};return s&&(e={refPoint:s}),e?new p(e):void 0}catch{throw new v(x.RELATIVE_JSON_ERROR,"relativeMap格式化失败")}}static JSONStringify(t){return t?JSON.stringify(t):void 0}}class g{static async getCoordinateTree(t){const e=await U({projectId:t});if(e.length){const s=g.handleCoordinateList(e);return g.buildCoordinateTree(s,0)}}static async addCoordinate(t,e){const{projectId:s,id:n}=t,a=e.map(h=>{const{type:c,modelType:d,relativeMap:f,level:u,...y}=h,S=f?JSON.stringify(f):void 0;return{...y,projectId:s,parentId:n,coordinateType:c,renderType:d,relativePosition:S}}),o=await R(a);return g.handleCoordinateList(o)}static async removeCoordinate(t,e){const s=e.map(n=>n.id??-1);return await $(s)}static async updateCoordinate(t,e){const{projectId:s,id:n}=t,a=e.map(h=>{const{type:c,relativeMap:d,level:f,...u}=h,y=p.JSONStringify(d);return{...u,relativePosition:y,projectId:s,parentId:n}}),o=await R(a);return g.handleCoordinateList(o)}static async bindCoordinate(t,e){const{projectId:s,id:n}=t,a=e.map(h=>{const{modelId:c}=h;return{modelId:c,parentId:n,projectId:s}}),o=await B(a);return g.handleCoordinateList(o)}static handleCoordinateList(t){return t==null?void 0:t.map(e=>{const{coordinateType:s,modelKey:n,renderType:a,relativePosition:o,...h}=e,c=p.JSONParse(o);return new Q({...h,type:s,modelType:a,modelValue:n,relativeMap:c})})}static buildCoordinateTree(t,e){const s=new Map,n=[];return t.forEach(a=>{s.set(String(a.id),a)}),t.forEach(a=>{var h;const o=s.get(String(a.id));if(o)if(a.parentId===e)o.level=0,n.push(o);else{const c=s.get(String(a.parentId??-1));c&&(o.level=(Number(c.level)||0)+1,o.parent=c,(h=c.children)==null||h.push(o))}}),n.forEach(g.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,s)=>{var n,a;if(e.type===T.Space){const o=Number((n=s==null?void 0:s.relativeMap)==null?void 0:n.z)-Number((a=e==null?void 0:e.relativeMap)==null?void 0:a.z);return o!==0?o:Number(s.createTime)-Number(e.createTime)}else return e.status===0&&s.status!==0?-1:s.status===0&&e.status!==0?1:Number(s.createTime)-Number(e.createTime)}),t.children.forEach(g.sortCoordinateTree))}static filterSpaceTree(t){const e=[];return t.forEach(s=>{const n=g.filterSpaceTree(s.children);s.children=n,s.disabled=s.disabled??!1,s.type!==T.Model&&e.push(s)}),e}}class Q{constructor(t){r(this,"id",0);r(this,"type",0);r(this,"children",[]);r(this,"level");r(this,"relativeMap");r(this,"no");r(this,"name");r(this,"shortName");r(this,"status");r(this,"modelId");r(this,"modelType");r(this,"modelValue");r(this,"projectId");r(this,"parentId");r(this,"parent");r(this,"groupUuid");r(this,"z");r(this,"createTime");r(this,"disabled");const{relativeMap:e,parent:s,children:n,...a}=t||{};e&&(this.relativeMap=new p(e)),s&&(this.parent=s),n!=null&&n.length&&(this.children=n),Object.assign(this,a)}get spaceList(){return this.children.filter(t=>t.type===T.Space)}get modelList(){return this.children.filter(t=>t.type===T.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}async addChild(t){const e=O(t)?t:[t],s=await g.addCoordinate(this,e);this.mergeChild(s)}async removeChild(t){const e=O(t)?t:[t];await g.removeCoordinate(this,e);for(const s of e){const n=this.children.findIndex(a=>a.id===s.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=O(t)?t:[t],s=await g.updateCoordinate(this,e);this.mergeChild(s)}async bindChild(t){const e=O(t)?t:[t],s=await g.bindCoordinate(this,e);this.mergeChild(s)}async mergeChild(t){t!=null&&t.length&&t.forEach(e=>{const s=this.children.find(n=>n.id===e.id);if(s){const{relativeMap:n,no:a,name:o,shortName:h,status:c,modelId:d,modelValue:f}=e;Object.assign(s,{relativeMap:n,no:a,name:o,shortName:h,status:c,modelId:d,modelValue:f})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await J(t)}async fromMapping(){const t=await q({srcCsId:this.id});return t[t.length-1]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t=[m.CADModel,m.SkyMapModel],e=!0){var h,c;const s=O(t)?t:[t];if(s.includes(this.modelType??-1)&&this.status!==D.Disabled)return this;const a=[T.Data,T.Model].includes(this.type)?this.findParentSpace():this,o=(c=(h=a==null?void 0:a.modelList)==null?void 0:h.filter(d=>s.includes(d.modelType??-1)?e?!!d.relativeMap:!0:!1))==null?void 0:c.sort((d,f)=>Number(d.status)-Number(f.status));return o==null?void 0:o[0]}findLatestModel(t=m.CADModel,e){var d;const s=new Set;for(const f of e??[])s.add(String(f.id));const n=[{node:this,distance:0}],a=O(t)?t:[t],o=new Set;let h,c=1/0;for(;n.length>0;){const f=n.shift();if(!f)break;const{node:u,distance:y}=f;if(s.has(String(u.id)))continue;if(a.includes(u.modelType??-1)){if(y<c&&(h=u,c=y,y<=1))break;continue}o.add(u);const S=[];if((d=u.parent)!=null&&d.children)for(const N of u.parent.children)N!==u&&!o.has(N)&&S.push(N);if(u.children)for(const N of u.children)o.has(N)||S.push(N);u.parent&&!o.has(u.parent)&&S.push(u.parent);for(const N of S)n.push({node:N,distance:y+1})}return h}findParentSpace(){let t=this;for(;t&&t.type!==T.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let s=this;for(;s&&t>0;)s.type===T.Space&&(e.unshift(s.fullName),t--),s=s.parent;return e}findCsGroup(){var s;const{groupUuid:t,parent:e}=this;return t?((s=e==null?void 0:e.children)==null?void 0:s.filter(n=>n.groupUuid===t))||[]:[this]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const s=e.findCsByLevel(t);if(s)return s}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const s=e.findCsById(t);if(s)return s}}}getCsRoutes(t=!1){let e=this;const s=[e];for(;e!=null&&e.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&s.push(e);return s}getMappedCsTree(){function t(n){var a;return(a=n.children)!=null&&a.length&&(n.children=n.children.filter(o=>!!(o!=null&&o.relativeMap)&&o.status!==D.Disabled).map(o=>t(o))),n}const e=W(this.findRoot(!0)),s=t(e);return s.parentId=0,s.parent=void 0,s}getDestRelativeMap(t){var a;if(this.id===t.id)return new p;const e=this.getRelativeMaps(),s=t.getRelativeMaps();let n=new p;return e==null||e.forEach(o=>{n=p.addRelativeMap(n,o)}),(a=s==null?void 0:s.reverse())==null||a.forEach(o=>{n=p.addRelativeMap(n,p.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t!=null&&t.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}}class X{constructor(t){r(this,"yaw",0);r(this,"pitch",0);r(this,"roll",0);const{yaw:e=0,pitch:s=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(s)||0,this.roll=Number(n)||0}static JSONParse(t){if(t){const e=t==null?void 0:t.split(",").map(s=>Number(s)||0);return new X({yaw:e[0],pitch:e[1],roll:e[2]})}}static JSONStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class _t{constructor(t){r(this,"canvas");r(this,"ctx");r(this,"options");r(this,"offset",{x:0,y:0});r(this,"curOffset",{x:0,y:0});r(this,"mousePosition",{x:-1,y:-1});r(this,"MAX_SCALE",60);r(this,"MIN_SCALE",1);r(this,"STEP_SCALE",.5);r(this,"scale",1);r(this,"preScale",1);r(this,"width",0);r(this,"height",0);r(this,"x",0);r(this,"y",0);r(this,"timeout",0);r(this,"lastTouch");r(this,"initialDistance",0);r(this,"touchMode",0);r(this,"isMouseover",!1);r(this,"isBindEvent",!0);r(this,"isDrawAssist",!1);r(this,"customDrawAssist");r(this,"isMoveRedrawing");r(this,"afterDraw");r(this,"screenPos",{screenX:0,screenY:0});const{container:e,width:s=300,height:n=300,isBindEvent:a=!0,isDrawAssist:o=!1,isMoveRedrawing:h,customDrawAssist:c,afterDraw:d,...f}=t;this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.width=s,this.height=n,this.canvas.width=s,this.canvas.height=n,this.isBindEvent=a,this.isDrawAssist=o,this.customDrawAssist=c,this.isMoveRedrawing=h??o,this.options=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,a&&(this.canvas.addEventListener("DOMMouseScroll",this.onMousewheel),this.canvas.addEventListener("mousewheel",this.onMousewheel),this.canvas.addEventListener("mousedown",this.onMousedown),this.canvas.addEventListener("mousemove",this.onMousemove),this.canvas.addEventListener("mouseout",this.onMouseout),this.canvas.addEventListener("dblclick",this.onDblclick),this.canvas.addEventListener("touchstart",this.onTouchstart))}onClick(t){const{screenX:e,screenY:s}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:s},this.options.onClick&&(this.timeout=setTimeout(()=>{const a=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),o=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(a,o)},200))}onMouseout(t){this.isMouseover=!1,this.draw()}onTouchstart(t){t.preventDefault(),t.touches.length==1?this.touchMode===0&&(this.touchMode=1):t.touches.length>=2&&this.touchMode<2&&(this.touchMode=2),this.touchMode==1&&t.touches.length==1?this.onTouch(t.touches[0]):this.touchMode==2&&t.touches.length==2&&this.onBothTouchstart(t),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend)}onMousedown(t){this.onClick(t),this.canvas.addEventListener("mousemove",this.onMousemoveTemp),this.canvas.addEventListener("mouseup",this.onMouseup)}onBothTouchstart(t){t.preventDefault();const e={x:t.touches[0].clientX,y:t.touches[0].clientY},s={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+s.x)/2,clientY:(e.y+s.y)/2});this.x=n.x,this.y=n.y,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.initialDistance=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2))}onTouchmove(t){t.preventDefault(),this.touchMode==1&&t.touches.length==1?(this.onMousemoveTemp(t.touches[0]),this.onMousemove(t.touches[0])):this.touchMode==2&&t.touches.length==2&&this.onBothTouchmove(t)}onMousemove(t){const e=this.getPos(t);this.mousePosition.x=e.x,this.mousePosition.y=e.y,this.isMouseover=!0,this.isMoveRedrawing&&this.draw()}onMousemoveTemp(t){const{screenX:e,screenY:s}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(s-t.screenY)>10)&&(this.timeout&&clearTimeout(this.timeout),this.offset.x=this.curOffset.x+(this.mousePosition.x-this.x),this.offset.y=this.curOffset.y+(this.mousePosition.y-this.y),!this.isMoveRedrawing&&this.draw())}onBothTouchmove(t){if(t.preventDefault(),this.initialDistance){const e={x:t.touches[0].clientX,y:t.touches[0].clientY},s={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2));if(this.scale+=(n-this.initialDistance)/30*this.STEP_SCALE,this.initialDistance=n,this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}}onTouchend(){this.touchMode=0,this.onMouseup()}onMouseup(){this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.canvas.removeEventListener("mousemove",this.onMousemoveTemp),this.canvas.removeEventListener("mouseup",this.onMouseup),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend)}onMousewheel(t){this.timeout&&clearTimeout(this.timeout),t.preventDefault();const e=this.getPos(t);this.x=e.x,this.y=e.y;const s=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+s).toFixed(2)),this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}onTouch(t){const e=Date.now(),{lastTouchTime:s=0,lastTouchX:n=0,lastTouchY:a=0}=this.lastTouch||{};e-s<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-a)<30?(this.onDblclick(t),this.lastTouch={lastTouchTime:0,lastTouchX:0,lastTouchY:0}):(this.onClick(t),this.lastTouch={lastTouchTime:e,lastTouchX:t.clientX,lastTouchY:t.clientY})}onDblclick(t){this.timeout&&clearTimeout(this.timeout),this.reset(),this.draw()}zoom(){this.offset.x=this.x-(this.x-this.offset.x)*this.scale/this.preScale,this.offset.y=this.y-(this.y-this.offset.y)*this.scale/this.preScale,this.draw(),this.preScale=this.scale,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y}reset(t){const{width:e=this.width,height:s=this.height,scale:n=1,preScale:a=1,offset:o={x:0,y:0},curOffset:h={x:0,y:0}}=t||{};this.width=e,this.height=s,this.canvas.width=e,this.canvas.height=s,this.scale=n,this.preScale=a,this.offset=o,this.curOffset=h}drawAssist(){const t=this.ctx;t.save(),t.beginPath(),t.lineWidth=1,t.strokeStyle="#C656D5",t.moveTo(0,this.mousePosition.y),t.lineTo(this.width,this.mousePosition.y),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(this.mousePosition.x,0),t.lineTo(this.mousePosition.x,this.height),t.closePath(),t.stroke(),t.restore()}draw(){var t;this.ctx.clearRect(0,0,this.width,this.height),this.ctx.save(),this.ctx.translate(this.offset.x,this.offset.y),this.ctx.scale(this.scale,this.scale),this.options.draw(this.ctx,this),this.ctx.restore(),this.isDrawAssist&&this.isMouseover&&(this.customDrawAssist?this.customDrawAssist():this.drawAssist()),(t=this.afterDraw)==null||t.call(this,this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let s=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return s=s<0?0:s,n=n<0?0:n,{x:s,y:n}}unBindEvent(){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))}}const K={};class zt{constructor(t){r(this,"type","image");r(this,"x");r(this,"y");r(this,"width");r(this,"height");r(this,"img");r(this,"src");r(this,"redraw");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)}loadImage(t){const e=K[this.src];if(e)return queueMicrotask(()=>{var s;t==null||t(e),(s=this.redraw)==null||s.call(this)}),e;{const s=new Image;return s.crossOrigin="anonymous",s.src=this.src,s.onload=()=>{var n;K[this.src]=s,t==null||t(s),(n=this.redraw)==null||n.call(this)},s}}draw(t){try{if(!this.img.complete)return;t.save(),t.drawImage(this.img,this.x,this.y,this.width,this.height),t.restore()}catch(e){console.error(e)}}}class Rt{constructor(t){r(this,"id","");r(this,"type","point");r(this,"x");r(this,"y");r(this,"r");r(this,"text");r(this,"backgroundColor");r(this,"index");r(this,"pIndex");r(this,"parentId");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)"}draw(t,e){t.save();const s=1/e.scale;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()}}const tt={};class Ct{constructor(t){r(this,"id","");r(this,"type","issue");r(this,"x");r(this,"y");r(this,"width");r(this,"height");r(this,"src");r(this,"img");r(this,"index");r(this,"pIndex");r(this,"parentId");r(this,"count");r(this,"badgeR");r(this,"redraw");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)}loadImage(t){const e=tt[this.src];if(e)return queueMicrotask(()=>{var s;t==null||t(e),(s=this.redraw)==null||s.call(this)}),e;{const s=new Image;return s.src=this.src,s.crossOrigin="anonymous",s.onload=()=>{var n;tt[this.src]=s,t==null||t(s),(n=this.redraw)==null||n.call(this)},s}}draw(t,e){if(!this.img.complete)return;const s=1/e.scale,n=this.width*s,a=this.height*s,o=this.x-n/2,h=this.y-a,c=this.badgeR*s,d=c*1.5;t.save(),t.drawImage(this.img,o,h,n,a),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-a*.8,c,0,2*Math.PI),t.fillStyle="red",t.fill(),t.font=`${d}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.count.toString(),this.x+n*.3,this.y-a*.8+c/2)),t.restore()}}const et={};class jt{constructor(t){r(this,"type","marker");r(this,"x");r(this,"y");r(this,"url");r(this,"width");r(this,"height");r(this,"anchor");r(this,"img");r(this,"scale");r(this,"redraw");r(this,"beforeDraw");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)}loadImage(t){const e=et[this.url];if(e)return queueMicrotask(()=>{var s;t==null||t(e),(s=this.redraw)==null||s.call(this)}),e;{const s=new Image;return s.src=this.url,s.crossOrigin="anonymous",s.onload=()=>{var n;et[this.url]=s,t==null||t(s),(n=this.redraw)==null||n.call(this)},s}}calculateIconPosition(){var s,n;const t=((s=this.anchor)==null?void 0:s.x)??this.width/2,e=((n=this.anchor)==null?void 0:n.y)??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){var a,o;if((a=this.beforeDraw)==null||a.call(this,t,e),!((o=this.img)!=null&&o.complete))return;const{iconStartX:s,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,s,n,this.width*this.scale,this.height*this.scale)}catch(h){console.error("绘制标记时出错:",h)}finally{t.restore()}}}class kt{constructor(t){r(this,"type","radar");r(this,"x");r(this,"y");r(this,"r");r(this,"angle");r(this,"text");r(this,"hFov",90);r(this,"beforeDraw");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}draw(t,e){var h;(h=this.beforeDraw)==null||h.call(this,t,e);const s=1/e.scale,[n,a]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const o=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*s);o.addColorStop(0,"rgba(180, 42, 42, 1)"),o.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*s,n,a),t.closePath(),t.fillStyle=o,t.fill(),t.restore()}}class Xt{constructor(t){r(this,"type","region");r(this,"x");r(this,"y");r(this,"shape");r(this,"areaPoints");r(this,"backgroundColor");if(this.x=t.x,this.y=t.y,this.shape=t.shape||"",this.backgroundColor=t.backgroundColor,t.areaPoints.length===2){const[{x:e,y:s},{},{x:n,y:a}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(s,a)},{x:Math.max(e,n),y:Math.min(s,a)},{x:Math.max(e,n),y:Math.max(s,a)},{x:Math.min(e,n),y:Math.max(s,a)}]}else this.areaPoints=t.areaPoints}draw(t,e){if(t.save(),t.beginPath(),t.globalAlpha=.3,t.fillStyle=this.backgroundColor,this.shape==="circle"){const[{x:s,y:n},{},{x:a,y:o}]=this.areaPoints,h=Math.abs(a-s)/2,c=s+(a-s)/2,d=n+(o-n)/2;t.arc(c,d,h,0,2*Math.PI)}else this.areaPoints.forEach((s,n)=>{const{x:a,y:o}=s;n===0?t.moveTo(a,o):t.lineTo(a,o)});t.fill(),t.restore()}}l.AppError=v,l.AppErrorCode=x,l.AppObsType=F,l.CanvasElement=_t,l.CanvasImageElement=zt,l.CanvasIssueElement=Ct,l.CanvasMarkerElement=jt,l.CanvasPointElement=Rt,l.CanvasRadarElement=kt,l.CanvasRegionElement=Xt,l.Coordinate=Q,l.CoordinateLevel=P,l.CoordinateModelType=m,l.CoordinateStatus=D,l.CoordinateType=T,l.DEFAULT_APP_SETTING=G,l.DataSource=g,l.GeoPoint=A,l.Point=w,l.Position=X,l.RelativeMap=p,l.RequestContentType=_,l.RequestMethod=M,l.RequestResultCode=z,l.api=lt,l.http=ht,l.utils=Dt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.Shared={}))})(this,function(l){"use strict";var Ft=Object.defineProperty;var Gt=(l,m,N)=>m in l?Ft(l,m,{enumerable:!0,configurable:!0,writable:!0,value:N}):l[m]=N;var a=(l,m,N)=>Gt(l,typeof m!="symbol"?m+"":m,N);var m=(i=>(i[i.CADModel=5]="CADModel",i[i.BimfaceModel=6]="BimfaceModel",i[i.ForgeModel=7]="ForgeModel",i[i.ThreeDModel=8]="ThreeDModel",i[i.SkyMapModel=9]="SkyMapModel",i[i.ScaleModel=10]="ScaleModel",i))(m||{}),N=(i=>(i[i.Global=0]="Global",i))(N||{}),T=(i=>(i[i.Space=0]="Space",i[i.Model=1]="Model",i[i.Data=2]="Data",i))(T||{}),D=(i=>(i[i.Used=0]="Used",i[i.Enabled=1]="Enabled",i[i.Disabled=2]="Disabled",i))(D||{}),_=(i=>(i[i.SUCCESS=200]="SUCCESS",i[i.ERROR=-1]="ERROR",i[i.TIMEOUT=401]="TIMEOUT",i))(_||{}),p=(i=>(i.GET="GET",i.POST="POST",i))(p||{}),z=(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))(z||{}),F=(i=>(i.Hw="huawei",i.Ali="aliyun",i.Hs="hs",i.Aws="amazon",i.Minio="minio",i))(F||{}),x=(i=>(i[i.GEO_POINT_NO_PLANE=9e3]="GEO_POINT_NO_PLANE",i[i.POINT_AND_GIS_NO_MAPPING=9010]="POINT_AND_GIS_NO_MAPPING",i[i.POINT_NO_PLANE=9011]="POINT_NO_PLANE",i[i.RELATIVE_MAP_MAPPING_SAME=9020]="RELATIVE_MAP_MAPPING_SAME",i[i.RELATIVE_NO_PLANE=9021]="RELATIVE_NO_PLANE",i[i.RELATIVE_JSON_ERROR=9022]="RELATIVE_JSON_ERROR",i))(x||{});const G={baseUrl:"https://vsleem.com/api",obsType:"hs"},st={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},it={url:"",method:p.GET,headers:{}},Y={...G};function nt(i){Object.assign(Y,i)}async function E(i,t){const e={...st,...t},s={...it,...i};try{const n=at(s,e),{url:r,...o}=n,c=await(await window.fetch(r,o)).json();return rt(c,e)}catch(n){return ot(n)}}function at(i,t){const{baseUrl:e,authorizeCode:s}=Y,{joinBaseUrl:n}=t;let{url:r,method:o,headers:h={},params:c,data:u}=i;n&&e&&(r=`${e}${r}`),o=o==null?void 0:o.toUpperCase();const f={...h};if(o===p.GET&&c){const y=new URLSearchParams(c);r+=`?${y.toString()}`}let d;return o===p.POST&&(d=f["Content-Type"]===z.JSON?JSON.stringify(u||{}):u),{url:r,method:o,headers:f,body:d}}function rt(i,t){if(!t.isTransformResponse)return i;if(!i)throw new Error("Request no return data!");const{code:e,data:s,msg:n}=i;if(e===_.SUCCESS)return s;throw new Error(n||"Request error!")}function ot(i){throw i instanceof Error?i:new Error(typeof i=="string"?i:"Unknown request error")}const ht=Object.freeze(Object.defineProperty({__proto__:null,request:E,setRequestGlobalConfig:nt},Symbol.toStringTag,{value:"Module"}));function B(i,t){return E({url:"/project/jssdk/cs/list",method:p.GET,params:i},t)}function U(i,t){return E({url:"/project/jssdk/cs/bind",method:p.POST,data:i},t)}function R(i,t){return E({url:"/project/jssdk/cs/save",method:p.POST,data:i},t)}function $(i,t){return E({url:"/project/jssdk/cs/delete",method:p.POST,data:i},t)}function J(i,t){return E({url:"/project/jssdk/cs/mapping",method:p.POST,data:i},t)}function q(i,t){return E({url:"/project/jssdk/cs/mapping/query",method:p.GET,params:i},t)}function ct(i,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return E({url:i,method:p.GET},t)}const lt=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:U,getCoordinateList:B,getImageInfo:ct,getMappingRelation:q,mapingCoordinate:J,removeCoordinate:$,saveCoordinate:R},Symbol.toStringTag,{value:"Module"})),ut=typeof window<"u",dt=Object.prototype.toString;function b(i,t){return dt.call(i)===`[object ${t}]`}function V(i){return typeof i<"u"}function Z(i){return!V(i)}function C(i){return i!==null&&b(i,"Object")}function H(i){return i===null}function ft(i){return b(i,"Date")}function mt(i){return b(i,"String")}function j(i){return typeof i=="function"}function yt(i){return b(i,"Boolean")}function wt(i){return b(i,"RegExp")}function P(i){return i&&Array.isArray(i)}function gt(i){return typeof window<"u"&&b(i,"Window")}function Mt(i){return C(i)&&!!i.tagName}function pt(i){return typeof i=="number"||/^\d+(\.\d+)?$/.test(i)}function L(i){return b(Number(i),"Number")}function vt(i,t){return JSON.stringify(i)===JSON.stringify(t)}function xt(i){return Z(i)||H(i)}function Tt(i){return b(i,"Promise")&&C(i)&&j(i.then)&&j(i.catch)}function W(i){return O(i,new WeakMap)}function O(i,t){if(typeof i!="object"||i===null)return i;if(t.has(i))return t.get(i);let e;if(i instanceof Date)return e=new Date(i),t.set(i,e),e;if(i instanceof RegExp)return e=new RegExp(i),t.set(i,e),e;if(i instanceof Map)return e=new Map,t.set(i,e),i.forEach((n,r)=>{e.set(r,O(n,t))}),e;if(i instanceof Set)return e=new Set,t.set(i,e),i.forEach(n=>{e.add(O(n,t))}),e;if(ArrayBuffer.isView(i))return e=new i.constructor(i.buffer.slice(0),i.byteOffset,i.byteLength),t.set(i,e),e;if(i instanceof ArrayBuffer)return e=i.slice(0),t.set(i,e),e;if(Array.isArray(i)){e=[],t.set(i,e);for(let n=0;n<i.length;n++)n in i&&(e[n]=O(i[n],t));return e}e=Object.create(Object.getPrototypeOf(i)),t.set(i,e);for(const n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=O(i[n],t));const s=Object.getOwnPropertySymbols(i);for(const n of s)Object.prototype.propertyIsEnumerable.call(i,n)&&(e[n]=O(i[n],t));return e}function bt(i,t,e=!1){let s;const n=function(...r){const o=this,h=e&&!s;s&&clearTimeout(s),s=setTimeout(()=>{s=void 0,e||i.apply(o,r)},t),h&&i.apply(o,r)};return n.cancel=()=>{s&&clearTimeout(s),s=void 0},n}function Et(i,t,e=!1){let s,n;const r=function(...o){const h=this;n?(clearTimeout(s),s=setTimeout(()=>{Date.now()-n>=t&&(i.apply(h,o),n=Date.now())},t-(Date.now()-n))):(e&&i.apply(h,o),n=Date.now())};return r.cancel=()=>{clearTimeout(s),s=void 0,n=void 0},r}function St(i,t={}){return new Promise((e,s)=>{const n=k(i);if(Nt(n)){e(!0);return}const r=document.createElement("script");r.src=i,Object.entries(t).forEach(([o,h])=>{h!==!1&&r.setAttribute(o,h===!0?"":String(h))}),r.onload=()=>{e(!0)},r.onerror=()=>{document.head.removeChild(r),s(new Error(`Failed to load script: ${i}`))},document.head.appendChild(r)})}function Nt(i){const t=k(i);return Array.from(document.scripts).some(e=>k(e.src)===t)}function k(i){try{const t=new URL(i,window.location.href);return`${t.origin}${t.pathname}`}catch{return i}}function Pt(i,t,e,s){const n=Math.min(i/e,t/s),r=e*n,o=s*n;return{scale:n,x:(i-r)/2,y:(t-o)/2,sw:r,sh:o}}function Ot(i,t,e){return{x:i*e.scale+e.x,y:t*e.scale+e.y}}function It(i,t,e){return{x:(i-e.x)/e.scale,y:(t-e.y)/e.scale}}function At(i){console.warn(`[warn]:${i}`)}function Lt(i){throw new Error(`[error]:${i}`)}const Dt=Object.freeze(Object.defineProperty({__proto__:null,cloneDeep:W,debounce:bt,error:Lt,getImageTransform:Pt,inBrowser:ut,is:b,isArray:P,isBoolean:yt,isDate:ft,isDef:V,isElement:Mt,isFunction:j,isNull:H,isNullOrUnDef:xt,isNumber:L,isNumeric:pt,isObject:C,isPromise:Tt,isRegExp:wt,isSameValue:vt,isString:mt,isUnDef:Z,isWindow:gt,loadScript:St,throttle:Et,toCanvasCoord:Ot,toModelCoord:It,warn:At},Symbol.toStringTag,{value:"Module"}));class v extends Error{constructor(t,e,s){super(e),this.code=t,this.message=e,this.details=s,this.name="Apprror",Object.setPrototypeOf(this,v.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}class w{constructor(t){a(this,"x",0);a(this,"y",0);a(this,"z",0);a(this,"lat",0);a(this,"lon",0);a(this,"alt",0);a(this,"yaw",0);a(this,"pitch",0);a(this,"roll",0);a(this,"hasXYZ",!1);a(this,"hasGeo",!1);a(this,"hasAngle",!1);a(this,"plane","xy");const{x:e,y:s,z:n,lat:r,lon:o,alt:h,yaw:c,pitch:u,roll:f,plane:d="xy"}=t||{};L(e)&&L(s)&&(this.x=Number(e)||0,this.y=Number(s)||0,this.z=Number(n)||0,this.plane=d,this.hasXYZ=!0),L(r)&&L(o)&&Number(r)!==0&&Number(o)!==0&&(this.lat=Number(r)||0,this.lon=Number(o)||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)}static dist(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2+(t.z-e.z)**2)}static distXZ(t,e){return Math.sqrt((t.x-e.x)**2+(t.z-e.z)**2)}static distXY(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,s){const n={x:t.x-e.x,z:t.z-e.z},r={x:s.x-e.x,z:s.z-e.z},o=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,o/(h*c))),d=Math.acos(u)*180/Math.PI;return Math.min(d,360-d)}static JSONParse(t){if(t){const e=t==null?void 0:t.split(",").map(s=>Number(s)||0);return new w({x:e[0],y:e[1],z:e[2]})}}static JSONStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,s){try{if((e==null?void 0:e.id)===(s==null?void 0:s.id))return new w(this);if((e==null?void 0:e.modelType)===m.SkyMapModel){const{refPoint:n}=(e==null?void 0:e.relativeMap)||{};if(this.hasGeo&&n){const r=I.LLHToXYZ(this,n);return this.x=r.x,this.y=r.y,this.z=r.z,this.hasXYZ=!0,this.project(t)}else throw new v(x.POINT_AND_GIS_NO_MAPPING,",没有完成gis与其他空间的映射")}else if((s==null?void 0:s.modelType)===m.SkyMapModel){const{refPoint:n}=(s==null?void 0:s.relativeMap)||{},r=this.project(t);if(r!=null&&r.hasXYZ&&n){const o=I.XYZToLLH(r,n);return r.lat=o.lat,r.lon=o.lon,r.alt=o.alt,r.hasGeo=!0,r}else throw new v(x.POINT_AND_GIS_NO_MAPPING,"没有完成gis与其他空间的映射")}else return this.project(t)}catch{}}project(t){if(this.hasXYZ){if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new v(x.POINT_NO_PLANE,"点的plane应为xz或xy")}}projectXZ(t){const e=new w(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);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);return e.x=s+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new w(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const s=e.x*Math.cos(t.yaw)-e.y*Math.sin(t.yaw),n=e.x*Math.sin(t.yaw)+e.y*Math.cos(t.yaw);return e.x=s+t.x,e.y=n+t.y,e.z+=t.z,e}}class I{constructor(t){a(this,"lat",0);a(this,"lon",0);a(this,"alt",0);const{lat:e=0,lon:s=0,alt:n=0}=t||{};this.lat=e,this.lon=s,this.alt=n}static XYZToLLH(t,e){const n=.0033528106647474805,r=n*(2-n),o=w.toRadians(e.lat),h=6378137/Math.sqrt(1-r*Math.sin(o)**2)+e.alt;let c,u,f;if(t.plane==="xz"){const d=t.x/1e3/(h*Math.cos(o)),y=t.z/1e3/h;c=e.lon+w.toDegrees(d),u=e.lat-w.toDegrees(y),f=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(h*Math.cos(o)),y=t.y/1e3/h;c=e.lon+w.toDegrees(d),u=e.lat-w.toDegrees(y),f=e.alt+t.z/1e3}else throw new v(x.GEO_POINT_NO_PLANE,"点的plane应为xz或xy");return new I({lat:u,lon:c,alt:f})}static LLHToXYZ(t,e){const n=.0033528106647474805,r=n*(2-n),o=w.toRadians(e.lat),h=6378137/Math.sqrt(1-r*Math.sin(o)**2)+e.alt,c=w.toRadians(t.lon-e.lon),u=w.toRadians(e.lat-t.lat),f=h*c*Math.cos(o),d=h*u;if(t.plane==="xz")return new w({x:f*1e3,y:(t.alt-e.alt)*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new w({x:f*1e3,y:d*1e3,z:(t.alt-e.alt)*1e3,plane:"xy"});throw new v(x.GEO_POINT_NO_PLANE,"点的plane应为xz或xy")}}class M{constructor(t){a(this,"scale",1);a(this,"yaw",0);a(this,"x",0);a(this,"y",0);a(this,"z",0);a(this,"start",0);a(this,"end",-1);a(this,"plane","xy");a(this,"refPoint");const{refPoint:e,...s}=t||{};e&&(this.refPoint=new I(e)),Object.assign(this,s)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new v(x.RELATIVE_MAP_MAPPING_SAME,"两个映射关系的plane应该相同");const s=t.scale*e.scale,n=t.yaw+e.yaw,r=Math.cos(e.yaw),o=Math.sin(e.yaw);let h=0,c=0,u=0;if(t.plane==="xz"){const f=t.x*r-t.z*o,d=t.y,y=t.x*o+t.z*r;h=e.x+f*e.scale,c=e.y+d*e.scale,u=e.z+y*e.scale}else if(t.plane==="xy"){const f=t.x*r-t.y*o,d=t.x*o+t.y*r,y=t.z;h=e.x+f*e.scale,c=e.y+d*e.scale,u=e.z+y*e.scale}else throw new v(x.RELATIVE_NO_PLANE,"映射关系的plane应为xz或xy");return new M({scale:s,yaw:n,x:h,y:c,z:u,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,s=-t.yaw,n=Math.cos(-s),r=Math.sin(-s);let o=0,h=0,c=0;if(t.plane==="xz")o=-(t.x*n+t.z*r)*e,h=-t.y*e,c=-(t.z*n-t.x*r)*e;else if(t.plane==="xy")o=-(t.x*n+t.y*r)*e,h=-(t.y*n-t.x*r)*e,c=-t.z*e;else throw new v(x.RELATIVE_NO_PLANE,"映射关系的plane应为xz或xy");return new M({scale:e,yaw:s,x:o,y:h,z:c,start:t.start,end:t.end,plane:t.plane})}static JSONParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:s}=e||{};return s&&(e={refPoint:s}),e?new M(e):void 0}catch{throw new v(x.RELATIVE_JSON_ERROR,"relativeMap格式化失败")}}static JSONStringify(t){return t?JSON.stringify(t):void 0}}class g{static async getCoordinateTree(t){const e=await B({projectId:t});if(e.length){const s=g.handleCoordinateList(e);return g.buildCoordinateTree(s,0)}}static async addCoordinate(t,e){const{projectId:s,id:n}=t,r=e.map(h=>{const{type:c,modelType:u,relativeMap:f,level:d,...y}=h,A=f?JSON.stringify(f):void 0;return{...y,projectId:s,parentId:n,coordinateType:c,renderType:u,relativePosition:A}}),o=await R(r);return g.handleCoordinateList(o)}static async removeCoordinate(t,e){const s=e.map(n=>n.id??-1);return await $(s)}static async updateCoordinate(t,e){const{projectId:s,id:n}=t,r=e.map(h=>{const{type:c,relativeMap:u,level:f,...d}=h,y=M.JSONStringify(u);return{...d,relativePosition:y,projectId:s,parentId:n}}),o=await R(r);return g.handleCoordinateList(o)}static async bindCoordinate(t,e){const{projectId:s,id:n}=t,r=e.map(h=>{const{modelId:c}=h;return{modelId:c,parentId:n,projectId:s}}),o=await U(r);return g.handleCoordinateList(o)}static handleCoordinateList(t){return t==null?void 0:t.map(e=>{const{coordinateType:s,modelKey:n,renderType:r,relativePosition:o,...h}=e,c=M.JSONParse(o);return new Q({...h,type:s,modelType:r,modelValue:n,relativeMap:c})})}static buildCoordinateTree(t,e){const s=new Map,n=[];return t.forEach(r=>{s.set(String(r.id),r)}),t.forEach(r=>{var h;const o=s.get(String(r.id));if(o)if(r.parentId===e)o.level=0,n.push(o);else{const c=s.get(String(r.parentId??-1));c&&(o.level=(Number(c.level)||0)+1,o.parent=c,(h=c.children)==null||h.push(o))}}),n.forEach(g.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,s)=>{var n,r;if(e.type===T.Space){const o=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);return o!==0?o:Number(s.createTime)-Number(e.createTime)}else return e.status===0&&s.status!==0?-1:s.status===0&&e.status!==0?1:Number(s.createTime)-Number(e.createTime)}),t.children.forEach(g.sortCoordinateTree))}static filterSpaceTree(t){const e=[];return t.forEach(s=>{const n=g.filterSpaceTree(s.children);s.children=n,s.disabled=s.disabled??!1,s.type!==T.Model&&e.push(s)}),e}}class Q{constructor(t){a(this,"id",0);a(this,"type",0);a(this,"children",[]);a(this,"level");a(this,"relativeMap");a(this,"no");a(this,"name");a(this,"shortName");a(this,"status");a(this,"modelId");a(this,"modelType");a(this,"modelValue");a(this,"projectId");a(this,"parentId");a(this,"parent");a(this,"groupUuid");a(this,"z");a(this,"createTime");a(this,"disabled");const{relativeMap:e,parent:s,children:n,...r}=t||{};e&&(this.relativeMap=new M(e)),s&&(this.parent=s),n!=null&&n.length&&(this.children=n),Object.assign(this,r)}get spaceList(){return this.children.filter(t=>t.type===T.Space)}get modelList(){return this.children.filter(t=>t.type===T.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}async addChild(t){const e=P(t)?t:[t],s=await g.addCoordinate(this,e);this.mergeChild(s)}async removeChild(t){const e=P(t)?t:[t];await g.removeCoordinate(this,e);for(const s of e){const n=this.children.findIndex(r=>r.id===s.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=P(t)?t:[t],s=await g.updateCoordinate(this,e);this.mergeChild(s)}async bindChild(t){const e=P(t)?t:[t],s=await g.bindCoordinate(this,e);this.mergeChild(s)}async mergeChild(t){t!=null&&t.length&&t.forEach(e=>{const s=this.children.find(n=>n.id===e.id);if(s){const{relativeMap:n,no:r,name:o,shortName:h,status:c,modelId:u,modelValue:f}=e;Object.assign(s,{relativeMap:n,no:r,name:o,shortName:h,status:c,modelId:u,modelValue:f})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await J(t)}async fromMapping(){const t=await q({srcCsId:this.id});return t[t.length-1]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t=[m.CADModel,m.SkyMapModel],e=!0){var h,c;const s=P(t)?t:[t];if(s.includes(this.modelType??-1)&&this.status!==D.Disabled)return this;const r=[T.Data,T.Model].includes(this.type)?this.findParentSpace():this,o=(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));return o==null?void 0:o[0]}findLatestModel(t=m.CADModel,e){var u;const s=new Set;for(const f of e??[])s.add(String(f.id));const n=[{node:this,distance:0}],r=P(t)?t:[t],o=new Set;let h,c=1/0;for(;n.length>0;){const f=n.shift();if(!f)break;const{node:d,distance:y}=f;if(s.has(String(d.id)))continue;if(r.includes(d.modelType??-1)){if(y<c&&(h=d,c=y,y<=1))break;continue}o.add(d);const A=[];if((u=d.parent)!=null&&u.children)for(const S of d.parent.children)S!==d&&!o.has(S)&&A.push(S);if(d.children)for(const S of d.children)o.has(S)||A.push(S);d.parent&&!o.has(d.parent)&&A.push(d.parent);for(const S of A)n.push({node:S,distance:y+1})}return h}findParentSpace(){let t=this;for(;t&&t.type!==T.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let s=this;for(;s&&t>0;)s.type===T.Space&&(e.unshift(s.fullName),t--),s=s.parent;return e}findCsGroup(){var s;const{groupUuid:t,parent:e}=this;return t?((s=e==null?void 0:e.children)==null?void 0:s.filter(n=>n.groupUuid===t))||[]:[this]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const s=e.findCsByLevel(t);if(s)return s}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const s=e.findCsById(t);if(s)return s}}}getCsRoutes(t=!1){let e=this;const s=[e];for(;e!=null&&e.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&s.push(e);return s}getMappedCsTree(){function t(n){var r;return(r=n.children)!=null&&r.length&&(n.children=n.children.filter(o=>!!(o!=null&&o.relativeMap)&&o.status!==D.Disabled).map(o=>t(o))),n}const e=W(this.findRoot(!0)),s=t(e);return s.parentId=0,s.parent=void 0,s}getDestRelativeMap(t){var r;if(this.id===t.id)return new M;const e=this.getRelativeMaps(),s=t.getRelativeMaps();let n=new M;return e==null||e.forEach(o=>{n=M.addRelativeMap(n,o)}),(r=s==null?void 0:s.reverse())==null||r.forEach(o=>{n=M.addRelativeMap(n,M.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t!=null&&t.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}}class X{constructor(t){a(this,"yaw",0);a(this,"pitch",0);a(this,"roll",0);const{yaw:e=0,pitch:s=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(s)||0,this.roll=Number(n)||0}static JSONParse(t){if(t){const e=t==null?void 0:t.split(",").map(s=>Number(s)||0);return new X({yaw:e[0],pitch:e[1],roll:e[2]})}}static JSONStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class _t{constructor(t){a(this,"canvas");a(this,"ctx");a(this,"options");a(this,"offset",{x:0,y:0});a(this,"curOffset",{x:0,y:0});a(this,"mousePosition",{x:-1,y:-1});a(this,"MAX_SCALE",60);a(this,"MIN_SCALE",1);a(this,"STEP_SCALE",.5);a(this,"scale",1);a(this,"preScale",1);a(this,"width",0);a(this,"height",0);a(this,"x",0);a(this,"y",0);a(this,"timeout",0);a(this,"lastTouch");a(this,"initialDistance",0);a(this,"touchMode",0);a(this,"isMouseover",!1);a(this,"isBindEvent",!0);a(this,"isDrawAssist",!1);a(this,"customDrawAssist");a(this,"isMoveRedrawing");a(this,"afterDraw");a(this,"screenPos",{screenX:0,screenY:0});const{container:e,width:s=300,height:n=300,isBindEvent:r=!0,isDrawAssist:o=!1,isMoveRedrawing:h,customDrawAssist:c,afterDraw:u,...f}=t;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=o,this.customDrawAssist=c,this.isMoveRedrawing=h??o,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))}onClick(t){const{screenX:e,screenY:s}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:s},this.options.onClick&&(this.timeout=setTimeout(()=>{const r=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),o=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(r,o)},200))}onMouseout(t){this.isMouseover=!1,this.draw()}onTouchstart(t){t.preventDefault(),t.touches.length==1?this.touchMode===0&&(this.touchMode=1):t.touches.length>=2&&this.touchMode<2&&(this.touchMode=2),this.touchMode==1&&t.touches.length==1?this.onTouch(t.touches[0]):this.touchMode==2&&t.touches.length==2&&this.onBothTouchstart(t),this.canvas.addEventListener("touchmove",this.onTouchmove),this.canvas.addEventListener("touchend",this.onTouchend)}onMousedown(t){this.onClick(t),this.canvas.addEventListener("mousemove",this.onMousemoveTemp),this.canvas.addEventListener("mouseup",this.onMouseup)}onBothTouchstart(t){t.preventDefault();const e={x:t.touches[0].clientX,y:t.touches[0].clientY},s={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+s.x)/2,clientY:(e.y+s.y)/2});this.x=n.x,this.y=n.y,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.initialDistance=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2))}onTouchmove(t){t.preventDefault(),this.touchMode==1&&t.touches.length==1?(this.onMousemoveTemp(t.touches[0]),this.onMousemove(t.touches[0])):this.touchMode==2&&t.touches.length==2&&this.onBothTouchmove(t)}onMousemove(t){const e=this.getPos(t);this.mousePosition.x=e.x,this.mousePosition.y=e.y,this.isMouseover=!0,this.isMoveRedrawing&&this.draw()}onMousemoveTemp(t){const{screenX:e,screenY:s}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(s-t.screenY)>10)&&(this.timeout&&clearTimeout(this.timeout),this.offset.x=this.curOffset.x+(this.mousePosition.x-this.x),this.offset.y=this.curOffset.y+(this.mousePosition.y-this.y),!this.isMoveRedrawing&&this.draw())}onBothTouchmove(t){if(t.preventDefault(),this.initialDistance){const e={x:t.touches[0].clientX,y:t.touches[0].clientY},s={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2));if(this.scale+=(n-this.initialDistance)/30*this.STEP_SCALE,this.initialDistance=n,this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}}onTouchend(){this.touchMode=0,this.onMouseup()}onMouseup(){this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y,this.canvas.removeEventListener("mousemove",this.onMousemoveTemp),this.canvas.removeEventListener("mouseup",this.onMouseup),this.canvas.removeEventListener("touchmove",this.onTouchmove),this.canvas.removeEventListener("touchend",this.onTouchend)}onMousewheel(t){this.timeout&&clearTimeout(this.timeout),t.preventDefault();const e=this.getPos(t);this.x=e.x,this.y=e.y;const s=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+s).toFixed(2)),this.scale>this.MAX_SCALE){this.scale=this.MAX_SCALE;return}if(this.scale<this.MIN_SCALE){this.scale=this.MIN_SCALE;return}this.zoom()}onTouch(t){const e=Date.now(),{lastTouchTime:s=0,lastTouchX:n=0,lastTouchY:r=0}=this.lastTouch||{};e-s<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-r)<30?(this.onDblclick(t),this.lastTouch={lastTouchTime:0,lastTouchX:0,lastTouchY:0}):(this.onClick(t),this.lastTouch={lastTouchTime:e,lastTouchX:t.clientX,lastTouchY:t.clientY})}onDblclick(t){this.timeout&&clearTimeout(this.timeout),this.reset(),this.draw()}zoom(){this.offset.x=this.x-(this.x-this.offset.x)*this.scale/this.preScale,this.offset.y=this.y-(this.y-this.offset.y)*this.scale/this.preScale,this.draw(),this.preScale=this.scale,this.curOffset.x=this.offset.x,this.curOffset.y=this.offset.y}reset(t){const{width:e=this.width,height:s=this.height,scale:n=1,preScale:r=1,offset:o={x:0,y:0},curOffset:h={x:0,y:0}}=t||{};this.width=e,this.height=s,this.canvas.width=e,this.canvas.height=s,this.scale=n,this.preScale=r,this.offset=o,this.curOffset=h}drawAssist(){const t=this.ctx;t.save(),t.beginPath(),t.lineWidth=1,t.strokeStyle="#C656D5",t.moveTo(0,this.mousePosition.y),t.lineTo(this.width,this.mousePosition.y),t.closePath(),t.stroke(),t.beginPath(),t.moveTo(this.mousePosition.x,0),t.lineTo(this.mousePosition.x,this.height),t.closePath(),t.stroke(),t.restore()}draw(){var t;this.ctx.clearRect(0,0,this.width,this.height),this.ctx.save(),this.ctx.translate(this.offset.x,this.offset.y),this.ctx.scale(this.scale,this.scale),this.options.draw(this.ctx,this),this.ctx.restore(),this.isDrawAssist&&this.isMouseover&&(this.customDrawAssist?this.customDrawAssist():this.drawAssist()),(t=this.afterDraw)==null||t.call(this,this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let s=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return s=s<0?0:s,n=n<0?0:n,{x:s,y:n}}unBindEvent(){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))}}const K={};class zt{constructor(t){a(this,"type","image");a(this,"x");a(this,"y");a(this,"width");a(this,"height");a(this,"img");a(this,"src");a(this,"redraw");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)}loadImage(t){const e=K[this.src];if(e)return queueMicrotask(()=>{var s;t==null||t(e),(s=this.redraw)==null||s.call(this)}),e;{const s=new Image;return s.crossOrigin="anonymous",s.src=this.src,s.onload=()=>{var n;K[this.src]=s,t==null||t(s),(n=this.redraw)==null||n.call(this)},s}}draw(t){try{if(!this.img.complete)return;t.save(),t.drawImage(this.img,this.x,this.y,this.width,this.height),t.restore()}catch(e){console.error(e)}}}class Rt{constructor(t){a(this,"id","");a(this,"type","point");a(this,"x");a(this,"y");a(this,"r");a(this,"text");a(this,"backgroundColor");a(this,"index");a(this,"pIndex");a(this,"parentId");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)"}draw(t,e){t.save();const s=1/e.scale;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()}}const tt={};class Ct{constructor(t){a(this,"id","");a(this,"type","issue");a(this,"x");a(this,"y");a(this,"width");a(this,"height");a(this,"src");a(this,"img");a(this,"index");a(this,"pIndex");a(this,"parentId");a(this,"count");a(this,"badgeR");a(this,"redraw");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)}loadImage(t){const e=tt[this.src];if(e)return queueMicrotask(()=>{var s;t==null||t(e),(s=this.redraw)==null||s.call(this)}),e;{const s=new Image;return s.src=this.src,s.crossOrigin="anonymous",s.onload=()=>{var n;tt[this.src]=s,t==null||t(s),(n=this.redraw)==null||n.call(this)},s}}draw(t,e){if(!this.img.complete)return;const s=1/e.scale,n=this.width*s,r=this.height*s,o=this.x-n/2,h=this.y-r,c=this.badgeR*s,u=c*1.5;t.save(),t.drawImage(this.img,o,h,n,r),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-r*.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*.3,this.y-r*.8+c/2)),t.restore()}}const et={};class jt{constructor(t){a(this,"type","marker");a(this,"x");a(this,"y");a(this,"url");a(this,"width");a(this,"height");a(this,"anchor");a(this,"img");a(this,"scale");a(this,"redraw");a(this,"beforeDraw");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)}loadImage(t){const e=et[this.url];if(e)return queueMicrotask(()=>{var s;t==null||t(e),(s=this.redraw)==null||s.call(this)}),e;{const s=new Image;return s.src=this.url,s.crossOrigin="anonymous",s.onload=()=>{var n;et[this.url]=s,t==null||t(s),(n=this.redraw)==null||n.call(this)},s}}calculateIconPosition(){var s,n;const t=((s=this.anchor)==null?void 0:s.x)??this.width/2,e=((n=this.anchor)==null?void 0:n.y)??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){var r,o;if((r=this.beforeDraw)==null||r.call(this,t,e),!((o=this.img)!=null&&o.complete))return;const{iconStartX:s,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,s,n,this.width*this.scale,this.height*this.scale)}catch(h){console.error("绘制标记时出错:",h)}finally{t.restore()}}}class kt{constructor(t){a(this,"type","radar");a(this,"x");a(this,"y");a(this,"r");a(this,"angle");a(this,"text");a(this,"hFov",90);a(this,"beforeDraw");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}draw(t,e){var h;(h=this.beforeDraw)==null||h.call(this,t,e);const s=1/e.scale,[n,r]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const o=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*s);o.addColorStop(0,"rgba(180, 42, 42, 1)"),o.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*s,n,r),t.closePath(),t.fillStyle=o,t.fill(),t.restore()}}class Xt{constructor(t){a(this,"type","region");a(this,"x");a(this,"y");a(this,"shape");a(this,"areaPoints");a(this,"backgroundColor");if(this.x=t.x,this.y=t.y,this.shape=t.shape||"",this.backgroundColor=t.backgroundColor,t.areaPoints.length===2){const[{x:e,y:s},{},{x:n,y:r}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(s,r)},{x:Math.max(e,n),y:Math.min(s,r)},{x:Math.max(e,n),y:Math.max(s,r)},{x:Math.min(e,n),y:Math.max(s,r)}]}else this.areaPoints=t.areaPoints}draw(t,e){if(t.save(),t.beginPath(),t.globalAlpha=.3,t.fillStyle=this.backgroundColor,this.shape==="circle"){const[{x:s,y:n},{},{x:r,y:o}]=this.areaPoints,h=Math.abs(r-s)/2,c=s+(r-s)/2,u=n+(o-n)/2;t.arc(c,u,h,0,2*Math.PI)}else this.areaPoints.forEach((s,n)=>{const{x:r,y:o}=s;n===0?t.moveTo(r,o):t.lineTo(r,o)});t.fill(),t.restore()}}l.APP_SETTING=G,l.AppError=v,l.AppErrorCode=x,l.AppObsType=F,l.CanvasElement=_t,l.CanvasImageElement=zt,l.CanvasIssueElement=Ct,l.CanvasMarkerElement=jt,l.CanvasPointElement=Rt,l.CanvasRadarElement=kt,l.CanvasRegionElement=Xt,l.Coordinate=Q,l.CoordinateLevel=N,l.CoordinateModelType=m,l.CoordinateStatus=D,l.CoordinateType=T,l.DataSource=g,l.GeoPoint=I,l.Point=w,l.Position=X,l.RelativeMap=M,l.RequestContentType=z,l.RequestMethod=p,l.RequestResultCode=_,l.api=lt,l.http=ht,l.utils=Dt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vsleem-realsee-viewer/shared",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared utilities for VSLeem RealSee Viewer",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"development": "./src/index.ts",
|
|
12
|
-
"production": "./dist/index.mjs",
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.mjs",
|
|
15
|
-
"require": "./dist/index.umd.js",
|
|
16
|
-
"default": "./dist/index.mjs"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
9
|
"publishConfig": {
|
|
20
10
|
"access": "public",
|
|
21
11
|
"registry": "https://registry.npmjs.org/"
|