@vsleem-realsee-viewer/shared 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.internal.md +556 -27
- package/README.md +12 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +3 -2
package/README.internal.md
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vsleem-realsee-viewer/shared
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
共享工具库,为 VSLeem RealSee Viewer 提供核心数据模型、坐标系统、工具函数和 API 接口。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 目录
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- [核心组件](#核心组件)
|
|
8
|
+
- [Coordinate 坐标系类](#1-coordinate-坐标系类)
|
|
9
|
+
- [DataSource 数据源类](#2-datasource-数据源类)
|
|
10
|
+
- [GeoPoint 地理坐标类](#3-geopoint-地理坐标类)
|
|
11
|
+
- [RelativeMap 相对坐标映射类](#4-relativemap-相对坐标映射类)
|
|
12
|
+
- [Point 点坐标类](#5-point-点坐标类)
|
|
13
|
+
- [Vector3 三维向量类](#6-vector3-三维向量类)
|
|
14
|
+
- [Position 球面位置类](#7-position-球面位置类)
|
|
15
|
+
- [DataHelper 数据助手类](#8-datahelper-数据助手类)
|
|
16
|
+
- [枚举类型](#枚举类型)
|
|
17
|
+
- [类型定义](#类型定义)
|
|
18
|
+
- [工具函数](#工具函数)
|
|
19
|
+
- [API 接口](#api-接口)
|
|
20
|
+
- [配置常量](#配置常量)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# 核心组件
|
|
25
|
+
|
|
26
|
+
## 1. Coordinate 坐标系类
|
|
27
|
+
|
|
28
|
+
适用于建筑信息模型(BIM)、地理信息系统(GIS)等需要复杂空间关系管理的场景。
|
|
29
|
+
|
|
30
|
+
### 1.1 属性说明
|
|
8
31
|
|
|
9
32
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
10
33
|
| -------------- | -------------- | ------ | -------------------------------------------- |
|
|
@@ -28,7 +51,7 @@
|
|
|
28
51
|
| `disabled?` | `boolean` | - | 标识坐标系是否被禁用 |
|
|
29
52
|
| `createTime?` | `number` | - | 坐标系的创建时间戳 |
|
|
30
53
|
|
|
31
|
-
|
|
54
|
+
### 1.2 计算属性说明
|
|
32
55
|
|
|
33
56
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
34
57
|
| ----------- | -------------- | ------ | -------------------------------------------------- |
|
|
@@ -36,7 +59,7 @@
|
|
|
36
59
|
| `modelList` | `Coordinate[]` | [] | 获取所有模型类型的子坐标系 |
|
|
37
60
|
| `fullName` | `string` | - | 获取组合后的完整名称,格式为"简称(名称)"或单独名称 |
|
|
38
61
|
|
|
39
|
-
|
|
62
|
+
### 1.3 方法说明
|
|
40
63
|
|
|
41
64
|
| 方法 | 类型 | 说明 |
|
|
42
65
|
| ---------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
@@ -61,13 +84,13 @@
|
|
|
61
84
|
| `getDestRelativeMap` | `(dstCoordinate: Coordinate) => RelativeMap` | 计算到目标坐标系的相对变换关系 |
|
|
62
85
|
| `getRelativeMaps` | `() => RelativeMap[]` | 获取从当前坐标系到根系的相对变换链 |
|
|
63
86
|
|
|
64
|
-
|
|
87
|
+
---
|
|
65
88
|
|
|
66
|
-
## 2.
|
|
89
|
+
## 2. DataSource 数据源类
|
|
67
90
|
|
|
68
|
-
|
|
91
|
+
用于管理 BIM、GIS、数字孪生的层级结构与空间关系。
|
|
69
92
|
|
|
70
|
-
|
|
93
|
+
### 2.1 静态方法说明
|
|
71
94
|
|
|
72
95
|
| 方法 | 类型 | 说明 |
|
|
73
96
|
| ----------------------- | -------------------------------------------------------------------------------- | ------------------------------------ |
|
|
@@ -83,13 +106,13 @@
|
|
|
83
106
|
| `sortCoordinateTree` | `(node: Coordinate) => void` | 递归排序坐标系树 |
|
|
84
107
|
| `filterSpaceTree` | `(tree: Coordinate[],parent?: Coordinate) => Coordinate[]` | 过滤出空间坐标系树 |
|
|
85
108
|
|
|
86
|
-
|
|
109
|
+
---
|
|
87
110
|
|
|
88
|
-
## 3.
|
|
111
|
+
## 3. GeoPoint 地理坐标类
|
|
89
112
|
|
|
90
|
-
|
|
113
|
+
实现地理与平面坐标的高精度双向转换,基于 WGS84 椭球体模型。
|
|
91
114
|
|
|
92
|
-
|
|
115
|
+
### 3.1 属性说明
|
|
93
116
|
|
|
94
117
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
95
118
|
| ----- | -------- | ------ | -------- |
|
|
@@ -97,7 +120,7 @@
|
|
|
97
120
|
| `lon` | `number` | 0 | 纬度(°) |
|
|
98
121
|
| `alt` | `number` | 0 | 海拔(mm) |
|
|
99
122
|
|
|
100
|
-
|
|
123
|
+
### 3.2 方法说明
|
|
101
124
|
|
|
102
125
|
| 方法 | 类型 | 说明 |
|
|
103
126
|
| ------------- | -------------------------------------------- | ---------------------------------- |
|
|
@@ -105,13 +128,13 @@
|
|
|
105
128
|
| `XYZToLLH` | `(p: Point, refPoint: GeoPoint) => GeoPoint` | 平面坐标转地理坐标(WGS84椭球体) |
|
|
106
129
|
| `LLHToXYZ` | `(p: Point, refPoint: GeoPoint) => Point` | 地理坐标转平面坐标(WGS84椭球体) |
|
|
107
130
|
|
|
108
|
-
|
|
131
|
+
---
|
|
109
132
|
|
|
110
|
-
## 4.
|
|
133
|
+
## 4. RelativeMap 相对坐标映射类
|
|
111
134
|
|
|
112
|
-
|
|
135
|
+
用于管理三维空间中的相对坐标变换关系,支持缩放、旋转和平移。
|
|
113
136
|
|
|
114
|
-
|
|
137
|
+
### 4.1 属性说明
|
|
115
138
|
|
|
116
139
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
117
140
|
| ----------- | ---------- | ------ | ---------------------------- |
|
|
@@ -125,7 +148,7 @@
|
|
|
125
148
|
| `plane` | `string` | 'xy' | 坐标系平面类型('xy'或'xz') |
|
|
126
149
|
| `refPoint?` | `GeoPoint` | - | 参考点坐标 |
|
|
127
150
|
|
|
128
|
-
|
|
151
|
+
### 4.2 方法说明
|
|
129
152
|
|
|
130
153
|
| 方法 | 类型 | 说明 |
|
|
131
154
|
| -------------------- | --------------------------------------------------- | ------------------------------------ |
|
|
@@ -135,21 +158,21 @@
|
|
|
135
158
|
| `toParse` | `(r?: string) => RelativeMap \| undefined` | 从JSON字符串解析为RelativeMap对象 |
|
|
136
159
|
| `toStringify` | `(r?: RelativeMap) => string \| undefined` | 将RelativeMap对象序列化为JSON字符串 |
|
|
137
160
|
|
|
138
|
-
|
|
161
|
+
---
|
|
139
162
|
|
|
140
|
-
## 5.
|
|
163
|
+
## 5. Point 点坐标类
|
|
141
164
|
|
|
142
|
-
|
|
165
|
+
用于三维空间中的坐标表示与转换,支持位置、角度和坐标系投影变换。
|
|
143
166
|
|
|
144
|
-
|
|
167
|
+
### 5.1 属性说明
|
|
145
168
|
|
|
146
169
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
147
170
|
| ---------- | --------- | ------ | -------------------------- |
|
|
148
171
|
| `x` | `number` | 0 | X轴坐标 |
|
|
149
172
|
| `y` | `number` | 0 | Y轴坐标 |
|
|
150
173
|
| `z` | `number` | 0 | Z轴坐标 |
|
|
151
|
-
| `lat` | `number` | 0 |
|
|
152
|
-
| `lon` | `number` | 0 |
|
|
174
|
+
| `lat` | `number` | 0 | 纬度 |
|
|
175
|
+
| `lon` | `number` | 0 | 经度 |
|
|
153
176
|
| `alt` | `number` | 0 | 海拔 |
|
|
154
177
|
| `yaw` | `number` | 0 | 偏航角 |
|
|
155
178
|
| `pitch` | `number` | 0 | 俯仰角 |
|
|
@@ -159,7 +182,7 @@
|
|
|
159
182
|
| `hasAngle` | `boolean` | false | 是否包含角度信息 |
|
|
160
183
|
| `plane` | `string` | 'xy' | 坐标平面类型('xy'或'xz') |
|
|
161
184
|
|
|
162
|
-
|
|
185
|
+
### 5.2 方法说明
|
|
163
186
|
|
|
164
187
|
| 方法 | 类型 | 说明 |
|
|
165
188
|
| ------------- | ------------------------------------------------------------------------------------------------ | ---------------------- |
|
|
@@ -176,3 +199,509 @@
|
|
|
176
199
|
| `project` | `(r: RelativeMap) => Point \| undefined` | 基础坐标投影 |
|
|
177
200
|
| `projectXZ` | `(r: RelativeMap) => Point` | XZ平面坐标投影 |
|
|
178
201
|
| `projectXY` | `(r: RelativeMap) => Point` | XY平面坐标投影 |
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 6. Vector3 三维向量类
|
|
206
|
+
|
|
207
|
+
用于表示三维空间中的一个点或方向,提供序列化与反序列化方法。
|
|
208
|
+
|
|
209
|
+
### 6.1 属性说明
|
|
210
|
+
|
|
211
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
212
|
+
| ---- | -------- | ------ | ---- |
|
|
213
|
+
| `x` | `number` | 0 | X轴 |
|
|
214
|
+
| `y` | `number` | 0 | Y轴 |
|
|
215
|
+
| `z` | `number` | 0 | Z轴 |
|
|
216
|
+
|
|
217
|
+
### 6.2 方法说明
|
|
218
|
+
|
|
219
|
+
| 方法 | 类型 | 说明 |
|
|
220
|
+
| ------------- | ----------------------------------------- | --------------------------- |
|
|
221
|
+
| `constructor` | `(options?: Partial<Vector3>) => Vector3` | 初始化三维向量 |
|
|
222
|
+
| `toParse` | `(position?: string) => Vector3 \| void` | 从字符串解析为Vector3对象 |
|
|
223
|
+
| `toStringify` | `(position?: Vector3) => string` | 将Vector3对象序列化为字符串 |
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 7. Position 球面位置类
|
|
228
|
+
|
|
229
|
+
用于表示球面坐标系中的姿态信息,包含偏航角、俯仰角和横滚角。
|
|
230
|
+
|
|
231
|
+
### 7.1 属性说明
|
|
232
|
+
|
|
233
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
234
|
+
| ------- | -------- | ------ | ------ |
|
|
235
|
+
| `yaw` | `number` | 0 | 偏航角 |
|
|
236
|
+
| `pitch` | `number` | 0 | 俯仰角 |
|
|
237
|
+
| `roll` | `number` | 0 | 横滚角 |
|
|
238
|
+
|
|
239
|
+
### 7.2 方法说明
|
|
240
|
+
|
|
241
|
+
| 方法 | 类型 | 说明 |
|
|
242
|
+
| ------------- | ------------------------------------------- | ---------------------------- |
|
|
243
|
+
| `constructor` | `(options?: Partial<Position>) => Position` | 初始化球面位置 |
|
|
244
|
+
| `toParse` | `(position?: string) => Position \| void` | 从字符串解析为Position对象 |
|
|
245
|
+
| `toStringify` | `(position?: Position) => string` | 将Position对象序列化为字符串 |
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 8. DataHelper 数据助手类
|
|
250
|
+
|
|
251
|
+
提供数据处理与转换的辅助方法。
|
|
252
|
+
|
|
253
|
+
### 8.1 静态方法说明
|
|
254
|
+
|
|
255
|
+
| 方法 | 类型 | 说明 |
|
|
256
|
+
| -------------------- | ------------------------------------------------------------------------------------ | -------------------------------- |
|
|
257
|
+
| `srcPointToDstPoint` | `(points: Point[], srcCoordinate: Coordinate, dstCoordinate: Coordinate) => Point[]` | 将源坐标系中的点转换到目标坐标系 |
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
# 枚举类型
|
|
262
|
+
|
|
263
|
+
## 应用相关枚举
|
|
264
|
+
|
|
265
|
+
### AppObsType - 对象存储类型
|
|
266
|
+
|
|
267
|
+
| 值 | 说明 |
|
|
268
|
+
| -------- | -------- |
|
|
269
|
+
| `huawei` | 华为云 |
|
|
270
|
+
| `aliyun` | 阿里云 |
|
|
271
|
+
| `hs` | 火山引擎 |
|
|
272
|
+
| `amazon` | AWS S3 |
|
|
273
|
+
| `minio` | MinIO |
|
|
274
|
+
|
|
275
|
+
### LocaleType - 多语言类型
|
|
276
|
+
|
|
277
|
+
| 值 | 说明 |
|
|
278
|
+
| ------- | -------- |
|
|
279
|
+
| `en-US` | 英语 |
|
|
280
|
+
| `zh-CN` | 简体中文 |
|
|
281
|
+
| `ja-JP` | 日语 |
|
|
282
|
+
|
|
283
|
+
### CRSTypes - 地图坐标系类型
|
|
284
|
+
|
|
285
|
+
| 值 | 说明 |
|
|
286
|
+
| ---------- | ----------------------- |
|
|
287
|
+
| `WGS84` | WGS84 坐标系 |
|
|
288
|
+
| `GCJ02` | 火星坐标系(高德/腾讯) |
|
|
289
|
+
| `BD09` | 百度坐标系 |
|
|
290
|
+
| `BD09MC` | 百度墨卡托坐标系 |
|
|
291
|
+
| `EPSG3857` | Web墨卡托投影 |
|
|
292
|
+
|
|
293
|
+
## 坐标相关枚举
|
|
294
|
+
|
|
295
|
+
### CoordinateModelType - 坐标系模型类型
|
|
296
|
+
|
|
297
|
+
| 值 | 说明 |
|
|
298
|
+
| ---------------- | ---------------------- |
|
|
299
|
+
| `CADModel` | CAD图片模型 (5) |
|
|
300
|
+
| `BIMModel` | BIM引擎模型 (6) |
|
|
301
|
+
| `ForgeModel` | Forge引擎模型 (7) |
|
|
302
|
+
| `ThreeDModel` | 3D模型 (8) |
|
|
303
|
+
| `GeoModel` | 地图模型 (9) |
|
|
304
|
+
| `SoonspaceModel` | SoonSpace引擎模型 (10) |
|
|
305
|
+
| `ScaleModel` | 比例尺模型 (101) |
|
|
306
|
+
|
|
307
|
+
### CoordinateLevel - 坐标系空间层级
|
|
308
|
+
|
|
309
|
+
| 值 | 说明 |
|
|
310
|
+
| -------- | -------- |
|
|
311
|
+
| `Global` | 地图 (0) |
|
|
312
|
+
|
|
313
|
+
### CoordinateType - 坐标系类型
|
|
314
|
+
|
|
315
|
+
| 值 | 说明 |
|
|
316
|
+
| ------- | ---- |
|
|
317
|
+
| `Space` | 空间 |
|
|
318
|
+
| `Model` | 模型 |
|
|
319
|
+
| `Data` | 数据 |
|
|
320
|
+
|
|
321
|
+
### CoordinateStatus - 坐标系使用状态
|
|
322
|
+
|
|
323
|
+
| 值 | 说明 |
|
|
324
|
+
| ---------- | -------- |
|
|
325
|
+
| `Used` | 当前使用 |
|
|
326
|
+
| `Enabled` | 可使用 |
|
|
327
|
+
| `Disabled` | 无法使用 |
|
|
328
|
+
|
|
329
|
+
## 请求相关枚举
|
|
330
|
+
|
|
331
|
+
### RequestMethod - HTTP请求方法
|
|
332
|
+
|
|
333
|
+
| 值 | 说明 |
|
|
334
|
+
| ------ | ---- |
|
|
335
|
+
| `GET` | GET |
|
|
336
|
+
| `POST` | POST |
|
|
337
|
+
|
|
338
|
+
### RequestContentType - 请求内容类型
|
|
339
|
+
|
|
340
|
+
| 值 | 说明 |
|
|
341
|
+
| ----------------- | ----------------------------------------------- |
|
|
342
|
+
| `JSON` | application/json |
|
|
343
|
+
| `FORM_URLENCODED` | application/x-www-form-urlencoded;charset=UTF-8 |
|
|
344
|
+
| `FORM_DATA` | multipart/form-data;charset=UTF-8 |
|
|
345
|
+
| `OCTET_STREAM` | application/octet-stream |
|
|
346
|
+
|
|
347
|
+
### RequestResultCode - 请求结果代码
|
|
348
|
+
|
|
349
|
+
| 值 | 说明 |
|
|
350
|
+
| ----- | ---- |
|
|
351
|
+
| `200` | 成功 |
|
|
352
|
+
| `-1` | 错误 |
|
|
353
|
+
| `401` | 超时 |
|
|
354
|
+
|
|
355
|
+
## 错误相关枚举
|
|
356
|
+
|
|
357
|
+
### AppErrorCode - 应用错误码
|
|
358
|
+
|
|
359
|
+
| 错误码 | 错误描述 |
|
|
360
|
+
| ------ | ------------------------------ |
|
|
361
|
+
| `9000` | GeoPoint 没有对应的平面信息 |
|
|
362
|
+
| `9010` | Point 在 GIS 中未映射 |
|
|
363
|
+
| `9011` | Point 缺少 XYZ 坐标信息 |
|
|
364
|
+
| `9012` | Point 没有对应的平面信息 |
|
|
365
|
+
| `9020` | RelativeMap 平面不匹配 |
|
|
366
|
+
| `9021` | RelativeMap 没有对应的平面信息 |
|
|
367
|
+
| `9022` | RelativeMap JSON 格式错误 |
|
|
368
|
+
| `9030` | 请求的返回码错误 |
|
|
369
|
+
| `9031` | 请求的返回结果错误 |
|
|
370
|
+
| `9032` | 请求发生未知错误 |
|
|
371
|
+
| `9040` | 解析数据失败 |
|
|
372
|
+
| `9041` | 序列化数据失败 |
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
# 类型定义
|
|
377
|
+
|
|
378
|
+
## AppSetting - 应用设置
|
|
379
|
+
|
|
380
|
+
定义应用程序的配置参数。
|
|
381
|
+
|
|
382
|
+
| 属性 | 类型 | 说明 |
|
|
383
|
+
| --------------- | ------------ | ---------------------------- |
|
|
384
|
+
| `baseUrl` | `string` | 用于配置应用后端服务的根路径 |
|
|
385
|
+
| `authorizeCode` | `string` | 用于API身份验证和授权的凭证 |
|
|
386
|
+
| `locale` | `LocaleType` | 当前语言,默认 zh-CN |
|
|
387
|
+
|
|
388
|
+
## CoordinateModel - 坐标模型
|
|
389
|
+
|
|
390
|
+
定义坐标系的数据模型。
|
|
391
|
+
|
|
392
|
+
| 属性 | 类型 | 说明 |
|
|
393
|
+
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
394
|
+
| `id` | `number` | 唯一 ID |
|
|
395
|
+
| `coordinateType` | `number` | 坐标系分类 0空间 1模型 |
|
|
396
|
+
| `renderType` | `number` | 模型类型 |
|
|
397
|
+
| `type` | `number` | 层级类型 0-global-全局坐标系/1-field-场布图/2-building-建筑/3-floor-楼层/4-room-房间/5-cad位图图纸/6-bim/7-forge/8-3DGS/9-地图模型 |
|
|
398
|
+
| `projectId` | `number` | 项目 ID |
|
|
399
|
+
| `parentId` | `number` | 父节点 ID |
|
|
400
|
+
| `modelId` | `number` | 模型 ID |
|
|
401
|
+
| `modelKey` | `string` | 模型键 |
|
|
402
|
+
| `name` | `string` | 名称 |
|
|
403
|
+
| `shortName` | `string` | 短名称 |
|
|
404
|
+
| `no` | `string` | 编号 |
|
|
405
|
+
| `groupUuid` | `string` | 组UUID,多楼层前端传入时需保持一致 |
|
|
406
|
+
| `relativePosition` | `string` | 位置关系 |
|
|
407
|
+
| `status` | `number` | 状态 0使用/1激活/2未使用 |
|
|
408
|
+
| `thirdId` | `string` | 第三方 ID |
|
|
409
|
+
| `uuid` | `string` | UUID |
|
|
410
|
+
| `z` | `number` | z坐标 |
|
|
411
|
+
| `meta` | `string` | 元数据(JSON字符串) |
|
|
412
|
+
| `leafletPath` | `string` | leaflet路径(JSON字符串) |
|
|
413
|
+
| `createBy` | `string` | 创建者 |
|
|
414
|
+
| `createTime` | `number` | 创建时间 |
|
|
415
|
+
| `updateBy` | `string` | 更新者 |
|
|
416
|
+
| `updateTime` | `number` | 更新时间 |
|
|
417
|
+
|
|
418
|
+
## ProjectionModel - 投影模型
|
|
419
|
+
|
|
420
|
+
描述坐标投影转换的模型。
|
|
421
|
+
|
|
422
|
+
| 属性 | 类型 | 说明 |
|
|
423
|
+
| -------------- | -------- | -------------------------------- |
|
|
424
|
+
| `mappingType` | `number` | 映射类型 |
|
|
425
|
+
| `projectId` | `number` | 项目ID |
|
|
426
|
+
| `srcCsId` | `number` | 源坐标系ID(被映射的模型/空间) |
|
|
427
|
+
| `srcModelCsId` | `number` | 源模型坐标系ID(左侧视图模型) |
|
|
428
|
+
| `srcModelId` | `number` | 源模型ID(非坐标系id) |
|
|
429
|
+
| `srcMapType` | `number` | 源模型地图类型 |
|
|
430
|
+
| `srcCsPointA` | `string` | 源坐标系点A(左侧视图点A) |
|
|
431
|
+
| `srcCsPointB` | `string` | 源坐标系点B(左侧视图点B) |
|
|
432
|
+
| `dstCsId` | `number` | 目标坐标系ID(映射目标-空间) |
|
|
433
|
+
| `dstModelCsId` | `number` | 目标模型坐标系ID(右侧视图模型) |
|
|
434
|
+
| `dstModelId` | `number` | 目标模型ID(非坐标系id) |
|
|
435
|
+
| `dstMapType` | `number` | 目标模型地图类型 |
|
|
436
|
+
| `dstPointA` | `string` | 目标坐标系点A(右侧视图点A) |
|
|
437
|
+
| `dstPointB` | `string` | 目标坐标系点B(右侧视图点B) |
|
|
438
|
+
|
|
439
|
+
## MetaModel - 元数据模型
|
|
440
|
+
|
|
441
|
+
| 属性 | 类型 | 说明 |
|
|
442
|
+
| -------------- | -------- | -------------------- |
|
|
443
|
+
| `tilesBaseUrl` | `string` | pdf瓦片基础URL |
|
|
444
|
+
| `imageWidth` | `number` | 图片宽度 |
|
|
445
|
+
| `imageHeight` | `number` | 图片高度 |
|
|
446
|
+
| `path` | `string` | SoonSpace模型路径URL |
|
|
447
|
+
|
|
448
|
+
## ProjectModel - 项目详情
|
|
449
|
+
|
|
450
|
+
项目信息数据结构。
|
|
451
|
+
|
|
452
|
+
| 属性 | 类型 | 说明 |
|
|
453
|
+
| ------------------ | ---------- | -------------- |
|
|
454
|
+
| `id` | `number` | 项目ID |
|
|
455
|
+
| `no` | `string` | 项目编号 |
|
|
456
|
+
| `name` | `string` | 项目名称 |
|
|
457
|
+
| `shortName` | `string` | 项目简称 |
|
|
458
|
+
| `status` | `number` | 项目状态 |
|
|
459
|
+
| `companyId` | `number` | 公司ID |
|
|
460
|
+
| `createByName` | `string` | 创建人姓名 |
|
|
461
|
+
| `mapArea` | `number` | 地图区域 |
|
|
462
|
+
| `mapType` | `string` | 地图类型 |
|
|
463
|
+
| `CRSType` | `CRSTypes` | 地图坐标系标准 |
|
|
464
|
+
| `sassProjectId` | `string` | SaaS项目ID |
|
|
465
|
+
| `sassEnterpriseId` | `number` | SaaS企业ID |
|
|
466
|
+
| `createBy` | `string` | 创建人ID |
|
|
467
|
+
| `createTime` | `number` | 创建时间 |
|
|
468
|
+
| `updateBy` | `string` | 更新人ID |
|
|
469
|
+
| `updateTime` | `number` | 更新时间 |
|
|
470
|
+
|
|
471
|
+
## ViewModel - 视图模型
|
|
472
|
+
|
|
473
|
+
描述CAD文件、图片、BIM或对象的数据结构。
|
|
474
|
+
|
|
475
|
+
| 属性 | 类型 | 说明 |
|
|
476
|
+
| ---------------- | ----------------- | ---------------------- |
|
|
477
|
+
| `id` | `number` | 唯一标识符 |
|
|
478
|
+
| `no` | `string` | 模型编号/代码 |
|
|
479
|
+
| `name` | `string` | 模型名称/描述 |
|
|
480
|
+
| `projectId` | `number` | 所属项目ID |
|
|
481
|
+
| `renderType` | `number` | 模型渲染类型 |
|
|
482
|
+
| `rawType` | `string` | 模型原始文件类型 |
|
|
483
|
+
| `modelKey` | `string` | 模型关键标识符 |
|
|
484
|
+
| `rawUrl` | `string` | 原始模型文件URL |
|
|
485
|
+
| `length` | `number` | 模型文件大小(字节) |
|
|
486
|
+
| `bindCsIds` | `string` | 绑定坐标系id集合 |
|
|
487
|
+
| `mappingRecords` | `MappingRecord[]` | 映射记录 |
|
|
488
|
+
| `createBy` | `string` | 创建者ID |
|
|
489
|
+
| `createTime` | `number` | 创建时间戳(毫秒) |
|
|
490
|
+
| `updateBy` | `string` | 最后更新者ID |
|
|
491
|
+
| `updateTime` | `number` | 最后更新时间戳(毫秒) |
|
|
492
|
+
|
|
493
|
+
### MappingRecord - 映射记录
|
|
494
|
+
|
|
495
|
+
| 属性 | 类型 | 说明 |
|
|
496
|
+
| ----------------- | -------- | ------------------ |
|
|
497
|
+
| `dstCsGroupUuid` | `string` | 目标坐标系组的UUID |
|
|
498
|
+
| `dstCsId` | `number` | 目标坐标系ID |
|
|
499
|
+
| `dstCsName` | `string` | 目标坐标系名称 |
|
|
500
|
+
| `dstCsShortName` | `string` | 目标坐标系简称 |
|
|
501
|
+
| `dstParentCsName` | `string` | 目标父坐标系名称 |
|
|
502
|
+
| `srcCsId` | `number` | 源坐标系ID |
|
|
503
|
+
|
|
504
|
+
## RequestConfig - 请求配置
|
|
505
|
+
|
|
506
|
+
定义发起请求时的相关配置参数。
|
|
507
|
+
|
|
508
|
+
| 属性 | 类型 | 说明 |
|
|
509
|
+
| --------- | ------------------------ | ------------------------------ |
|
|
510
|
+
| `url` | `string` | 请求URL |
|
|
511
|
+
| `method` | `string` | 请求方法(GET/POST等) |
|
|
512
|
+
| `params` | `Record<string, any>` | URL参数(通常用于GET请求) |
|
|
513
|
+
| `data` | `Record<string, any>` | 请求体数据(通常用于POST/PUT) |
|
|
514
|
+
| `body` | `any` | 原始请求体内容 |
|
|
515
|
+
| `mode` | `any` | 请求模式(如cors/no-cors等) |
|
|
516
|
+
| `headers` | `Record<string, string>` | 请求头配置 |
|
|
517
|
+
|
|
518
|
+
## RequestOptions - 请求选项
|
|
519
|
+
|
|
520
|
+
细化的请求行为控制选项。
|
|
521
|
+
|
|
522
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
523
|
+
| --------------------- | --------- | ------ | -------------------------- |
|
|
524
|
+
| `isTransformResponse` | `boolean` | true | 是否需要对返回数据进行处理 |
|
|
525
|
+
| `joinBaseUrl` | `boolean` | true | 是否加入基础URL |
|
|
526
|
+
| `withAuthorize` | `boolean` | true | 是否携带授权码 |
|
|
527
|
+
|
|
528
|
+
## ResponseResult - 响应结果
|
|
529
|
+
|
|
530
|
+
定义API响应的数据结构。
|
|
531
|
+
|
|
532
|
+
| 属性 | 类型 | 说明 |
|
|
533
|
+
| ------ | -------- | -------- |
|
|
534
|
+
| `code` | `number` | 状态码 |
|
|
535
|
+
| `msg` | `string` | 消息提示 |
|
|
536
|
+
| `data` | `any` | 返回数据 |
|
|
537
|
+
|
|
538
|
+
## MapProvider - 地图服务商
|
|
539
|
+
|
|
540
|
+
地图服务商配置信息。
|
|
541
|
+
|
|
542
|
+
| 属性 | 类型 | 说明 |
|
|
543
|
+
| ---------- | ------------ | ------------------------------------- |
|
|
544
|
+
| `name` | `string` | 地图服务商名称 |
|
|
545
|
+
| `patterns` | `string[]` | 匹配的关键词 |
|
|
546
|
+
| `CRSTypes` | `CRSTypes[]` | [中国大陆区域标准,中国大陆区域外标准] |
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
# 工具函数
|
|
551
|
+
|
|
552
|
+
## is - 类型判断
|
|
553
|
+
|
|
554
|
+
提供各种类型判断方法。
|
|
555
|
+
|
|
556
|
+
| 方法 | 类型 | 说明 |
|
|
557
|
+
| --------------- | --------------------------------------------------- | ------------------------------ |
|
|
558
|
+
| `inBrowser` | `boolean` | 是否在浏览器环境 |
|
|
559
|
+
| `is` | `(val: unknown, type: string) => boolean` | 判断值是否为指定类型 |
|
|
560
|
+
| `isDef` | `<T>(val?: T) => val is T` | 判断值是否已定义 |
|
|
561
|
+
| `isUnDef` | `<T>(val?: T) => val is T` | 判断值是否未定义 |
|
|
562
|
+
| `isObject` | `(val: any) => val is Record<any, any>` | 判断是否为对象 |
|
|
563
|
+
| `isNull` | `(val: unknown) => val is null` | 判断是否为 null |
|
|
564
|
+
| `isDate` | `(val: unknown) => val is Date` | 判断是否为日期 |
|
|
565
|
+
| `isString` | `(val: unknown) => val is string` | 判断是否为字符串 |
|
|
566
|
+
| `isFunction` | `(val: unknown) => val is Function` | 判断是否为函数 |
|
|
567
|
+
| `isBoolean` | `(val: unknown) => val is boolean` | 判断是否为布尔值 |
|
|
568
|
+
| `isRegExp` | `(val: unknown) => val is RegExp` | 判断是否为正则表达式 |
|
|
569
|
+
| `isArray` | `(val: any) => val is Array<any>` | 判断是否为数组 |
|
|
570
|
+
| `isWindow` | `(val: any) => val is Window` | 判断是否为 Window 对象 |
|
|
571
|
+
| `isElement` | `(val: unknown) => val is Element` | 判断是否为 DOM 元素 |
|
|
572
|
+
| `isNumeric` | `(val: unknown) => boolean` | 判断是否为数值 |
|
|
573
|
+
| `isSameValue` | `(newValue: unknown, oldValue: unknown) => boolean` | 判断两个值是否相同(JSON比较) |
|
|
574
|
+
| `isNullOrUnDef` | `(val: unknown) => val is null \| undefined` | 判断是否为 null 或 undefined |
|
|
575
|
+
| `isPromise` | `<T>(val: unknown) => val is Promise<T>` | 判断是否为 Promise |
|
|
576
|
+
|
|
577
|
+
## load - 资源加载
|
|
578
|
+
|
|
579
|
+
提供脚本、样式等资源加载方法。
|
|
580
|
+
|
|
581
|
+
| 方法 | 类型 | 说明 |
|
|
582
|
+
| ------------ | ----------------------------------------------------------------------------------- | ------------------------ |
|
|
583
|
+
| `loadScript` | `(src: string, attributes?: Record<string, string \| boolean>) => Promise<boolean>` | 动态加载 JavaScript 脚本 |
|
|
584
|
+
| `loadCss` | `(src: string) => Promise<boolean>` | 动态加载外部 CSS 文件 |
|
|
585
|
+
|
|
586
|
+
## lodash - 通用工具
|
|
587
|
+
|
|
588
|
+
基于 lodash 的通用工具函数。
|
|
589
|
+
|
|
590
|
+
## log - 日志工具
|
|
591
|
+
|
|
592
|
+
日志输出与调试工具。
|
|
593
|
+
|
|
594
|
+
| 方法 | 类型 | 说明 |
|
|
595
|
+
| ------- | ---------------------------- | ------------ |
|
|
596
|
+
| `warn` | `(message: string) => void` | 输出警告日志 |
|
|
597
|
+
| `error` | `(message: string) => never` | 抛出错误异常 |
|
|
598
|
+
|
|
599
|
+
## map - 地图工具
|
|
600
|
+
|
|
601
|
+
地图相关辅助方法。
|
|
602
|
+
|
|
603
|
+
## transform - 数据转换
|
|
604
|
+
|
|
605
|
+
数据格式转换工具。
|
|
606
|
+
|
|
607
|
+
## uuid - 唯一标识
|
|
608
|
+
|
|
609
|
+
UUID 生成工具。
|
|
610
|
+
|
|
611
|
+
| 方法 | 类型 | 说明 |
|
|
612
|
+
| ---------------- | ----------------------------- | -------------------------------- |
|
|
613
|
+
| `buildUUID` | `() => string` | 生成符合 RFC 4122 v4 标准的 UUID |
|
|
614
|
+
| `buildShortUUID` | `(prefix?: string) => string` | 生成短 UUID(带前缀) |
|
|
615
|
+
|
|
616
|
+
## canvas - Canvas 元素
|
|
617
|
+
|
|
618
|
+
Canvas 相关元素类型定义:
|
|
619
|
+
|
|
620
|
+
| 类型 | 说明 |
|
|
621
|
+
| --------------------- | -------------- |
|
|
622
|
+
| `CanvasElement` | Canvas基础元素 |
|
|
623
|
+
| `CanvasImageElement` | Canvas图片元素 |
|
|
624
|
+
| `CanvasIssueElement` | Canvas问题元素 |
|
|
625
|
+
| `CanvasMarkerElement` | Canvas标记元素 |
|
|
626
|
+
| `CanvasPointElement` | Canvas点元素 |
|
|
627
|
+
| `CanvasRadarElement` | Canvas雷达元素 |
|
|
628
|
+
| `CanvasRegionElement` | Canvas区域元素 |
|
|
629
|
+
|
|
630
|
+
## error - 错误处理
|
|
631
|
+
|
|
632
|
+
### AppError - 应用错误类
|
|
633
|
+
|
|
634
|
+
用于定义和抛出应用级别的自定义错误。
|
|
635
|
+
|
|
636
|
+
| 属性 | 类型 | 说明 |
|
|
637
|
+
| ------ | -------- | -------- |
|
|
638
|
+
| `code` | `number` | 错误码 |
|
|
639
|
+
| `msg` | `string` | 错误消息 |
|
|
640
|
+
|
|
641
|
+
## request - HTTP 请求
|
|
642
|
+
|
|
643
|
+
封装网络请求相关方法。
|
|
644
|
+
|
|
645
|
+
| 方法 | 类型 | 说明 |
|
|
646
|
+
| --------- | ------------------------------------------------------------------------------ | -------------- |
|
|
647
|
+
| `request` | `(config: RequestConfig, options?: RequestOptions) => Promise<ResponseResult>` | 发起 HTTP 请求 |
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
# API 接口
|
|
652
|
+
|
|
653
|
+
## coordinate - 坐标相关接口
|
|
654
|
+
|
|
655
|
+
坐标系数据的获取与操作接口。
|
|
656
|
+
|
|
657
|
+
## common - 通用接口
|
|
658
|
+
|
|
659
|
+
通用业务接口。
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
# 配置常量
|
|
664
|
+
|
|
665
|
+
## APP_SETTING - 应用默认配置
|
|
666
|
+
|
|
667
|
+
```typescript
|
|
668
|
+
{
|
|
669
|
+
baseUrl: 'https://vsleem.com/api',
|
|
670
|
+
authorizeCode: '',
|
|
671
|
+
}
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
## REQUEST_OPTIONS - 默认请求选项
|
|
675
|
+
|
|
676
|
+
```typescript
|
|
677
|
+
{
|
|
678
|
+
isTransformResponse: true,
|
|
679
|
+
joinBaseUrl: true,
|
|
680
|
+
withAuthorize: true,
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
## REQUEST_CONFIG - 默认请求配置
|
|
685
|
+
|
|
686
|
+
```typescript
|
|
687
|
+
{
|
|
688
|
+
url: '',
|
|
689
|
+
method: RequestMethod.GET,
|
|
690
|
+
headers: {},
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
## MAP_PROVIDERS - 地图服务商配置
|
|
695
|
+
|
|
696
|
+
| 服务商 | 国内坐标系 | 国外坐标系 |
|
|
697
|
+
| ----------------- | ---------- | ---------- |
|
|
698
|
+
| 高德 (GAODE) | GCJ02 | WGS84 |
|
|
699
|
+
| 百度 (BAIDU) | BD09 | WGS84 |
|
|
700
|
+
| 腾讯 (TENCENT) | GCJ02 | WGS84 |
|
|
701
|
+
| 天地图 (TIANDITU) | WGS84 | WGS84 |
|
|
702
|
+
| 谷歌 (GOOGLE) | GCJ02 | WGS84 |
|
|
703
|
+
| OpenStreetMap | WGS84 | WGS84 |
|
|
704
|
+
|
|
705
|
+
## MAP_TILE_LAYERS - 地图瓦片图层
|
|
706
|
+
|
|
707
|
+
天地图瓦片图层配置。
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @vsleem-realsee-viewer/shared
|
|
2
|
+
|
|
3
|
+
共享工具包,为VSLeem RealSee Viewer提供通用的工具函数、类型定义、组件类和配置。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- **工具函数**: 提供丰富的工具函数,包括类型检查、数据转换、错误处理、日志记录等
|
|
8
|
+
- **类型定义**: 定义了完整的数据模型和类型系统
|
|
9
|
+
- **组件类**: 提供坐标、点、向量等核心数据结构类
|
|
10
|
+
- **API封装**: 封装了HTTP请求和API接口
|
|
11
|
+
- **配置管理**: 提供应用级别的配置管理
|
|
12
|
+
- **Canvas工具**: 提供Canvas相关的工具类和元素类型
|
package/dist/index.d.ts
CHANGED
|
@@ -439,10 +439,11 @@ export declare type CoordinateModel = {
|
|
|
439
439
|
/** 坐标系模型类型枚举 */
|
|
440
440
|
export declare enum CoordinateModelType {
|
|
441
441
|
CADModel = 5 /** cad图片模型 */,
|
|
442
|
-
BIMModel = 6 /** bim
|
|
443
|
-
ForgeModel = 7 /** forge
|
|
442
|
+
BIMModel = 6 /** bim引擎模型 */,
|
|
443
|
+
ForgeModel = 7 /** forge引擎模型 */,
|
|
444
444
|
ThreeDModel = 8 /** 3d模型 */,
|
|
445
445
|
GeoModel = 9 /** 地图模型 */,
|
|
446
|
+
SoonspaceModel = 10 /**SoonSpace引擎模型 */,
|
|
446
447
|
ScaleModel = 101 /** 比例尺模型-前端自定义 */
|
|
447
448
|
}
|
|
448
449
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ct = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(ct || {}), _ = /* @__PURE__ */ ((s) => (s.en_US = "en-US", s.zh_CN = "zh-CN", s.ja_JP = "ja-JP", s))(_ || {}), g = /* @__PURE__ */ ((s) => (s.WGS84 = "WGS84", s.WGS1984 = "WGS84", s.EPSG4326 = "WGS84", s.GCJ02 = "GCJ02", s.AMap = "GCJ02", s.BD09 = "BD09", s.BD09LL = "BD09", s.Baidu = "BD09", s.BMap = "BD09", s.BD09MC = "BD09MC", s.BD09Meter = "BD09MC", s.EPSG3857 = "EPSG3857", s.EPSG900913 = "EPSG3857", s.EPSG102100 = "EPSG3857", s.WebMercator = "EPSG3857", s.WM = "EPSG3857", s))(g || {}), b = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.GeoModel = 9] = "GeoModel", s[s.ScaleModel = 101] = "ScaleModel", s))(b || {}), ht = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(ht || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), A = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(A || {}), p = /* @__PURE__ */ ((s) => (s[s.GeoPointNoPlane = 9e3] = "GeoPointNoPlane", s[s.PointUnmappedGIS = 9010] = "PointUnmappedGIS", s[s.PointNoXYZ = 9011] = "PointNoXYZ", s[s.PointNoPlane = 9012] = "PointNoPlane", s[s.RelativePlaneUnmatch = 9020] = "RelativePlaneUnmatch", s[s.RelativeNoPlane = 9021] = "RelativeNoPlane", s[s.RelativeJsonError = 9022] = "RelativeJsonError", s[s.RequestCodeError = 9030] = "RequestCodeError", s[s.RequestResultError = 9031] = "RequestResultError", s[s.RequestUnknownError = 9032] = "RequestUnknownError", s))(p || {}), $ = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))($ || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), G = /* @__PURE__ */ ((s) => (s.JSON = "application/json", s.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", s.FORM_DATA = "multipart/form-data;charset=UTF-8", s.OCTET_STREAM = "'application/octet-stream", s))(G || {});
|
|
1
|
+
var ct = /* @__PURE__ */ ((s) => (s.Hw = "huawei", s.Ali = "aliyun", s.Hs = "hs", s.Aws = "amazon", s.Minio = "minio", s))(ct || {}), _ = /* @__PURE__ */ ((s) => (s.en_US = "en-US", s.zh_CN = "zh-CN", s.ja_JP = "ja-JP", s))(_ || {}), g = /* @__PURE__ */ ((s) => (s.WGS84 = "WGS84", s.WGS1984 = "WGS84", s.EPSG4326 = "WGS84", s.GCJ02 = "GCJ02", s.AMap = "GCJ02", s.BD09 = "BD09", s.BD09LL = "BD09", s.Baidu = "BD09", s.BMap = "BD09", s.BD09MC = "BD09MC", s.BD09Meter = "BD09MC", s.EPSG3857 = "EPSG3857", s.EPSG900913 = "EPSG3857", s.EPSG102100 = "EPSG3857", s.WebMercator = "EPSG3857", s.WM = "EPSG3857", s))(g || {}), b = /* @__PURE__ */ ((s) => (s[s.CADModel = 5] = "CADModel", s[s.BIMModel = 6] = "BIMModel", s[s.ForgeModel = 7] = "ForgeModel", s[s.ThreeDModel = 8] = "ThreeDModel", s[s.GeoModel = 9] = "GeoModel", s[s.SoonspaceModel = 10] = "SoonspaceModel", s[s.ScaleModel = 101] = "ScaleModel", s))(b || {}), ht = /* @__PURE__ */ ((s) => (s[s.Global = 0] = "Global", s))(ht || {}), v = /* @__PURE__ */ ((s) => (s[s.Space = 0] = "Space", s[s.Model = 1] = "Model", s[s.Data = 2] = "Data", s))(v || {}), A = /* @__PURE__ */ ((s) => (s[s.Used = 0] = "Used", s[s.Enabled = 1] = "Enabled", s[s.Disabled = 2] = "Disabled", s))(A || {}), p = /* @__PURE__ */ ((s) => (s[s.GeoPointNoPlane = 9e3] = "GeoPointNoPlane", s[s.PointUnmappedGIS = 9010] = "PointUnmappedGIS", s[s.PointNoXYZ = 9011] = "PointNoXYZ", s[s.PointNoPlane = 9012] = "PointNoPlane", s[s.RelativePlaneUnmatch = 9020] = "RelativePlaneUnmatch", s[s.RelativeNoPlane = 9021] = "RelativeNoPlane", s[s.RelativeJsonError = 9022] = "RelativeJsonError", s[s.RequestCodeError = 9030] = "RequestCodeError", s[s.RequestResultError = 9031] = "RequestResultError", s[s.RequestUnknownError = 9032] = "RequestUnknownError", s))(p || {}), $ = /* @__PURE__ */ ((s) => (s[s.SUCCESS = 200] = "SUCCESS", s[s.ERROR = -1] = "ERROR", s[s.TIMEOUT = 401] = "TIMEOUT", s))($ || {}), M = /* @__PURE__ */ ((s) => (s.GET = "GET", s.POST = "POST", s))(M || {}), G = /* @__PURE__ */ ((s) => (s.JSON = "application/json", s.FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8", s.FORM_DATA = "multipart/form-data;charset=UTF-8", s.OCTET_STREAM = "'application/octet-stream", s))(G || {});
|
|
2
2
|
const lt = {
|
|
3
3
|
baseUrl: "https://vsleem.com/api",
|
|
4
4
|
authorizeCode: ""
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(l=typeof globalThis<"u"?globalThis:l||self,C(l.Shared={}))})(this,(function(l){"use strict";var C=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(C||{}),k=(s=>(s.en_US="en-US",s.zh_CN="zh-CN",s.ja_JP="ja-JP",s))(k||{}),M=(s=>(s.WGS84="WGS84",s.WGS1984="WGS84",s.EPSG4326="WGS84",s.GCJ02="GCJ02",s.AMap="GCJ02",s.BD09="BD09",s.BD09LL="BD09",s.Baidu="BD09",s.BMap="BD09",s.BD09MC="BD09MC",s.BD09Meter="BD09MC",s.EPSG3857="EPSG3857",s.EPSG900913="EPSG3857",s.EPSG102100="EPSG3857",s.WebMercator="EPSG3857",s.WM="EPSG3857",s))(M||{}),x=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.GeoModel=9]="GeoModel",s[s.ScaleModel=101]="ScaleModel",s))(x||{}),q=(s=>(s[s.Global=0]="Global",s))(q||{}),S=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(S||{}),O=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(O||{}),g=(s=>(s[s.GeoPointNoPlane=9e3]="GeoPointNoPlane",s[s.PointUnmappedGIS=9010]="PointUnmappedGIS",s[s.PointNoXYZ=9011]="PointNoXYZ",s[s.PointNoPlane=9012]="PointNoPlane",s[s.RelativePlaneUnmatch=9020]="RelativePlaneUnmatch",s[s.RelativeNoPlane=9021]="RelativeNoPlane",s[s.RelativeJsonError=9022]="RelativeJsonError",s[s.RequestCodeError=9030]="RequestCodeError",s[s.RequestResultError=9031]="RequestResultError",s[s.RequestUnknownError=9032]="RequestUnknownError",s))(g||{}),U=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(U||{}),v=(s=>(s.GET="GET",s.POST="POST",s))(v||{}),L=(s=>(s.JSON="application/json",s.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",s.FORM_DATA="multipart/form-data;charset=UTF-8",s.OCTET_STREAM="'application/octet-stream",s))(L||{});const J={baseUrl:"https://vsleem.com/api",authorizeCode:""},W={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},V={url:"",method:v.GET,headers:{}},Z=[{name:"GAODE",patterns:["amap","amap.com","autonavi.com","restapi.amap.com","tiles.amap.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"BAIDU",patterns:["baidu","baidu.com","bdimg.com"],CRSTypes:[M.BD09,M.WGS84]},{name:"TENCENT",patterns:["qq.com","map.qq.com","map.gtimg.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"TIANDITU",patterns:["tianditu","tianditu.gov.cn"],CRSTypes:[M.WGS84,M.WGS84]},{name:"GOOGLE",patterns:["google","googleapis","google.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"OPENSTREET",patterns:["openstreetmap","openstreetmap.org"],CRSTypes:[M.WGS84,M.WGS84]}],mt=[{url:"https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",options:{subdomains:["0","1","2","3","4","5","6","7"],attribution:"© 天地图 GS(2022)3124号"}},{url:"https://t{s}.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",options:{subdomains:["0","1","2","3","4","5","6","7"]}}];class m extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,m.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const H={...J};function yt(s){const{baseUrl:t,authorizeCode:e,locale:i}=s;Object.assign(H,{baseUrl:t,authorizeCode:e,locale:i})}async function E(s,t){const e={...W,...t},i={...V,...s};try{const n=wt(i,e),{url:o,...r}=n,c=await(await window.fetch(o,r)).json();return pt(c,e)}catch(n){return gt(n)}}function wt(s,t){const{baseUrl:e,authorizeCode:i,locale:n=k.zh_CN}=H,{joinBaseUrl:o,withAuthorize:r}=t;let{url:a,method:c,headers:u={},params:h,data:d}=s;o&&e&&(a=`${e}${a}`),c=c?.toUpperCase();const f={...u};if(/^https?:\/\/.+$/i.test(e??"")?f.PlatForm=new URL(e??"").host:f.PlatForm=new URL(window.location.href).host,r&&i&&(f.AuthorizationCode=i),c===v.POST&&!f["Content-Type"]&&(f["Content-Type"]=L.JSON),n&&(f["Accept-Language"]=n),c===v.GET&&h){const b=new URLSearchParams(h),ne=a.includes("?")?"&":"?";a+=ne+`${b.toString()}`}let P;return c===v.POST&&(P=f["Content-Type"]===L.JSON?JSON.stringify(d||{}):d),{url:a,method:c,headers:f,body:P}}function pt(s,t){if(!t.isTransformResponse)return s;if(!s)throw new m(g.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===U.SUCCESS)return i;throw new m(g.RequestCodeError,n||"请求返回的Code错误")}function gt(s){throw s instanceof Error?s:new m(g.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const Mt=Object.freeze(Object.defineProperty({__proto__:null,request:E,setRequestGlobalConfig:yt},Symbol.toStringTag,{value:"Module"}));function Q(s,t){return E({url:"/project/jssdk/cs/list",method:v.GET,params:s},t)}function K(s,t){return E({url:"/project/jssdk/cs/bind",method:v.POST,data:s},t)}function X(s,t){return E({url:"/project/jssdk/cs/save",method:v.POST,data:s},t)}function tt(s,t){return E({url:"/project/jssdk/cs/delete",method:v.POST,data:s},t)}function et(s,t){return E({url:"/project/jssdk/cs/mapping",method:v.POST,data:s},t)}function st(s,t){return E({url:"/project/jssdk/cs/mapping/query",method:v.GET,params:s},t)}function it(s,t){return E({url:"/project/jssdk/project/detail",method:v.GET,params:s},t)}function vt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return E({url:s,method:v.GET},t)}const St=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:K,getCoordinateList:Q,getImageInfo:vt,getMappingRelation:st,getProjectDetail:it,mapingCoordinate:et,removeCoordinate:tt,saveCoordinate:X},Symbol.toStringTag,{value:"Module"})),Tt=typeof window<"u",xt=Object.prototype.toString;function I(s,t){return xt.call(s)===`[object ${t}]`}function nt(s){return typeof s<"u"}function ot(s){return!nt(s)}function D(s){return s!==null&&I(s,"Object")}function rt(s){return s===null}function bt(s){return I(s,"Date")}function Et(s){return I(s,"String")}function B(s){return typeof s=="function"}function Pt(s){return I(s,"Boolean")}function It(s){return I(s,"RegExp")}function T(s){return s&&Array.isArray(s)}function Dt(s){return typeof window<"u"&&I(s,"Window")}function Ct(s){return D(s)&&!!s.tagName}function A(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function Rt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function Nt(s){return ot(s)||rt(s)}function zt(s){return I(s,"Promise")&&D(s)&&B(s.then)&&B(s.catch)}function Ot(s,t={}){return new Promise((e,i)=>{const n=R(s);if(Lt(n)){e(!0);return}const o=document.createElement("script");o.src=s,Object.entries(t).forEach(([r,a])=>{a!==!1&&o.setAttribute(r,a===!0?"":String(a))}),o.onload=()=>{e(!0)},o.onerror=()=>{document.head.removeChild(o),i(new Error(`Failed to load script: ${s}`))},document.head.appendChild(o)})}function Lt(s){const t=R(s);return Array.from(document.scripts).some(e=>R(e.src)===t)}function At(s){return new Promise((t,e)=>{const i=R(s);if(Gt(i)){t(!0);return}const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=s,n.onload=()=>{t(!0)},n.onerror=()=>{document.head.removeChild(n),e(new Error(`Failed to load link: ${s}`))},document.head.appendChild(n)})}function Gt(s){const t=R(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>R(e.href)===t)}function R(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function at(s){return N(s,new WeakMap)}function N(s,t){if(typeof s!="object"||s===null)return s;if(t.has(s))return t.get(s);let e;if(s instanceof Date)return e=new Date(s),t.set(s,e),e;if(s instanceof RegExp)return e=new RegExp(s),t.set(s,e),e;if(s instanceof Map)return e=new Map,t.set(s,e),s.forEach((n,o)=>{e.set(o,N(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(N(n,t))}),e;if(ArrayBuffer.isView(s))return e=new s.constructor(s.buffer.slice(0),s.byteOffset,s.byteLength),t.set(s,e),e;if(s instanceof ArrayBuffer)return e=s.slice(0),t.set(s,e),e;if(Array.isArray(s)){e=[],t.set(s,e);for(let n=0;n<s.length;n++)n in s&&(e[n]=N(s[n],t));return e}e=Object.create(Object.getPrototypeOf(s)),t.set(s,e);for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=N(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=N(s[n],t));return e}function jt(s,t,e=!1){let i;const n=function(...o){const r=this,a=e&&!i;i&&clearTimeout(i),i=setTimeout(()=>{i=void 0,e||s.apply(r,o)},t),a&&s.apply(r,o)};return n.cancel=()=>{i&&clearTimeout(i),i=void 0},n}function kt(s,t,e=!1){let i,n;const o=function(...r){const a=this;n?(clearTimeout(i),i=setTimeout(()=>{Date.now()-n>=t&&(s.apply(a,r),n=Date.now())},t-(Date.now()-n))):(e&&s.apply(a,r),n=Date.now())};return o.cancel=()=>{clearTimeout(i),i=void 0,n=void 0},o}function F(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(G(s)&&G(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:G(n)&&G(o)?s[i]=F({...n},o):o!==void 0&&(s[i]=o)}),F(s,...t))}function G(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function ct(s,...t){if(!t.length)return s;for(const e of t)e!=null&&typeof e=="object"&&Object.keys(e).forEach(i=>{const n=e[i],o=s[i];n!==null&&typeof n=="object"&&!Array.isArray(n)?((!o||typeof o!="object")&&(s[i]={}),ct(s[i],n)):s[i]=n});return s}function ht(s,t){const e={};if(D(s)&&!T(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=D(t)&&!T(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(T(n)&&T(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(D(n)&&D(o)){const r=ht(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(D(t)&&T(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function Ut(s=0){return new Promise(t=>setTimeout(t,s))}function Xt(s){console.warn(`[warn]:${s}`)}function Bt(s){throw new Error(`[error]:${s}`)}function Ft(s){if(s)return Z.find(t=>t?.patterns?.some(e=>s.includes(e)))}function Yt(s,t,e,i){const n=Math.min(s/e,t/i),o=e*n,r=i*n;return{scale:n,x:(s-o)/2,y:(t-r)/2,sw:o,sh:r}}function _t(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function $t(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}const lt="0123456789abcdef";function qt(){let s="";const t=new Uint8Array(16);if(typeof crypto<"u"&&"getRandomValues"in crypto)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(s+="-"),s+=lt[t[e]>>>4],s+=lt[t[e]&15];return s}let Y=0;const Jt=9999;function Wt(s=""){const t=Date.now(),e=Math.floor(Math.random()*1e6);return Y=(Y+1)%Jt,`${s}${s?"_":""}${t}_${Y.toString().padStart(4,"0")}_${e.toString().padStart(6,"0")}`}const Vt=Object.freeze(Object.defineProperty({__proto__:null,buildShortUUID:Wt,buildUUID:qt,cloneDeep:at,debounce:jt,deepMerge:F,deepMergeProps:ct,delay:Ut,error:Bt,getDiffProps:ht,getImageTransform:Yt,getMapProvider:Ft,inBrowser:Tt,is:I,isArray:T,isBoolean:Pt,isDate:bt,isDef:nt,isElement:Ct,isFunction:B,isNull:rt,isNullOrUnDef:Nt,isNumeric:A,isObject:D,isPromise:zt,isRegExp:It,isSameValue:Rt,isString:Et,isUnDef:ot,isWindow:Dt,loadCss:At,loadScript:Ot,throttle:kt,toCanvasCoord:_t,toModelCoord:$t,warn:Xt},Symbol.toStringTag,{value:"Module"}));class y{x=0;y=0;z=0;lat=0;lon=0;alt=0;yaw=0;pitch=0;roll=0;hasXYZ=!1;hasGeo=!1;hasAngle=!1;plane="xy";constructor(t){const{x:e,y:i,z:n,lat:o,lon:r,alt:a,yaw:c,pitch:u,roll:h,plane:d="xy"}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,(this.x!==0||this.y!==0||this.z!==0)&&(this.plane=d,this.hasXYZ=!0),this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,(this.lat!==0||this.lon!==0||this.alt!==0)&&(this.hasGeo=!0),this.yaw=Number(c)||0,this.pitch=Number(u)||0,this.roll=Number(h)||0,(A(c)||A(u)||A(h))&&(this.hasAngle=!0)}static dist(t,e){return Math.hypot(t.x-e.x,t.y-e.y,t.z-e.z)}static distXZ(t,e){return Math.hypot(t.x-e.x,t.z-e.z)}static distXY(t,e){return Math.hypot(t.x-e.x,t.y-e.y)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,i){const n={x:t.x-e.x,z:t.z-e.z},o={x:i.x-e.x,z:i.z-e.z},r=n.x*o.x+n.z*o.z,a=Math.sqrt(n.x**2+n.z**2),c=Math.sqrt(o.x**2+o.z**2),u=Math.max(-1,Math.min(1,r/(a*c))),d=Math.acos(u)*180/Math.PI;return Math.min(d,360-d)}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new y({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,i){try{if(e?.id===i?.id)return new y(this);if(e?.modelType===x.GeoModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=z.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===x.GeoModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=z.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new m(g.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new m(g.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=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=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=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=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class z{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=Number(e)||0,this.lon=Number(i)||0,this.alt=Number(n)||0}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let c,u,h;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.z/1e3}else throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy");return new z({lat:u,lon:c,alt:h})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,c=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),h=a*c*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:h*1e3,y:t.alt*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:h*1e3,y:d*1e3,z:t.alt*1e3,plane:"xy"});throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy")}}class w{scale=1;yaw=0;x=0;y=0;z=0;start=0;end=-1;plane="xy";refPoint;constructor(t){const{refPoint:e,...i}=t||{};e&&(this.refPoint=new z(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new m(g.RelativePlaneUnmatch,"两个映射关系的plane应该相同");const i=t.scale*e.scale,n=t.yaw+e.yaw,o=Math.cos(e.yaw),r=Math.sin(e.yaw);let a=0,c=0,u=0;if(t.plane==="xz"){const h=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else if(t.plane==="xy"){const h=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:i,yaw:n,x:a,y:c,z:u,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,i=-t.yaw,n=Math.cos(-i),o=Math.sin(-i);let r=0,a=0,c=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,c=-(t.z*n-t.x*o)*e;else if(t.plane==="xy")r=-(t.x*n+t.y*o)*e,a=-(t.y*n-t.x*o)*e,c=-t.z*e;else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:e,yaw:i,x:r,y:a,z:c,start:t.start,end:t.end,plane:t.plane})}static toParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:i}=e||{};return i&&(e={refPoint:i}),e?new w(e):void 0}catch{throw new m(g.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}static isValid(t){return t&&t!=='{"scale":1.0, "yaw":0.0, "x":0.0, "y":0.0, "z":0.0}'}}class p{static async getProjectDetail(t){return await it({projectId:t})}static async getCoordinateTree(t){const e=await Q({projectId:t});if(e.length){const i=p.handleCoordinateList(e);return p.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=p.flattenCoordinateTree(t);return p.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,modelType:u,relativeMap:h,level:d,...f}=a,P=h?JSON.stringify(h):void 0;return{...f,projectId:i,parentId:n,coordinateType:c,renderType:u,relativePosition:P}}),r=await X(o);return p.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await tt(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,relativeMap:u,level:h,...d}=a,f=w.toStringify(u);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await X(o);return p.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:c}=a;return{modelId:c,parentId:n,projectId:i}}),r=await K(o);return p.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,c=o===x.GeoModel?new w(w.toParse(r)):w.toParse(r);return new j({...a,type:i,modelType:o,modelValue:n,relativeMap:c})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:c,relativeMap:u,...h}=r,d=new j({...h,relativeMap:new w(u)});i.push(d),r.children&&r.children.length>0&&n(r.children)}}return n(e),i}static buildCoordinateTree(t,e=0){const i=new Map,n=[];return t.forEach(o=>{i.set(String(o.id),o)}),t.forEach(o=>{const r=i.get(String(o.id));if(r)if(o.parentId===e)r.level=0,n.push(r);else{const a=i.get(String(o.parentId??-1));a&&(r.type===S.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(p.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===S.Space){const n=Number(i?.relativeMap?.z)-Number(e?.relativeMap?.z);return n!==0?n:Number(i.createTime)-Number(e.createTime)}else return e.status===0&&i.status!==0?-1:i.status===0&&e.status!==0?1:Number(i.createTime)-Number(e.createTime)}),t.children.forEach(p.sortCoordinateTree))}static filterSpaceTree(t,e){const i=[];return t.forEach(n=>{const o=new j(n);e&&(o.parent=e);const r=p.filterSpaceTree(o.children,o);o.children=r,o.disabled=o.disabled??!1,o.type!==S.Model&&i.push(o)}),i}}class j{id=0;type=0;children=[];level;relativeMap;no;name;shortName;status;modelId;modelType;modelValue;projectId;parentId;parent;groupUuid;z;createTime;disabled;constructor(t){this.setOptions(t)}get spaceList(){return this.children.filter(t=>t.type===S.Space)}get modelList(){return this.children.filter(t=>t.type===S.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}setOptions(t){const{relativeMap:e,parent:i,children:n,...o}=t||{};e&&(this.relativeMap=new w(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=T(t)?t:[t],i=await p.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=T(t)?t:[t];await p.removeCoordinate(this,e);for(const i of e){const n=this.children.findIndex(o=>o.id===i.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=T(t)?t:[t],i=await p.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=T(t)?t:[t],i=await p.bindCoordinate(this,e);return this.mergeChild(i),i}async mergeChild(t){t?.length&&t.forEach(e=>{const i=this.children.find(n=>n.id===e.id);if(i){const{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await et(t)}async getMapping(){return(await st({srcCsId:this.id}))[0]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t,e=!0){const i=T(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==O.Disabled?this:([S.Data,S.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,c)=>Number(a.status)-Number(c.status))?.[0]}findClosestModel(t=[x.CADModel,x.BIMModel,x.ForgeModel,x.ThreeDModel,x.GeoModel],e){const i=T(t)?t:[t],n=new Set;e?.forEach(h=>{n.add(String(h.id))});const o=[{node:this,distance:0}],r=new Set,a=[];for(;o.length>0;){const{node:h,distance:d}=o.shift();if(n.has(String(h.id))||r.has(h))continue;const f=h.modelType??-1;i.includes(f)&&a.push({node:h,distance:d,modelType:f}),r.add(h);const P=[];if(h.children)for(const b of h.children)r.has(b)||P.push(b);if(h.parent?.children)for(const b of h.parent.children)b!==h&&!r.has(b)&&P.push(b);h.parent&&!r.has(h.parent)&&P.push(h.parent);for(const b of P)o.push({node:b,distance:d+1})}if(a.length===0)return;const c=Math.min(...a.map(h=>h.distance)),u=a.filter(h=>h.distance===c);return u.sort((h,d)=>h.modelType-d.modelType),u[0]?.node}findParentSpace(){let t=this;for(;t&&t.type!==S.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===S.Space&&(e.unshift(i.fullName),t--),i=i.parent;return e}findCsGroup(){const{groupUuid:t,parent:e}=this;return t?e?.children?.filter(i=>i.groupUuid===t)||[]:[]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const i=e.findCsByLevel(t);if(i)return i}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const i=e.findCsById(t);if(i)return i}}}getCsRoutes(t=!1){let e=this;const i=[e];for(;e?.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&i.push(e);return i}getMappedCsTree(){function t(n){return n.children?.length&&(n.children=n.children.filter(o=>!!o?.relativeMap&&o.status!==O.Disabled).map(o=>t(o))),n}const e=at(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new w;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new w;return e?.forEach(o=>{n=w.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=w.addRelativeMap(n,w.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t?.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}static filterCoordinateTree(t,e=[],i=[]){if(i.includes(t.id)||e.includes(t.type))return;const n=t.children?.map(o=>this.filterCoordinateTree(o,e,i)).filter(o=>o!==void 0);return{...t,children:n}}static getCommonCoordinate(t){let e;const i=t.map(n=>n.getCsRoutes(!0).filter(r=>r.id&&r.type===S.Space));for(;this.checkSameCoordinate(i);){const o=i.shift();o?.length&&(e=o[0])}return e}static checkSameCoordinate(t){if(t.length){if(t.length===1)return!0;for(let e=0;e<t.length-1;e++){const i=t[e];if(!i?.length)return!1;const n=t[e+1];if(!n?.length||i[0].id!==n[0].id)return!1}return!0}else return!1}}class _{yaw=0;pitch=0;roll=0;constructor(t){const{yaw:e=0,pitch:i=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(i)||0,this.roll=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new _({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class ${x=0;y=0;z=0;constructor(t){const{x:e=0,y:i=0,z:n=0}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new $({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class Zt{static srcPointToDstPoint(t,e,i){if(!e||!i||!t?.length)return[];const n=e?.getDestRelativeMap(i);if(!n)return[];const o=[];return t.forEach(r=>{const a=r.projection(n,e,i);a&&o.push(a)}),o}}class Ht{canvas;ctx;options;offset={x:0,y:0};curOffset={x:0,y:0};mousePosition={x:-1,y:-1};MAX_SCALE=60;MIN_SCALE=1;STEP_SCALE=.5;scale=1;preScale=1;width=0;height=0;x=0;y=0;timeout=0;lastTouch;initialDistance=0;touchMode=0;isMouseover=!1;isBindEvent=!0;isDrawAssist=!1;customDrawAssist;isMoveRedrawing;afterDraw;screenPos={screenX:0,screenY:0};constructor(t){const{container:e,width:i=300,height:n=300,isBindEvent:o=!0,isDrawAssist:r=!1,isMoveRedrawing:a,customDrawAssist:c,afterDraw:u,...h}=t;this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.width=i,this.height=n,this.canvas.width=i,this.canvas.height=n,this.isBindEvent=o,this.isDrawAssist=r,this.customDrawAssist=c,this.isMoveRedrawing=a??r,this.options=h,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,o&&(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:i}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:i},this.options.onClick&&(this.timeout=setTimeout(()=>{const o=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),r=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(o,r)},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},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+i.x)/2,clientY:(e.y+i.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(i.x-e.x,2)+Math.pow(i.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:i}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(i-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},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.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 i=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+i).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:i=0,lastTouchX:n=0,lastTouchY:o=0}=this.lastTouch||{};e-i<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-o)<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:i=this.height,scale:n=1,preScale:o=1,offset:r={x:0,y:0},curOffset:a={x:0,y:0}}=t||{};this.width=e,this.height=i,this.canvas.width=e,this.canvas.height=i,this.scale=n,this.preScale=o,this.offset=r,this.curOffset=a}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(){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()),this.afterDraw?.(this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let i=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return i=i<0?0:i,n=n<0?0:n,{x:i,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 ut={};class Qt{type="image";x;y;width;height;img;src;redraw;constructor(t){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=ut[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.crossOrigin="anonymous",i.src=this.src,i.onload=()=>{ut[this.src]=i,t?.(i),this.redraw?.()},i}}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 Kt{id="";type="point";x;y;r;text;backgroundColor;index;pIndex;parentId;constructor(t){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 i=1/e.scale;t.beginPath(),t.arc(this.x,this.y,this.r*i,0,2*Math.PI),t.fillStyle=this.backgroundColor,t.fill(),t.font=`${this.r*i}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.text,this.x,this.y+this.r*i/3),t.restore()}}const dt={};class te{id="";type="issue";x;y;width;height;src;img;index;pIndex;parentId;count;badgeR;redraw;constructor(t){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=dt[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.src,i.crossOrigin="anonymous",i.onload=()=>{dt[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t,e){if(!this.img.complete)return;const i=1/e.scale,n=this.width*i,o=this.height*i,r=this.x-n/2,a=this.y-o,c=this.badgeR*i,u=c*1.5;t.save(),t.drawImage(this.img,r,a,n,o),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-o*.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-o*.8+c/2)),t.restore()}}const ft={};class ee{type="marker";x;y;url;width;height;anchor;img;scale;redraw;beforeDraw;constructor(t){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=ft[this.url];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.url,i.crossOrigin="anonymous",i.onload=()=>{ft[this.url]=i,t?.(i),this.redraw?.()},i}}calculateIconPosition(){const t=this.anchor?.x??this.width/2,e=this.anchor?.y??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){if(this.beforeDraw?.(t,e),!this.img?.complete)return;const{iconStartX:i,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,i,n,this.width*this.scale,this.height*this.scale)}catch(o){console.error("绘制标记时出错:",o)}finally{t.restore()}}}class se{type="radar";x;y;r;angle;text;hFov=90;beforeDraw;constructor(t){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){this.beforeDraw?.(t,e);const i=1/e.scale,[n,o]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const r=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*i);r.addColorStop(0,"rgba(180, 42, 42, 1)"),r.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*i,n,o),t.closePath(),t.fillStyle=r,t.fill(),t.restore()}}class ie{type="region";x;y;shape;areaPoints;backgroundColor;constructor(t){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:i},{},{x:n,y:o}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.max(i,o)},{x:Math.min(e,n),y:Math.max(i,o)}]}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:i,y:n},{},{x:o,y:r}]=this.areaPoints,a=Math.abs(o-i)/2,c=i+(o-i)/2,u=n+(r-n)/2;t.arc(c,u,a,0,2*Math.PI)}else this.areaPoints.forEach((i,n)=>{const{x:o,y:r}=i;n===0?t.moveTo(o,r):t.lineTo(o,r)});t.fill(),t.restore()}}l.APP_SETTING=J,l.AppError=m,l.AppErrorCode=g,l.AppObsType=C,l.CRSTypes=M,l.CanvasElement=Ht,l.CanvasImageElement=Qt,l.CanvasIssueElement=te,l.CanvasMarkerElement=ee,l.CanvasPointElement=Kt,l.CanvasRadarElement=se,l.CanvasRegionElement=ie,l.Coordinate=j,l.CoordinateLevel=q,l.CoordinateModelType=x,l.CoordinateStatus=O,l.CoordinateType=S,l.DataHelper=Zt,l.DataSource=p,l.GeoPoint=z,l.LocaleType=k,l.MAP_PROVIDERS=Z,l.MAP_TILE_LAYERS=mt,l.Point=y,l.Position=_,l.REQUEST_CONFIG=V,l.REQUEST_OPTIONS=W,l.RelativeMap=w,l.RequestContentType=L,l.RequestMethod=v,l.RequestResultCode=U,l.Vector3=$,l.api=St,l.http=Mt,l.utils=Vt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(l,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(l=typeof globalThis<"u"?globalThis:l||self,C(l.Shared={}))})(this,(function(l){"use strict";var C=(s=>(s.Hw="huawei",s.Ali="aliyun",s.Hs="hs",s.Aws="amazon",s.Minio="minio",s))(C||{}),k=(s=>(s.en_US="en-US",s.zh_CN="zh-CN",s.ja_JP="ja-JP",s))(k||{}),M=(s=>(s.WGS84="WGS84",s.WGS1984="WGS84",s.EPSG4326="WGS84",s.GCJ02="GCJ02",s.AMap="GCJ02",s.BD09="BD09",s.BD09LL="BD09",s.Baidu="BD09",s.BMap="BD09",s.BD09MC="BD09MC",s.BD09Meter="BD09MC",s.EPSG3857="EPSG3857",s.EPSG900913="EPSG3857",s.EPSG102100="EPSG3857",s.WebMercator="EPSG3857",s.WM="EPSG3857",s))(M||{}),x=(s=>(s[s.CADModel=5]="CADModel",s[s.BIMModel=6]="BIMModel",s[s.ForgeModel=7]="ForgeModel",s[s.ThreeDModel=8]="ThreeDModel",s[s.GeoModel=9]="GeoModel",s[s.SoonspaceModel=10]="SoonspaceModel",s[s.ScaleModel=101]="ScaleModel",s))(x||{}),q=(s=>(s[s.Global=0]="Global",s))(q||{}),S=(s=>(s[s.Space=0]="Space",s[s.Model=1]="Model",s[s.Data=2]="Data",s))(S||{}),O=(s=>(s[s.Used=0]="Used",s[s.Enabled=1]="Enabled",s[s.Disabled=2]="Disabled",s))(O||{}),g=(s=>(s[s.GeoPointNoPlane=9e3]="GeoPointNoPlane",s[s.PointUnmappedGIS=9010]="PointUnmappedGIS",s[s.PointNoXYZ=9011]="PointNoXYZ",s[s.PointNoPlane=9012]="PointNoPlane",s[s.RelativePlaneUnmatch=9020]="RelativePlaneUnmatch",s[s.RelativeNoPlane=9021]="RelativeNoPlane",s[s.RelativeJsonError=9022]="RelativeJsonError",s[s.RequestCodeError=9030]="RequestCodeError",s[s.RequestResultError=9031]="RequestResultError",s[s.RequestUnknownError=9032]="RequestUnknownError",s))(g||{}),U=(s=>(s[s.SUCCESS=200]="SUCCESS",s[s.ERROR=-1]="ERROR",s[s.TIMEOUT=401]="TIMEOUT",s))(U||{}),v=(s=>(s.GET="GET",s.POST="POST",s))(v||{}),L=(s=>(s.JSON="application/json",s.FORM_URLENCODED="application/x-www-form-urlencoded;charset=UTF-8",s.FORM_DATA="multipart/form-data;charset=UTF-8",s.OCTET_STREAM="'application/octet-stream",s))(L||{});const J={baseUrl:"https://vsleem.com/api",authorizeCode:""},W={isTransformResponse:!0,joinBaseUrl:!0,withAuthorize:!0},V={url:"",method:v.GET,headers:{}},Z=[{name:"GAODE",patterns:["amap","amap.com","autonavi.com","restapi.amap.com","tiles.amap.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"BAIDU",patterns:["baidu","baidu.com","bdimg.com"],CRSTypes:[M.BD09,M.WGS84]},{name:"TENCENT",patterns:["qq.com","map.qq.com","map.gtimg.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"TIANDITU",patterns:["tianditu","tianditu.gov.cn"],CRSTypes:[M.WGS84,M.WGS84]},{name:"GOOGLE",patterns:["google","googleapis","google.com"],CRSTypes:[M.GCJ02,M.WGS84]},{name:"OPENSTREET",patterns:["openstreetmap","openstreetmap.org"],CRSTypes:[M.WGS84,M.WGS84]}],mt=[{url:"https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",options:{subdomains:["0","1","2","3","4","5","6","7"],attribution:"© 天地图 GS(2022)3124号"}},{url:"https://t{s}.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=99d9995c80e5ae67e043d659b748eb4b",options:{subdomains:["0","1","2","3","4","5","6","7"]}}];class m extends Error{constructor(t,e,i){super(e),this.code=t,this.message=e,this.details=i,this.name="Apprror",Object.setPrototypeOf(this,m.prototype)}toJSON(){return{code:this.code,message:this.message,details:this.details,timestamp:new Date().toISOString()}}}const H={...J};function yt(s){const{baseUrl:t,authorizeCode:e,locale:i}=s;Object.assign(H,{baseUrl:t,authorizeCode:e,locale:i})}async function E(s,t){const e={...W,...t},i={...V,...s};try{const n=wt(i,e),{url:o,...r}=n,c=await(await window.fetch(o,r)).json();return pt(c,e)}catch(n){return gt(n)}}function wt(s,t){const{baseUrl:e,authorizeCode:i,locale:n=k.zh_CN}=H,{joinBaseUrl:o,withAuthorize:r}=t;let{url:a,method:c,headers:u={},params:h,data:d}=s;o&&e&&(a=`${e}${a}`),c=c?.toUpperCase();const f={...u};if(/^https?:\/\/.+$/i.test(e??"")?f.PlatForm=new URL(e??"").host:f.PlatForm=new URL(window.location.href).host,r&&i&&(f.AuthorizationCode=i),c===v.POST&&!f["Content-Type"]&&(f["Content-Type"]=L.JSON),n&&(f["Accept-Language"]=n),c===v.GET&&h){const b=new URLSearchParams(h),ne=a.includes("?")?"&":"?";a+=ne+`${b.toString()}`}let P;return c===v.POST&&(P=f["Content-Type"]===L.JSON?JSON.stringify(d||{}):d),{url:a,method:c,headers:f,body:P}}function pt(s,t){if(!t.isTransformResponse)return s;if(!s)throw new m(g.RequestResultError,"请求返回的结果错误");const{code:e,data:i,msg:n}=s;if(e===U.SUCCESS)return i;throw new m(g.RequestCodeError,n||"请求返回的Code错误")}function gt(s){throw s instanceof Error?s:new m(g.RequestUnknownError,typeof s=="string"?s:"未知的请求错误")}const Mt=Object.freeze(Object.defineProperty({__proto__:null,request:E,setRequestGlobalConfig:yt},Symbol.toStringTag,{value:"Module"}));function Q(s,t){return E({url:"/project/jssdk/cs/list",method:v.GET,params:s},t)}function K(s,t){return E({url:"/project/jssdk/cs/bind",method:v.POST,data:s},t)}function X(s,t){return E({url:"/project/jssdk/cs/save",method:v.POST,data:s},t)}function tt(s,t){return E({url:"/project/jssdk/cs/delete",method:v.POST,data:s},t)}function et(s,t){return E({url:"/project/jssdk/cs/mapping",method:v.POST,data:s},t)}function st(s,t){return E({url:"/project/jssdk/cs/mapping/query",method:v.GET,params:s},t)}function it(s,t){return E({url:"/project/jssdk/project/detail",method:v.GET,params:s},t)}function vt(s,t={isTransformResponse:!1,joinBaseUrl:!1,withAuthorize:!1}){return E({url:s,method:v.GET},t)}const St=Object.freeze(Object.defineProperty({__proto__:null,bindCoordinate:K,getCoordinateList:Q,getImageInfo:vt,getMappingRelation:st,getProjectDetail:it,mapingCoordinate:et,removeCoordinate:tt,saveCoordinate:X},Symbol.toStringTag,{value:"Module"})),Tt=typeof window<"u",xt=Object.prototype.toString;function I(s,t){return xt.call(s)===`[object ${t}]`}function nt(s){return typeof s<"u"}function ot(s){return!nt(s)}function D(s){return s!==null&&I(s,"Object")}function rt(s){return s===null}function bt(s){return I(s,"Date")}function Et(s){return I(s,"String")}function B(s){return typeof s=="function"}function Pt(s){return I(s,"Boolean")}function It(s){return I(s,"RegExp")}function T(s){return s&&Array.isArray(s)}function Dt(s){return typeof window<"u"&&I(s,"Window")}function Ct(s){return D(s)&&!!s.tagName}function A(s){return typeof s=="number"?!0:typeof s!="string"?!1:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(s)}function Rt(s,t){return JSON.stringify(s)===JSON.stringify(t)}function Nt(s){return ot(s)||rt(s)}function zt(s){return I(s,"Promise")&&D(s)&&B(s.then)&&B(s.catch)}function Ot(s,t={}){return new Promise((e,i)=>{const n=R(s);if(Lt(n)){e(!0);return}const o=document.createElement("script");o.src=s,Object.entries(t).forEach(([r,a])=>{a!==!1&&o.setAttribute(r,a===!0?"":String(a))}),o.onload=()=>{e(!0)},o.onerror=()=>{document.head.removeChild(o),i(new Error(`Failed to load script: ${s}`))},document.head.appendChild(o)})}function Lt(s){const t=R(s);return Array.from(document.scripts).some(e=>R(e.src)===t)}function At(s){return new Promise((t,e)=>{const i=R(s);if(Gt(i)){t(!0);return}const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=s,n.onload=()=>{t(!0)},n.onerror=()=>{document.head.removeChild(n),e(new Error(`Failed to load link: ${s}`))},document.head.appendChild(n)})}function Gt(s){const t=R(s);return Array.from(document.querySelectorAll('link[rel="stylesheet"]')).some(e=>R(e.href)===t)}function R(s){try{const t=new URL(s,window.location.href);return`${t.origin}${t.pathname}`}catch{return s}}function at(s){return N(s,new WeakMap)}function N(s,t){if(typeof s!="object"||s===null)return s;if(t.has(s))return t.get(s);let e;if(s instanceof Date)return e=new Date(s),t.set(s,e),e;if(s instanceof RegExp)return e=new RegExp(s),t.set(s,e),e;if(s instanceof Map)return e=new Map,t.set(s,e),s.forEach((n,o)=>{e.set(o,N(n,t))}),e;if(s instanceof Set)return e=new Set,t.set(s,e),s.forEach(n=>{e.add(N(n,t))}),e;if(ArrayBuffer.isView(s))return e=new s.constructor(s.buffer.slice(0),s.byteOffset,s.byteLength),t.set(s,e),e;if(s instanceof ArrayBuffer)return e=s.slice(0),t.set(s,e),e;if(Array.isArray(s)){e=[],t.set(s,e);for(let n=0;n<s.length;n++)n in s&&(e[n]=N(s[n],t));return e}e=Object.create(Object.getPrototypeOf(s)),t.set(s,e);for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=N(s[n],t));const i=Object.getOwnPropertySymbols(s);for(const n of i)Object.prototype.propertyIsEnumerable.call(s,n)&&(e[n]=N(s[n],t));return e}function jt(s,t,e=!1){let i;const n=function(...o){const r=this,a=e&&!i;i&&clearTimeout(i),i=setTimeout(()=>{i=void 0,e||s.apply(r,o)},t),a&&s.apply(r,o)};return n.cancel=()=>{i&&clearTimeout(i),i=void 0},n}function kt(s,t,e=!1){let i,n;const o=function(...r){const a=this;n?(clearTimeout(i),i=setTimeout(()=>{Date.now()-n>=t&&(s.apply(a,r),n=Date.now())},t-(Date.now()-n))):(e&&s.apply(a,r),n=Date.now())};return o.cancel=()=>{clearTimeout(i),i=void 0,n=void 0},o}function F(s,...t){if(!t.length)return s;const e=t.shift();return e===void 0?s:(G(s)&&G(e)&&Object.keys(e).forEach(i=>{const n=s[i],o=e[i];Array.isArray(n)&&Array.isArray(o)?s[i]=[...n,...o]:G(n)&&G(o)?s[i]=F({...n},o):o!==void 0&&(s[i]=o)}),F(s,...t))}function G(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}function ct(s,...t){if(!t.length)return s;for(const e of t)e!=null&&typeof e=="object"&&Object.keys(e).forEach(i=>{const n=e[i],o=s[i];n!==null&&typeof n=="object"&&!Array.isArray(n)?((!o||typeof o!="object")&&(s[i]={}),ct(s[i],n)):s[i]=n});return s}function ht(s,t){const e={};if(D(s)&&!T(s)){for(const i in s)if(Object.prototype.hasOwnProperty.call(s,i)){const n=s[i],o=D(t)&&!T(t)?t[i]:void 0;if(!(i in(t||{})))e[i]=n;else if(T(n)&&T(o))JSON.stringify(n)!==JSON.stringify(o)&&(e[i]=n);else if(D(n)&&D(o)){const r=ht(n,o);r&&Object.keys(r).length>0&&(e[i]=r)}else n!==o&&(e[i]=n)}}if(D(t)&&T(t))for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&!(i in(s||{}))&&(e[i]=void 0);return e}function Ut(s=0){return new Promise(t=>setTimeout(t,s))}function Xt(s){console.warn(`[warn]:${s}`)}function Bt(s){throw new Error(`[error]:${s}`)}function Ft(s){if(s)return Z.find(t=>t?.patterns?.some(e=>s.includes(e)))}function Yt(s,t,e,i){const n=Math.min(s/e,t/i),o=e*n,r=i*n;return{scale:n,x:(s-o)/2,y:(t-r)/2,sw:o,sh:r}}function _t(s,t,e){return{x:s*e.scale+e.x,y:t*e.scale+e.y}}function $t(s,t,e){return{x:(s-e.x)/e.scale,y:(t-e.y)/e.scale}}const lt="0123456789abcdef";function qt(){let s="";const t=new Uint8Array(16);if(typeof crypto<"u"&&"getRandomValues"in crypto)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;for(let e=0;e<16;e++)(e===4||e===6||e===8||e===10)&&(s+="-"),s+=lt[t[e]>>>4],s+=lt[t[e]&15];return s}let Y=0;const Jt=9999;function Wt(s=""){const t=Date.now(),e=Math.floor(Math.random()*1e6);return Y=(Y+1)%Jt,`${s}${s?"_":""}${t}_${Y.toString().padStart(4,"0")}_${e.toString().padStart(6,"0")}`}const Vt=Object.freeze(Object.defineProperty({__proto__:null,buildShortUUID:Wt,buildUUID:qt,cloneDeep:at,debounce:jt,deepMerge:F,deepMergeProps:ct,delay:Ut,error:Bt,getDiffProps:ht,getImageTransform:Yt,getMapProvider:Ft,inBrowser:Tt,is:I,isArray:T,isBoolean:Pt,isDate:bt,isDef:nt,isElement:Ct,isFunction:B,isNull:rt,isNullOrUnDef:Nt,isNumeric:A,isObject:D,isPromise:zt,isRegExp:It,isSameValue:Rt,isString:Et,isUnDef:ot,isWindow:Dt,loadCss:At,loadScript:Ot,throttle:kt,toCanvasCoord:_t,toModelCoord:$t,warn:Xt},Symbol.toStringTag,{value:"Module"}));class y{x=0;y=0;z=0;lat=0;lon=0;alt=0;yaw=0;pitch=0;roll=0;hasXYZ=!1;hasGeo=!1;hasAngle=!1;plane="xy";constructor(t){const{x:e,y:i,z:n,lat:o,lon:r,alt:a,yaw:c,pitch:u,roll:h,plane:d="xy"}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0,(this.x!==0||this.y!==0||this.z!==0)&&(this.plane=d,this.hasXYZ=!0),this.lat=Number(o)||0,this.lon=Number(r)||0,this.alt=Number(a)||0,(this.lat!==0||this.lon!==0||this.alt!==0)&&(this.hasGeo=!0),this.yaw=Number(c)||0,this.pitch=Number(u)||0,this.roll=Number(h)||0,(A(c)||A(u)||A(h))&&(this.hasAngle=!0)}static dist(t,e){return Math.hypot(t.x-e.x,t.y-e.y,t.z-e.z)}static distXZ(t,e){return Math.hypot(t.x-e.x,t.z-e.z)}static distXY(t,e){return Math.hypot(t.x-e.x,t.y-e.y)}static toRadians(t){return(Number(t)||0)*Math.PI/180}static toDegrees(t){return(Number(t)||0)*180/Math.PI}static angleXZ(t,e,i){const n={x:t.x-e.x,z:t.z-e.z},o={x:i.x-e.x,z:i.z-e.z},r=n.x*o.x+n.z*o.z,a=Math.sqrt(n.x**2+n.z**2),c=Math.sqrt(o.x**2+o.z**2),u=Math.max(-1,Math.min(1,r/(a*c))),d=Math.acos(u)*180/Math.PI;return Math.min(d,360-d)}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new y({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}projection(t,e,i){try{if(e?.id===i?.id)return new y(this);if(e?.modelType===x.GeoModel){const{refPoint:n}=e?.relativeMap||{};if(this.hasGeo&&n){const o=z.LLHToXYZ(this,n);return this.x=o.x,this.y=o.y,this.z=o.z,this.hasXYZ=!0,this.project(t)}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}if(i?.modelType===x.GeoModel){const{refPoint:n}=i?.relativeMap||{},o=this.project(t);if(o?.hasXYZ&&n){const r=z.XYZToLLH(o,n);return o.lat=r.lat,o.lon=r.lon,o.alt=r.alt,o.hasGeo=!0,o}throw new m(g.PointUnmappedGIS,"没有完成GIS与其他空间的映射")}return this.project(t)}catch(n){console.error(n);return}}project(t){if(!this.hasXYZ)throw new m(g.PointNoXYZ,"点没有xxz坐标信息");if(this.plane==="xz")return this.projectXZ(t);if(this.plane==="xy")return this.projectXY(t);throw new m(g.PointNoPlane,"点的plane应为xz或xy")}projectXZ(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=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=i+t.x,e.y+=t.y,e.z=n+t.z,e}projectXY(t){const e=new y(this);e.x*=t.scale,e.y*=t.scale,e.z*=t.scale,e.yaw!==void 0&&(e.yaw+=t.yaw);const i=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=i+t.x,e.y=n+t.y,e.z+=t.z,e}}class z{lat=0;lon=0;alt=0;constructor(t){const{lat:e=0,lon:i=0,alt:n=0}=t||{};this.lat=Number(e)||0,this.lon=Number(i)||0,this.alt=Number(n)||0}static XYZToLLH(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt;let c,u,h;if(t.plane==="xz"){const d=t.x/1e3/(a*Math.cos(r)),f=t.z/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.y/1e3}else if(t.plane==="xy"){const d=t.x/1e3/(a*Math.cos(r)),f=t.y/1e3/a;c=e.lon+y.toDegrees(d),u=e.lat-y.toDegrees(f),h=e.alt+t.z/1e3}else throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy");return new z({lat:u,lon:c,alt:h})}static LLHToXYZ(t,e){const n=.0033528106647474805,o=n*(2-n),r=y.toRadians(e.lat),a=6378137/Math.sqrt(1-o*Math.sin(r)**2)+e.alt,c=y.toRadians(t.lon-e.lon),u=y.toRadians(e.lat-t.lat),h=a*c*Math.cos(r),d=a*u;if(t.plane==="xz")return new y({x:h*1e3,y:t.alt*1e3,z:d*1e3,plane:"xz"});if(t.plane==="xy")return new y({x:h*1e3,y:d*1e3,z:t.alt*1e3,plane:"xy"});throw new m(g.GeoPointNoPlane,"点的plane应为xz或xy")}}class w{scale=1;yaw=0;x=0;y=0;z=0;start=0;end=-1;plane="xy";refPoint;constructor(t){const{refPoint:e,...i}=t||{};e&&(this.refPoint=new z(e)),Object.assign(this,i)}static addRelativeMap(t,e){if(t.plane!==e.plane)throw new m(g.RelativePlaneUnmatch,"两个映射关系的plane应该相同");const i=t.scale*e.scale,n=t.yaw+e.yaw,o=Math.cos(e.yaw),r=Math.sin(e.yaw);let a=0,c=0,u=0;if(t.plane==="xz"){const h=t.x*o-t.z*r,d=t.y,f=t.x*r+t.z*o;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else if(t.plane==="xy"){const h=t.x*o-t.y*r,d=t.x*r+t.y*o,f=t.z;a=e.x+h*e.scale,c=e.y+d*e.scale,u=e.z+f*e.scale}else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:i,yaw:n,x:a,y:c,z:u,start:t.start,end:t.end,plane:t.plane})}static inverseRelativeMap(t){const e=1/t.scale,i=-t.yaw,n=Math.cos(-i),o=Math.sin(-i);let r=0,a=0,c=0;if(t.plane==="xz")r=-(t.x*n+t.z*o)*e,a=-t.y*e,c=-(t.z*n-t.x*o)*e;else if(t.plane==="xy")r=-(t.x*n+t.y*o)*e,a=-(t.y*n-t.x*o)*e,c=-t.z*e;else throw new m(g.RelativeNoPlane,"映射关系的plane应为xz或xy");return new w({scale:e,yaw:i,x:r,y:a,z:c,start:t.start,end:t.end,plane:t.plane})}static toParse(t){try{let e=t?JSON.parse(t):void 0;const{reference_point:i}=e||{};return i&&(e={refPoint:i}),e?new w(e):void 0}catch{throw new m(g.RelativeJsonError,"relativeMap格式化失败")}}static toStringify(t){return t?JSON.stringify(t):void 0}static isValid(t){return t&&t!=='{"scale":1.0, "yaw":0.0, "x":0.0, "y":0.0, "z":0.0}'}}class p{static async getProjectDetail(t){return await it({projectId:t})}static async getCoordinateTree(t){const e=await Q({projectId:t});if(e.length){const i=p.handleCoordinateList(e);return p.buildCoordinateTree(i,0)}}static parsedCoordinateTree(t){const e=p.flattenCoordinateTree(t);return p.buildCoordinateTree(e,0)}static async addCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,modelType:u,relativeMap:h,level:d,...f}=a,P=h?JSON.stringify(h):void 0;return{...f,projectId:i,parentId:n,coordinateType:c,renderType:u,relativePosition:P}}),r=await X(o);return p.handleCoordinateList(r)}static async removeCoordinate(t,e){const i=e.map(n=>n.id??-1);return await tt(i)}static async updateCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{type:c,relativeMap:u,level:h,...d}=a,f=w.toStringify(u);return{...d,relativePosition:f,projectId:i,parentId:n}}),r=await X(o);return p.handleCoordinateList(r)}static async bindCoordinate(t,e){const{projectId:i,id:n}=t,o=e.map(a=>{const{modelId:c}=a;return{modelId:c,parentId:n,projectId:i}}),r=await K(o);return p.handleCoordinateList(r)}static handleCoordinateList(t){return t?.map(e=>{const{coordinateType:i,modelKey:n,renderType:o,relativePosition:r,...a}=e,c=o===x.GeoModel?new w(w.toParse(r)):w.toParse(r);return new j({...a,type:i,modelType:o,modelValue:n,relativeMap:c})})}static flattenCoordinateTree(t){const e=Array.isArray(t)?t:[t],i=[];function n(o){for(const r of o){const{level:a,parent:c,relativeMap:u,...h}=r,d=new j({...h,relativeMap:new w(u)});i.push(d),r.children&&r.children.length>0&&n(r.children)}}return n(e),i}static buildCoordinateTree(t,e=0){const i=new Map,n=[];return t.forEach(o=>{i.set(String(o.id),o)}),t.forEach(o=>{const r=i.get(String(o.id));if(r)if(o.parentId===e)r.level=0,n.push(r);else{const a=i.get(String(o.parentId??-1));a&&(r.type===S.Space&&(r.level=(Number(a.level)||0)+1),r.parent=a,a.children?.push(r))}}),n.forEach(p.sortCoordinateTree),n[0]}static sortCoordinateTree(t){t.children&&(t.children.sort((e,i)=>{if(e.type===S.Space){const n=Number(i?.relativeMap?.z)-Number(e?.relativeMap?.z);return n!==0?n:Number(i.createTime)-Number(e.createTime)}else return e.status===0&&i.status!==0?-1:i.status===0&&e.status!==0?1:Number(i.createTime)-Number(e.createTime)}),t.children.forEach(p.sortCoordinateTree))}static filterSpaceTree(t,e){const i=[];return t.forEach(n=>{const o=new j(n);e&&(o.parent=e);const r=p.filterSpaceTree(o.children,o);o.children=r,o.disabled=o.disabled??!1,o.type!==S.Model&&i.push(o)}),i}}class j{id=0;type=0;children=[];level;relativeMap;no;name;shortName;status;modelId;modelType;modelValue;projectId;parentId;parent;groupUuid;z;createTime;disabled;constructor(t){this.setOptions(t)}get spaceList(){return this.children.filter(t=>t.type===S.Space)}get modelList(){return this.children.filter(t=>t.type===S.Model)}get fullName(){const t=this.name?`(${this.name})`:"";return this.shortName?`${this.shortName}${t}`:this.name??""}setOptions(t){const{relativeMap:e,parent:i,children:n,...o}=t||{};e&&(this.relativeMap=new w(e)),i&&(this.parent=i),n?.length&&(this.children=n),Object.assign(this,o)}async addChild(t){const e=T(t)?t:[t],i=await p.addCoordinate(this,e);return this.mergeChild(i),i}async removeChild(t){const e=T(t)?t:[t];await p.removeCoordinate(this,e);for(const i of e){const n=this.children.findIndex(o=>o.id===i.id);n!==-1&&this.children.splice(n,1)}}async updateChild(t){const e=T(t)?t:[t],i=await p.updateCoordinate(this,e);return this.mergeChild(i),i}async bindChild(t){const e=T(t)?t:[t],i=await p.bindCoordinate(this,e);return this.mergeChild(i),i}async mergeChild(t){t?.length&&t.forEach(e=>{const i=this.children.find(n=>n.id===e.id);if(i){const{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h}=e;Object.assign(i,{relativeMap:n,no:o,name:r,shortName:a,status:c,modelId:u,modelValue:h})}else this.id===e.parentId&&(e.parent=this,this.children.unshift(e))})}async mappingTo(t){await et(t)}async getMapping(){return(await st({srcCsId:this.id}))[0]}findRoot(t=!1){let e=this;for(;e.parent&&!(t&&!e.relativeMap);)e=e.parent;return e}findChildModel(t,e=!0){const i=T(t)?t:[t];return i.includes(this.modelType??-1)&&this.status!==O.Disabled?this:([S.Data,S.Model].includes(this.type)?this.findParentSpace():this)?.modelList?.filter(a=>i.includes(a.modelType??-1)?e?!!a.relativeMap:!0:!1)?.sort((a,c)=>Number(a.status)-Number(c.status))?.[0]}findClosestModel(t=[x.CADModel,x.BIMModel,x.ForgeModel,x.ThreeDModel,x.GeoModel],e){const i=T(t)?t:[t],n=new Set;e?.forEach(h=>{n.add(String(h.id))});const o=[{node:this,distance:0}],r=new Set,a=[];for(;o.length>0;){const{node:h,distance:d}=o.shift();if(n.has(String(h.id))||r.has(h))continue;const f=h.modelType??-1;i.includes(f)&&a.push({node:h,distance:d,modelType:f}),r.add(h);const P=[];if(h.children)for(const b of h.children)r.has(b)||P.push(b);if(h.parent?.children)for(const b of h.parent.children)b!==h&&!r.has(b)&&P.push(b);h.parent&&!r.has(h.parent)&&P.push(h.parent);for(const b of P)o.push({node:b,distance:d+1})}if(a.length===0)return;const c=Math.min(...a.map(h=>h.distance)),u=a.filter(h=>h.distance===c);return u.sort((h,d)=>h.modelType-d.modelType),u[0]?.node}findParentSpace(){let t=this;for(;t&&t.type!==S.Space;)t=t.parent;return t}findParentSpaceNames(t=2){const e=[];let i=this;for(;i&&t>0;)i.type===S.Space&&(e.unshift(i.fullName),t--),i=i.parent;return e}findCsGroup(){const{groupUuid:t,parent:e}=this;return t?e?.children?.filter(i=>i.groupUuid===t)||[]:[]}findCsByLevel(t){if(this.level===t)return this;if(this.children.length)for(const e of this.children){const i=e.findCsByLevel(t);if(i)return i}}findCsById(t){if(t){if(this.id===t)return this;for(const e of this.children){const i=e.findCsById(t);if(i)return i}}}getCsRoutes(t=!1){let e=this;const i=[e];for(;e?.parent&&!(t&&!e.relativeMap);)e=e.parent,e&&i.push(e);return i}getMappedCsTree(){function t(n){return n.children?.length&&(n.children=n.children.filter(o=>!!o?.relativeMap&&o.status!==O.Disabled).map(o=>t(o))),n}const e=at(this.findRoot(!0)),i=t(e);return i.parentId=0,i.parent=void 0,i}getDestRelativeMap(t){if(this.id===t.id)return new w;const e=this.getRelativeMaps(),i=t.getRelativeMaps();let n=new w;return e?.forEach(o=>{n=w.addRelativeMap(n,o)}),i?.reverse()?.forEach(o=>{n=w.addRelativeMap(n,w.inverseRelativeMap(o))}),n}getRelativeMaps(){let t=this;const e=[];for(;t?.parent&&t.relativeMap;)e.push(t.relativeMap),t=t.parent;return e}static filterCoordinateTree(t,e=[],i=[]){if(i.includes(t.id)||e.includes(t.type))return;const n=t.children?.map(o=>this.filterCoordinateTree(o,e,i)).filter(o=>o!==void 0);return{...t,children:n}}static getCommonCoordinate(t){let e;const i=t.map(n=>n.getCsRoutes(!0).filter(r=>r.id&&r.type===S.Space));for(;this.checkSameCoordinate(i);){const o=i.shift();o?.length&&(e=o[0])}return e}static checkSameCoordinate(t){if(t.length){if(t.length===1)return!0;for(let e=0;e<t.length-1;e++){const i=t[e];if(!i?.length)return!1;const n=t[e+1];if(!n?.length||i[0].id!==n[0].id)return!1}return!0}else return!1}}class _{yaw=0;pitch=0;roll=0;constructor(t){const{yaw:e=0,pitch:i=0,roll:n=0}=t||{};this.yaw=Number(e)||0,this.pitch=Number(i)||0,this.roll=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new _({yaw:e[0],pitch:e[1],roll:e[2]})}}static toStringify(t){return t?`${t.yaw},${t.pitch},${t.roll}`:""}}class ${x=0;y=0;z=0;constructor(t){const{x:e=0,y:i=0,z:n=0}=t||{};this.x=Number(e)||0,this.y=Number(i)||0,this.z=Number(n)||0}static toParse(t){if(t){const e=t?.split(",").map(i=>Number(i)||0);return new $({x:e[0],y:e[1],z:e[2]})}}static toStringify(t){return t?`${t.x},${t.y},${t.z}`:""}}class Zt{static srcPointToDstPoint(t,e,i){if(!e||!i||!t?.length)return[];const n=e?.getDestRelativeMap(i);if(!n)return[];const o=[];return t.forEach(r=>{const a=r.projection(n,e,i);a&&o.push(a)}),o}}class Ht{canvas;ctx;options;offset={x:0,y:0};curOffset={x:0,y:0};mousePosition={x:-1,y:-1};MAX_SCALE=60;MIN_SCALE=1;STEP_SCALE=.5;scale=1;preScale=1;width=0;height=0;x=0;y=0;timeout=0;lastTouch;initialDistance=0;touchMode=0;isMouseover=!1;isBindEvent=!0;isDrawAssist=!1;customDrawAssist;isMoveRedrawing;afterDraw;screenPos={screenX:0,screenY:0};constructor(t){const{container:e,width:i=300,height:n=300,isBindEvent:o=!0,isDrawAssist:r=!1,isMoveRedrawing:a,customDrawAssist:c,afterDraw:u,...h}=t;this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.width=i,this.height=n,this.canvas.width=i,this.canvas.height=n,this.isBindEvent=o,this.isDrawAssist=r,this.customDrawAssist=c,this.isMoveRedrawing=a??r,this.options=h,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,o&&(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:i}=t;this.timeout&&clearTimeout(this.timeout);const n=this.getPos(t);this.x=n.x,this.y=n.y,this.screenPos={screenX:e,screenY:i},this.options.onClick&&(this.timeout=setTimeout(()=>{const o=parseFloat(((this.x-this.offset.x)/this.scale).toFixed(2)),r=parseFloat(((this.y-this.offset.y)/this.scale).toFixed(2));this.options.onClick(o,r)},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},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=this.getPos({clientX:(e.x+i.x)/2,clientY:(e.y+i.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(i.x-e.x,2)+Math.pow(i.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:i}=this.screenPos;(Math.abs(e-t.screenX)>10||Math.abs(i-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},i={x:t.touches[1].clientX,y:t.touches[1].clientY},n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.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 i=t.wheelDelta>0||t.detail<0?this.STEP_SCALE:-this.STEP_SCALE;if(this.scale=parseFloat((this.scale+i).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:i=0,lastTouchX:n=0,lastTouchY:o=0}=this.lastTouch||{};e-i<300&&Math.abs(t.clientX-n)<30&&Math.abs(t.clientY-o)<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:i=this.height,scale:n=1,preScale:o=1,offset:r={x:0,y:0},curOffset:a={x:0,y:0}}=t||{};this.width=e,this.height=i,this.canvas.width=e,this.canvas.height=i,this.scale=n,this.preScale=o,this.offset=r,this.curOffset=a}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(){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()),this.afterDraw?.(this.ctx,this)}getPos(t){const e=this.canvas.getBoundingClientRect();let i=parseFloat((t.clientX-e.left).toFixed(2)),n=parseFloat((t.clientY-e.top).toFixed(2));return i=i<0?0:i,n=n<0?0:n,{x:i,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 ut={};class Qt{type="image";x;y;width;height;img;src;redraw;constructor(t){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=ut[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.crossOrigin="anonymous",i.src=this.src,i.onload=()=>{ut[this.src]=i,t?.(i),this.redraw?.()},i}}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 Kt{id="";type="point";x;y;r;text;backgroundColor;index;pIndex;parentId;constructor(t){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 i=1/e.scale;t.beginPath(),t.arc(this.x,this.y,this.r*i,0,2*Math.PI),t.fillStyle=this.backgroundColor,t.fill(),t.font=`${this.r*i}px Microsoft YaHei`,t.textAlign="center",t.fillStyle="#FFFFFF",t.fillText(this.text,this.x,this.y+this.r*i/3),t.restore()}}const dt={};class te{id="";type="issue";x;y;width;height;src;img;index;pIndex;parentId;count;badgeR;redraw;constructor(t){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=dt[this.src];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.src,i.crossOrigin="anonymous",i.onload=()=>{dt[this.src]=i,t?.(i),this.redraw?.()},i}}draw(t,e){if(!this.img.complete)return;const i=1/e.scale,n=this.width*i,o=this.height*i,r=this.x-n/2,a=this.y-o,c=this.badgeR*i,u=c*1.5;t.save(),t.drawImage(this.img,r,a,n,o),t.beginPath(),this.count>1&&(t.arc(this.x+n*.3,this.y-o*.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-o*.8+c/2)),t.restore()}}const ft={};class ee{type="marker";x;y;url;width;height;anchor;img;scale;redraw;beforeDraw;constructor(t){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=ft[this.url];if(e)return queueMicrotask(()=>{t?.(e),this.redraw?.()}),e;{const i=new Image;return i.src=this.url,i.crossOrigin="anonymous",i.onload=()=>{ft[this.url]=i,t?.(i),this.redraw?.()},i}}calculateIconPosition(){const t=this.anchor?.x??this.width/2,e=this.anchor?.y??this.height/2;return{iconStartX:this.x-t*this.scale,iconStartY:this.y-e*this.scale}}draw(t,e){if(this.beforeDraw?.(t,e),!this.img?.complete)return;const{iconStartX:i,iconStartY:n}=this.calculateIconPosition();t.save();try{t.drawImage(this.img,i,n,this.width*this.scale,this.height*this.scale)}catch(o){console.error("绘制标记时出错:",o)}finally{t.restore()}}}class se{type="radar";x;y;r;angle;text;hFov=90;beforeDraw;constructor(t){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){this.beforeDraw?.(t,e);const i=1/e.scale,[n,o]=[(this.angle-this.hFov/2)/180*Math.PI,(this.angle+this.hFov/2)/180*Math.PI];t.save();const r=t.createRadialGradient(this.x,this.y,0,this.x,this.y,this.r*i);r.addColorStop(0,"rgba(180, 42, 42, 1)"),r.addColorStop(1,"rgba(180, 42, 42, 0.5)"),t.beginPath(),t.moveTo(this.x,this.y),t.arc(this.x,this.y,this.r*i,n,o),t.closePath(),t.fillStyle=r,t.fill(),t.restore()}}class ie{type="region";x;y;shape;areaPoints;backgroundColor;constructor(t){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:i},{},{x:n,y:o}]=t.areaPoints;this.areaPoints=[{x:Math.min(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.min(i,o)},{x:Math.max(e,n),y:Math.max(i,o)},{x:Math.min(e,n),y:Math.max(i,o)}]}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:i,y:n},{},{x:o,y:r}]=this.areaPoints,a=Math.abs(o-i)/2,c=i+(o-i)/2,u=n+(r-n)/2;t.arc(c,u,a,0,2*Math.PI)}else this.areaPoints.forEach((i,n)=>{const{x:o,y:r}=i;n===0?t.moveTo(o,r):t.lineTo(o,r)});t.fill(),t.restore()}}l.APP_SETTING=J,l.AppError=m,l.AppErrorCode=g,l.AppObsType=C,l.CRSTypes=M,l.CanvasElement=Ht,l.CanvasImageElement=Qt,l.CanvasIssueElement=te,l.CanvasMarkerElement=ee,l.CanvasPointElement=Kt,l.CanvasRadarElement=se,l.CanvasRegionElement=ie,l.Coordinate=j,l.CoordinateLevel=q,l.CoordinateModelType=x,l.CoordinateStatus=O,l.CoordinateType=S,l.DataHelper=Zt,l.DataSource=p,l.GeoPoint=z,l.LocaleType=k,l.MAP_PROVIDERS=Z,l.MAP_TILE_LAYERS=mt,l.Point=y,l.Position=_,l.REQUEST_CONFIG=V,l.REQUEST_OPTIONS=W,l.RelativeMap=w,l.RequestContentType=L,l.RequestMethod=v,l.RequestResultCode=U,l.Vector3=$,l.api=St,l.http=Mt,l.utils=Vt,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vsleem-realsee-viewer/shared",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared utilities for VSLeem RealSee Viewer",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"registry": "https://registry.npmjs.org/"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"dist"
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "vite build"
|