@vsleem-realsee-viewer/shared 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -91
- package/dist/index.d.ts +30 -4
- package/dist/index.mjs +247 -183
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,58 +8,58 @@
|
|
|
8
8
|
|
|
9
9
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
10
10
|
| -------------- | -------------- | ------ | -------------------------------------------- |
|
|
11
|
-
| `id` | `number` |
|
|
12
|
-
| `type` | `number` |
|
|
13
|
-
| `level?` | `number` |
|
|
14
|
-
| `relativeMap?` | `RelativeMap` |
|
|
15
|
-
| `no?` | `string` |
|
|
16
|
-
| `name?` | `string` |
|
|
17
|
-
| `shortName?` | `string` |
|
|
18
|
-
| `status?` | `number` |
|
|
19
|
-
| `modelId?` | `number` |
|
|
20
|
-
| `modelType?` | `number` |
|
|
21
|
-
| `modelValue?` | `string` |
|
|
22
|
-
| `projectId?` | `number` |
|
|
23
|
-
| `parentId?` | `number` |
|
|
24
|
-
| `parent?` | `Coordinate` |
|
|
25
|
-
| `groupUuid?` | `string` |
|
|
26
|
-
| `children` | `Coordinate[]` |
|
|
27
|
-
| `z?` | `number` |
|
|
28
|
-
| `disabled?` | `boolean` |
|
|
29
|
-
| `createTime?` | `number` |
|
|
11
|
+
| `id` | `number` | 0 | 坐标系的唯一标识符 |
|
|
12
|
+
| `type` | `number` | 0 | 坐标系类型:0表示空间坐标系,1表示模型坐标系 |
|
|
13
|
+
| `level?` | `number` | - | 表示空间坐标系的层级深度 |
|
|
14
|
+
| `relativeMap?` | `RelativeMap` | - | 存储与父坐标系的相对位置变换关系 |
|
|
15
|
+
| `no?` | `string` | - | 坐标系的编号标识 |
|
|
16
|
+
| `name?` | `string` | - | 坐标系的完整名称 |
|
|
17
|
+
| `shortName?` | `string` | - | 坐标系的简称 |
|
|
18
|
+
| `status?` | `number` | - | 表示坐标系的当前使用状态 |
|
|
19
|
+
| `modelId?` | `number` | - | 关联的模型ID |
|
|
20
|
+
| `modelType?` | `number` | - | 关联的模型类型 |
|
|
21
|
+
| `modelValue?` | `string` | - | 关联的模型值 |
|
|
22
|
+
| `projectId?` | `number` | - | 所属项目ID |
|
|
23
|
+
| `parentId?` | `number` | - | 父坐标系ID |
|
|
24
|
+
| `parent?` | `Coordinate` | - | 父坐标系对象引用 |
|
|
25
|
+
| `groupUuid?` | `string` | - | 坐标系分组的唯一标识 |
|
|
26
|
+
| `children` | `Coordinate[]` | [] | 子坐标系数组,默认初始化为空数组 |
|
|
27
|
+
| `z?` | `number` | - | 坐标系的高度值 |
|
|
28
|
+
| `disabled?` | `boolean` | - | 标识坐标系是否被禁用 |
|
|
29
|
+
| `createTime?` | `number` | - | 坐标系的创建时间戳 |
|
|
30
30
|
|
|
31
31
|
## 计算属性说明
|
|
32
32
|
|
|
33
|
-
| 属性 | 类型 | 说明 |
|
|
34
|
-
| ----------- | -------------- | -------------------------------------------------- |
|
|
35
|
-
| `spaceList` | `Coordinate[]` | 获取所有空间类型的子坐标系 |
|
|
36
|
-
| `modelList` | `Coordinate[]` | 获取所有模型类型的子坐标系 |
|
|
37
|
-
| `fullName` | `string` | 获取组合后的完整名称,格式为"简称(名称)"或单独名称 |
|
|
33
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
34
|
+
| ----------- | -------------- | ------ | -------------------------------------------------- |
|
|
35
|
+
| `spaceList` | `Coordinate[]` | [] | 获取所有空间类型的子坐标系 |
|
|
36
|
+
| `modelList` | `Coordinate[]` | [] | 获取所有模型类型的子坐标系 |
|
|
37
|
+
| `fullName` | `string` | - | 获取组合后的完整名称,格式为"简称(名称)"或单独名称 |
|
|
38
38
|
|
|
39
39
|
## 方法说明
|
|
40
40
|
|
|
41
|
-
| 方法 | 类型
|
|
42
|
-
| ---------------------- |
|
|
43
|
-
| `constructor` | `(options?: Partial<Coordinate>) => Coordinate`
|
|
44
|
-
| `addChild` | `(child: Partial<Coordinate>
|
|
45
|
-
| `removeChild` | `(child: Partial<Coordinate>
|
|
46
|
-
| `updateChild` | `(child: Partial<Coordinate>
|
|
47
|
-
| `bindChild` | `(child: Partial<Coordinate>
|
|
48
|
-
| `mergeChild` | `(result?: Coordinate[]) => Promise<void>`
|
|
49
|
-
| `mappingTo` | `(result: ProjectionModel[]) => Promise<void>`
|
|
50
|
-
| `fromMapping` | `() => Promise<ProjectionModel
|
|
51
|
-
| `findRoot` | `(mapped?: boolean) => Coordinate`
|
|
52
|
-
| `findChildModel` | `(type?: number
|
|
53
|
-
| `findClosestModel` | `(type?: number
|
|
54
|
-
| `findParentSpace` | `() => Coordinate
|
|
55
|
-
| `findParentSpaceNames` | `(level?: number) => string[]`
|
|
56
|
-
| `findCsGroup` | `() => Coordinate[]`
|
|
57
|
-
| `findCsByLevel` | `(level: number) => Coordinate
|
|
58
|
-
| `findCsById` | `(id?: number) => Coordinate
|
|
59
|
-
| `getCsRoutes` | `(mapped?: boolean) => Coordinate[]`
|
|
60
|
-
| `getMappedCsTree` | `() => Coordinate`
|
|
61
|
-
| `getDestRelativeMap` | `(dstCoordinate: Coordinate) => RelativeMap`
|
|
62
|
-
| `getRelativeMaps` | `() => RelativeMap[]`
|
|
41
|
+
| 方法 | 类型 | 说明 |
|
|
42
|
+
| ---------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
43
|
+
| `constructor` | `(options?: Partial<Coordinate>) => Coordinate` | 初始化坐标系实例,支持部分属性配置 |
|
|
44
|
+
| `addChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 添加一个或多个子坐标系,并建立映射关系 |
|
|
45
|
+
| `removeChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 移除一个或多个子坐标系 |
|
|
46
|
+
| `updateChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 更新子坐标系的属性信息 |
|
|
47
|
+
| `bindChild` | `(child: Partial<Coordinate> \ Partial<Coordinate>[]) => Promise<void>` | 绑定子坐标系但不建立映射关系 |
|
|
48
|
+
| `mergeChild` | `(result?: Coordinate[]) => Promise<void>` | 合并更新的子坐标系数据到当前树结构 |
|
|
49
|
+
| `mappingTo` | `(result: ProjectionModel[]) => Promise<void>` | 将当前坐标系映射到目标坐标系组 |
|
|
50
|
+
| `fromMapping` | `() => Promise<ProjectionModel \ undefined>` | 查询当前坐标系被哪些源坐标系映射 |
|
|
51
|
+
| `findRoot` | `(mapped?: boolean) => Coordinate` | 递归查找根坐标系,可选是否只查找有映射关系的 |
|
|
52
|
+
| `findChildModel` | `(type?: number \ number[], mapped?: boolean) => Coordinate \ undefined` | 查找符合条件的子模型坐标系 |
|
|
53
|
+
| `findClosestModel` | `(type?: number \ number[], excludeNodes?: Coordinate[]) => Coordinate \ undefined` | 使用广度优先搜索查找最近的模型坐标系 |
|
|
54
|
+
| `findParentSpace` | `() => Coordinate \ undefined` | 向上查找最近的父级空间坐标系 |
|
|
55
|
+
| `findParentSpaceNames` | `(level?: number) => string[]` | 获取指定层级数的父空间名称列表 |
|
|
56
|
+
| `findCsGroup` | `() => Coordinate[]` | 查找当前坐标系所在的分组 |
|
|
57
|
+
| `findCsByLevel` | `(level: number) => Coordinate \ undefined` | 递归查找指定层级的坐标系 |
|
|
58
|
+
| `findCsById` | `(id?: number) => Coordinate \ undefined` | 通过ID深度优先搜索查找坐标系 |
|
|
59
|
+
| `getCsRoutes` | `(mapped?: boolean) => Coordinate[]` | 获取从当前坐标系到根系的路径数组 |
|
|
60
|
+
| `getMappedCsTree` | `() => Coordinate` | 生成只包含有映射关系的坐标系树 |
|
|
61
|
+
| `getDestRelativeMap` | `(dstCoordinate: Coordinate) => RelativeMap` | 计算到目标坐标系的相对变换关系 |
|
|
62
|
+
| `getRelativeMaps` | `() => RelativeMap[]` | 获取从当前坐标系到根系的相对变换链 |
|
|
63
63
|
|
|
64
64
|
# DataSource 数据源类
|
|
65
65
|
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
| 方法 | 类型 | 说明 |
|
|
71
71
|
| ---------------------- | -------------------------------------------------------------------------------- | ---------------------------- |
|
|
72
|
-
| `getCoordinateTree` | `(projectId: number) => Promise<Coordinate
|
|
72
|
+
| `getCoordinateTree` | `(projectId: number) => Promise<Coordinate \ undefined>` | 获取项目坐标系树结构 |
|
|
73
73
|
| `addCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<Coordinate[]>` | 添加子坐标系到指定父节点 |
|
|
74
74
|
| `removeCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<any>` | 删除指定坐标系 |
|
|
75
75
|
| `updateCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<Coordinate[]>` | 更新坐标系信息 |
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
|
|
88
88
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
89
89
|
| ----- | -------- | ------ | -------- |
|
|
90
|
-
| `lat` | `number` |
|
|
91
|
-
| `lon` | `number` |
|
|
92
|
-
| `alt` | `number` |
|
|
90
|
+
| `lat` | `number` | 0 | 经度(°) |
|
|
91
|
+
| `lon` | `number` | 0 | 纬度(°) |
|
|
92
|
+
| `alt` | `number` | 0 | 高度(mm) |
|
|
93
93
|
|
|
94
94
|
## 方法说明
|
|
95
95
|
|
|
@@ -107,15 +107,15 @@
|
|
|
107
107
|
|
|
108
108
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
109
109
|
| ----------- | ---------- | ------ | ---------------------------- |
|
|
110
|
-
| `scale` | `number` |
|
|
111
|
-
| `yaw` | `number` |
|
|
112
|
-
| `x` | `number` |
|
|
113
|
-
| `y` | `number` |
|
|
114
|
-
| `z` | `number` |
|
|
115
|
-
| `start` | `number` |
|
|
116
|
-
| `end` | `number` |
|
|
117
|
-
| `plane` | `string` |
|
|
118
|
-
| `refPoint?` | `GeoPoint` |
|
|
110
|
+
| `scale` | `number` | 1 | 缩放比例 |
|
|
111
|
+
| `yaw` | `number` | 0 | 旋转弧度 |
|
|
112
|
+
| `x` | `number` | 0 | X轴平移量 |
|
|
113
|
+
| `y` | `number` | 0 | Y轴平移量 |
|
|
114
|
+
| `z` | `number` | 0 | Z轴平移量 |
|
|
115
|
+
| `start` | `number` | 0 | 起始 |
|
|
116
|
+
| `end` | `number` | -1 | 结束 |
|
|
117
|
+
| `plane` | `string` | 'xy' | 坐标系平面类型('xy'或'xz') |
|
|
118
|
+
| `refPoint?` | `GeoPoint` | - | 参考点坐标 |
|
|
119
119
|
|
|
120
120
|
## 方法说明
|
|
121
121
|
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
| `constructor` | `(options?: Partial<RelativeMap>) => RelativeMap` | 初始化相对映射关系,支持部分属性配置 |
|
|
125
125
|
| `addRelativeMap` | `(r1: RelativeMap, r2: RelativeMap) => RelativeMap` | 合并两个坐标变换(先应用r1后应用r2) |
|
|
126
126
|
| `inverseRelativeMap` | `(r: RelativeMap) => RelativeMap` | 计算坐标变换的逆变换 |
|
|
127
|
-
| `toParse` | `(r?: string) => RelativeMap
|
|
128
|
-
| `toStringify` | `(r?: RelativeMap) => string
|
|
127
|
+
| `toParse` | `(r?: string) => RelativeMap \ undefined` | 从JSON字符串解析为RelativeMap对象 |
|
|
128
|
+
| `toStringify` | `(r?: RelativeMap) => string \ undefined` | 将RelativeMap对象序列化为JSON字符串 |
|
|
129
129
|
|
|
130
130
|
# Point 点坐标类
|
|
131
131
|
|
|
@@ -133,36 +133,36 @@
|
|
|
133
133
|
|
|
134
134
|
## 属性说明
|
|
135
135
|
|
|
136
|
-
| 属性 | 类型 | 默认值
|
|
137
|
-
| ---------- | --------- |
|
|
138
|
-
| `x` | `number` |
|
|
139
|
-
| `y` | `number` |
|
|
140
|
-
| `z` | `number` |
|
|
141
|
-
| `lat` | `number` |
|
|
142
|
-
| `lon` | `number` |
|
|
143
|
-
| `alt` | `number` |
|
|
144
|
-
| `yaw` | `number` |
|
|
145
|
-
| `pitch` | `number` |
|
|
146
|
-
| `roll` | `number` |
|
|
147
|
-
| `hasXYZ` | `boolean` |
|
|
148
|
-
| `hasGeo` | `boolean` |
|
|
149
|
-
| `hasAngle` | `boolean` |
|
|
150
|
-
| `plane` | `string` |
|
|
136
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
137
|
+
| ---------- | --------- | ------ | -------------------------- |
|
|
138
|
+
| `x` | `number` | 0 | X轴坐标 |
|
|
139
|
+
| `y` | `number` | 0 | Y轴坐标 |
|
|
140
|
+
| `z` | `number` | 0 | Z轴坐标 |
|
|
141
|
+
| `lat` | `number` | 0 | 经度 |
|
|
142
|
+
| `lon` | `number` | 0 | 纬度 |
|
|
143
|
+
| `alt` | `number` | 0 | 高度 |
|
|
144
|
+
| `yaw` | `number` | 0 | 偏航角 |
|
|
145
|
+
| `pitch` | `number` | 0 | 俯仰角 |
|
|
146
|
+
| `roll` | `number` | 0 | 翻滚角 |
|
|
147
|
+
| `hasXYZ` | `boolean` | false | 是否包含XYZ坐标 |
|
|
148
|
+
| `hasGeo` | `boolean` | false | 是否包含地理坐标 |
|
|
149
|
+
| `hasAngle` | `boolean` | false | 是否包含角度信息 |
|
|
150
|
+
| `plane` | `string` | 'xy' | 坐标平面类型('xy'或'xz') |
|
|
151
151
|
|
|
152
152
|
## 方法说明
|
|
153
153
|
|
|
154
|
-
| 方法 | 类型
|
|
155
|
-
| ------------- |
|
|
156
|
-
| `constructor` | `(options?: Partial<Point>) => Point`
|
|
157
|
-
| `dist` | `(p1: Point, p2: Point) => number`
|
|
158
|
-
| `distXZ` | `(p1: Point, p2: Point) => number`
|
|
159
|
-
| `distXY` | `(p1: Point, p2: Point) => number`
|
|
160
|
-
| `toRadians` | `(degrees: number) => number`
|
|
161
|
-
| `toDegrees` | `(radians: number) => number`
|
|
162
|
-
| `angleXZ` | `(pa: Point, pb: Point, pc: Point) => number`
|
|
163
|
-
| `toParse` | `(point?: string) => Point
|
|
164
|
-
| `toStringify` | `(point?: Point) => string`
|
|
165
|
-
| `projection` | `(r: RelativeMap, srcCoordinate?: Coordinate, dstCoordinate?: Coordinate) => Point
|
|
166
|
-
| `project` | `(r: RelativeMap) => Point
|
|
167
|
-
| `projectXZ` | `(r: RelativeMap) => Point`
|
|
168
|
-
| `projectXY` | `(r: RelativeMap) => Point`
|
|
154
|
+
| 方法 | 类型 | 说明 |
|
|
155
|
+
| ------------- | ----------------------------------------------------------------------------------------------- | ---------------------- |
|
|
156
|
+
| `constructor` | `(options?: Partial<Point>) => Point` | 初始化点坐标 |
|
|
157
|
+
| `dist` | `(p1: Point, p2: Point) => number` | 计算两点间三维距离 |
|
|
158
|
+
| `distXZ` | `(p1: Point, p2: Point) => number` | 计算两点在XZ平面的距离 |
|
|
159
|
+
| `distXY` | `(p1: Point, p2: Point) => number` | 计算两点在XY平面的距离 |
|
|
160
|
+
| `toRadians` | `(degrees: number) => number` | 角度转弧度 |
|
|
161
|
+
| `toDegrees` | `(radians: number) => number` | 弧度转角度 |
|
|
162
|
+
| `angleXZ` | `(pa: Point, pb: Point, pc: Point) => number` | 计算三点在XZ平面的夹角 |
|
|
163
|
+
| `toParse` | `(point?: string) => Point \ undefined` | 从字符串解析点坐标 |
|
|
164
|
+
| `toStringify` | `(point?: Point) => string` | 将点坐标序列化为字符串 |
|
|
165
|
+
| `projection` | `(r: RelativeMap, srcCoordinate?: Coordinate, dstCoordinate?: Coordinate) => Point \ undefined` | 坐标投影转换 |
|
|
166
|
+
| `project` | `(r: RelativeMap) => Point \ undefined` | 基础坐标投影 |
|
|
167
|
+
| `projectXZ` | `(r: RelativeMap) => Point` | XZ平面坐标投影 |
|
|
168
|
+
| `projectXY` | `(r: RelativeMap) => Point` | XY平面坐标投影 |
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { api }
|
|
|
14
14
|
export declare const APP_SETTING: {
|
|
15
15
|
baseUrl: string;
|
|
16
16
|
obsType: string;
|
|
17
|
+
authorizeCode: string;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export declare class AppError extends Error {
|
|
@@ -57,7 +58,7 @@ export declare enum AppObsType {
|
|
|
57
58
|
|
|
58
59
|
export declare type AppSetting = {
|
|
59
60
|
baseUrl?: string;
|
|
60
|
-
authorizeCode
|
|
61
|
+
authorizeCode: string;
|
|
61
62
|
obsPrefix?: string;
|
|
62
63
|
obsType?: string;
|
|
63
64
|
};
|
|
@@ -449,6 +450,17 @@ export declare enum CoordinateType {
|
|
|
449
450
|
Data = 2
|
|
450
451
|
}
|
|
451
452
|
|
|
453
|
+
export declare class DataHelper {
|
|
454
|
+
/**
|
|
455
|
+
* 将源坐标系中的点转换到目标坐标系中
|
|
456
|
+
* @param points 需要转换的点数组
|
|
457
|
+
* @param srcCoordinate 源坐标系
|
|
458
|
+
* @param dstCoordinate 目标坐标系
|
|
459
|
+
* @returns 转换后的点数组
|
|
460
|
+
*/
|
|
461
|
+
static srcPointToDstPoint(points: Point[], srcCoordinate: Coordinate, dstCoordinate: Coordinate): Point[];
|
|
462
|
+
}
|
|
463
|
+
|
|
452
464
|
export declare class DataSource {
|
|
453
465
|
/**
|
|
454
466
|
* 获取坐标系树
|
|
@@ -554,6 +566,14 @@ export declare class GeoPoint {
|
|
|
554
566
|
|
|
555
567
|
declare function getCoordinateList(params?: Record<string, any>, options?: RequestOptions): Promise<CoordinateModel[]>;
|
|
556
568
|
|
|
569
|
+
/**
|
|
570
|
+
* 获取两个对象之间的差异。
|
|
571
|
+
* @param newObj 新对象
|
|
572
|
+
* @param oldObj 原始对象
|
|
573
|
+
* @returns 返回一个包含差异的对象,新增或修改的字段包含新值,删除的字段设为 undefined
|
|
574
|
+
*/
|
|
575
|
+
declare function getDiffProps(newObj?: Record<string, any>, oldObj?: Record<string, any>): Record<string, any>;
|
|
576
|
+
|
|
557
577
|
declare function getImageInfo(url: string, options?: RequestOptions): Promise<any>;
|
|
558
578
|
|
|
559
579
|
/**
|
|
@@ -613,8 +633,6 @@ declare function isNullOrUnDef(val: unknown): val is null | undefined;
|
|
|
613
633
|
|
|
614
634
|
declare function isNumber(val: unknown): val is number;
|
|
615
635
|
|
|
616
|
-
declare function isNumeric(val: number | string): val is string;
|
|
617
|
-
|
|
618
636
|
declare function isObject(val: any): val is Record<any, any>;
|
|
619
637
|
|
|
620
638
|
declare function isPromise<T = any>(val: unknown): val is Promise<T>;
|
|
@@ -629,6 +647,13 @@ declare function isUnDef<T = unknown>(val?: T): val is T;
|
|
|
629
647
|
|
|
630
648
|
declare function isWindow(val: any): val is Window;
|
|
631
649
|
|
|
650
|
+
/**
|
|
651
|
+
* 动态加载外部 CSS 文件并返回一个 Promise
|
|
652
|
+
* @param src - CSS 文件的 URL(建议使用 HTTPS)
|
|
653
|
+
* @returns Promise<boolean> - 解析表示加载成功,拒绝表示加载失败
|
|
654
|
+
*/
|
|
655
|
+
declare function loadCss(src: string): Promise<unknown>;
|
|
656
|
+
|
|
632
657
|
/**
|
|
633
658
|
* 动态加载 JavaScript 脚本
|
|
634
659
|
* @param src 脚本的 URL 地址
|
|
@@ -933,7 +958,6 @@ declare namespace utils {
|
|
|
933
958
|
isArray,
|
|
934
959
|
isWindow,
|
|
935
960
|
isElement,
|
|
936
|
-
isNumeric,
|
|
937
961
|
isNumber,
|
|
938
962
|
isSameValue,
|
|
939
963
|
isNullOrUnDef,
|
|
@@ -944,7 +968,9 @@ declare namespace utils {
|
|
|
944
968
|
throttle,
|
|
945
969
|
deepMerge,
|
|
946
970
|
deepMergeProps,
|
|
971
|
+
getDiffProps,
|
|
947
972
|
loadScript,
|
|
973
|
+
loadCss,
|
|
948
974
|
getImageTransform,
|
|
949
975
|
toCanvasCoord,
|
|
950
976
|
toModelCoord,
|