@vsleem-realsee-viewer/shared 1.0.0 → 1.1.1

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 ADDED
@@ -0,0 +1,168 @@
1
+ # 坐标系相关类文档
2
+
3
+ # Coordinate 坐标系类
4
+
5
+ 该类设计适用于建筑信息模型(BIM)、地理信息系统(GIS)等需要复杂空间关系管理的场景。
6
+
7
+ ## 属性说明
8
+
9
+ | 属性 | 类型 | 默认值 | 说明 |
10
+ | -------------- | -------------- | ------ | -------------------------------------------- |
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
+
31
+ ## 计算属性说明
32
+
33
+ | 属性 | 类型 | 说明 |
34
+ | ----------- | -------------- | -------------------------------------------------- |
35
+ | `spaceList` | `Coordinate[]` | 获取所有空间类型的子坐标系 |
36
+ | `modelList` | `Coordinate[]` | 获取所有模型类型的子坐标系 |
37
+ | `fullName` | `string` | 获取组合后的完整名称,格式为"简称(名称)"或单独名称 |
38
+
39
+ ## 方法说明
40
+
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
+ | `findLatestModel` | `(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
+
64
+ # DataSource 数据源类
65
+
66
+ 该类类用于管理 BIM、GIS、数字孪生的层级结构与空间关系
67
+
68
+ ## 静态方法说明
69
+
70
+ | 方法 | 类型 | 说明 |
71
+ | ---------------------- | -------------------------------------------------------------------------------- | ---------------------------- |
72
+ | `getCoordinateTree` | `(projectId: number) => Promise<Coordinate \| undefined>` | 获取项目坐标系树结构 |
73
+ | `addCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<Coordinate[]>` | 添加子坐标系到指定父节点 |
74
+ | `removeCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<any>` | 删除指定坐标系 |
75
+ | `updateCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<Coordinate[]>` | 更新坐标系信息 |
76
+ | `bindCoordinate` | `(parent: Coordinate, children: Partial<Coordinate>[]) => Promise<Coordinate[]>` | 绑定坐标系到父节点 |
77
+ | `handleCoordinateList` | `(array: CoordinateModel[]) => Coordinate[]` | 转换原始数据为Coordinate对象 |
78
+ | `buildCoordinateTree` | `(flatNodes: Coordinate[], rootId: number) => Coordinate` | 将扁平列表转为树形结构 |
79
+ | `sortCoordinateTree` | `(node: Coordinate) => void` | 递归排序坐标系树 |
80
+ | `filterSpaceTree` | `(tree: Coordinate[]) => Coordinate[]` | 过滤出空间坐标系树 |
81
+
82
+ # GeoPoint 地理坐标类
83
+
84
+ 该类实现地理与平面坐标的高精度双向转换
85
+
86
+ ## 属性说明
87
+
88
+ | 属性 | 类型 | 默认值 | 说明 |
89
+ | ----- | -------- | ------ | -------- |
90
+ | `lat` | `number` | `0` | 经度(°) |
91
+ | `lon` | `number` | `0` | 纬度(°) |
92
+ | `alt` | `number` | `0` | 高度(mm) |
93
+
94
+ ## 方法说明
95
+
96
+ | 方法 | 类型 | 说明 |
97
+ | ------------- | -------------------------------------------- | ---------------------------------- |
98
+ | `constructor` | `(options?: Partial<GeoPoint>) => GeoPoint` | 初始化地理坐标点,支持部分属性配置 |
99
+ | `XYZToLLH` | `(p: Point, refPoint: GeoPoint) => GeoPoint` | 平面坐标转地理坐标(WGS84椭球体) |
100
+ | `LLHToXYZ` | `(p: Point, refPoint: GeoPoint) => Point` | 地理坐标转平面坐标(WGS84椭球体) |
101
+
102
+ # RelativeMap 相对坐标映射类
103
+
104
+ 该类用于管理三维空间中的相对坐标变换关系
105
+
106
+ ## 属性说明
107
+
108
+ | 属性 | 类型 | 默认值 | 说明 |
109
+ | ----------- | ---------- | ------ | ---------------------------- |
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
+
120
+ ## 方法说明
121
+
122
+ | 方法 | 类型 | 说明 |
123
+ | -------------------- | --------------------------------------------------- | ------------------------------------ |
124
+ | `constructor` | `(options?: Partial<RelativeMap>) => RelativeMap` | 初始化相对映射关系,支持部分属性配置 |
125
+ | `addRelativeMap` | `(r1: RelativeMap, r2: RelativeMap) => RelativeMap` | 合并两个坐标变换(先应用r1后应用r2) |
126
+ | `inverseRelativeMap` | `(r: RelativeMap) => RelativeMap` | 计算坐标变换的逆变换 |
127
+ | `JSONParse` | `(r?: string) => RelativeMap \| undefined` | 从JSON字符串解析为RelativeMap对象 |
128
+ | `JSONStringify` | `(r?: RelativeMap) => string \| undefined` | 将RelativeMap对象序列化为JSON字符串 |
129
+
130
+ # Point 点坐标类
131
+
132
+ 该类用于三维空间中的坐标表示与转换,支持位置、角度和坐标系投影变换
133
+
134
+ ## 属性说明
135
+
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'` | 坐标平面类型 |
151
+
152
+ ## 方法说明
153
+
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
+ | `JSONParse` | `(point?: string) => Point \| undefined` | 从字符串解析点坐标 |
164
+ | `JSONStringify` | `(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
@@ -11,13 +11,51 @@ declare namespace api {
11
11
  }
12
12
  export { api }
13
13
 
14
- export declare type AppObsType = 'huawei' | 'aliyun' | 'huoshan' | 'amazon';
14
+ export declare const APP_SETTING: {
15
+ baseUrl: string;
16
+ obsType: string;
17
+ };
18
+
19
+ export declare class AppError extends Error {
20
+ code: number;
21
+ message: string;
22
+ details?: any | undefined;
23
+ constructor(code: number, // 业务错误码
24
+ message: string, // 错误信息
25
+ details?: any | undefined);
26
+ toJSON(): {
27
+ code: number;
28
+ message: string;
29
+ details: any;
30
+ timestamp: string;
31
+ };
32
+ }
33
+
34
+ /**
35
+ * 业务错误码枚举(扩展无返回值错误)
36
+ */
37
+ export declare enum AppErrorCode {
38
+ GEO_POINT_NO_PLANE = 9000,
39
+ POINT_AND_GIS_NO_MAPPING = 9010,
40
+ POINT_NO_PLANE = 9011,
41
+ RELATIVE_MAP_MAPPING_SAME = 9020,
42
+ RELATIVE_NO_PLANE = 9021,
43
+ RELATIVE_JSON_ERROR = 9022
44
+ }
45
+
46
+ export declare enum AppObsType {
47
+ Hw = "huawei",// 华为云
48
+ Ali = "aliyun",// 阿里云
49
+ Hs = "hs",// 火山引擎
50
+ Aws = "amazon",// AWS S3
51
+ Minio = "minio"
52
+ }
15
53
 
16
54
  export declare type AppSetting = {
17
55
  baseUrl?: string;
18
56
  authorizeCode?: string;
19
57
  obsPrefix?: string;
20
- obsType?: AppObsType;
58
+ obsType?: string;
21
59
  };
22
60
 
23
61
  declare abstract class BaseAsyncElement {
@@ -37,6 +75,11 @@ declare abstract class BaseElement {
37
75
  */
38
76
  declare function bindCoordinate(data: CoordinateModel[], options?: RequestOptions): Promise<CoordinateModel[]>;
39
77
 
78
+ export declare type BindingModel = {
79
+ id: number;
80
+ modelId: number;
81
+ };
82
+
40
83
  export declare type CADModel = {
41
84
  bindCsIds?: string;
42
85
  createBy?: string;
@@ -232,6 +275,7 @@ declare function cloneDeep<T>(value: T): T;
232
275
  export declare class Coordinate {
233
276
  id: number;
234
277
  type: number;
278
+ children: Coordinate[];
235
279
  level?: number;
236
280
  relativeMap?: RelativeMap;
237
281
  no?: string;
@@ -245,10 +289,9 @@ export declare class Coordinate {
245
289
  parentId?: number;
246
290
  parent?: Coordinate;
247
291
  groupUuid?: string;
248
- children: Coordinate[];
249
292
  z?: number;
250
- disabled?: boolean;
251
293
  createTime?: number;
294
+ disabled?: boolean;
252
295
  constructor(options?: Partial<Coordinate>);
253
296
  get spaceList(): Coordinate[];
254
297
  get modelList(): Coordinate[];
@@ -441,6 +484,8 @@ declare function debounce<T extends (...args: any[]) => void>(func: T, wait: num
441
484
  cancel: () => void;
442
485
  };
443
486
 
487
+ declare function error(message: string): void;
488
+
444
489
  export declare class GeoPoint {
445
490
  lat: number;
446
491
  lon: number;
@@ -574,7 +619,7 @@ export declare class Point {
574
619
  static JSONStringify(point?: Point): string;
575
620
  /**
576
621
  * 点的投射
577
- * @param r //
622
+ * @param r //映射关系
578
623
  * @param srcCoordinate 源坐标系
579
624
  * @param dstCoordinate 目标坐标系
580
625
  */
@@ -584,6 +629,15 @@ export declare class Point {
584
629
  projectXY(r: RelativeMap): Point;
585
630
  }
586
631
 
632
+ export declare class Position {
633
+ yaw: number;
634
+ pitch: number;
635
+ roll: number;
636
+ constructor(options?: Partial<Position>);
637
+ static JSONParse(position?: string): Position | undefined;
638
+ static JSONStringify(position?: Position): string;
639
+ }
640
+
587
641
  export declare type ProjectionModel = {
588
642
  mappingType?: number;
589
643
  projectId?: number;
@@ -649,10 +703,20 @@ export declare type RequestConfig = {
649
703
  headers?: Record<string, string>;
650
704
  };
651
705
 
706
+ /**
707
+ * @description: contentType
708
+ */
709
+ export declare enum RequestContentType {
710
+ JSON = "application/json",
711
+ FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
712
+ FORM_DATA = "multipart/form-data;charset=UTF-8",
713
+ OCTET_STREAM = "'application/octet-stream"
714
+ }
715
+
652
716
  /**
653
717
  * @description: request method
654
718
  */
655
- export declare enum RequestEnum {
719
+ export declare enum RequestMethod {
656
720
  GET = "GET",
657
721
  POST = "POST"
658
722
  }
@@ -663,6 +727,15 @@ export declare type RequestOptions = {
663
727
  withAuthorize?: boolean;
664
728
  };
665
729
 
730
+ /**
731
+ * @description: Request result set
732
+ */
733
+ export declare enum RequestResultCode {
734
+ SUCCESS = 200,
735
+ ERROR = -1,
736
+ TIMEOUT = 401
737
+ }
738
+
666
739
  export declare type ResponseResult = {
667
740
  code: number;
668
741
  msg: string;
@@ -741,9 +814,13 @@ declare namespace utils {
741
814
  loadScript,
742
815
  getImageTransform,
743
816
  toCanvasCoord,
744
- toModelCoord
817
+ toModelCoord,
818
+ warn,
819
+ error
745
820
  }
746
821
  }
747
822
  export { utils }
748
823
 
824
+ declare function warn(message: string): void;
825
+
749
826
  export { }