model-action 1.0.24 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/index.d.ts +13 -4
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +12 -4
  4. package/dist/index.js.map +1 -0
  5. package/dist/modules/Action.d.ts +5 -14
  6. package/dist/modules/Action.d.ts.map +1 -0
  7. package/dist/modules/Action.js +2 -10
  8. package/dist/modules/Action.js.map +1 -0
  9. package/dist/modules/Animation.d.ts +59 -0
  10. package/dist/modules/Animation.d.ts.map +1 -0
  11. package/dist/modules/Animation.js +117 -0
  12. package/dist/modules/Animation.js.map +1 -0
  13. package/dist/modules/Building.d.ts +28 -0
  14. package/dist/modules/Building.d.ts.map +1 -0
  15. package/dist/modules/Building.js +70 -0
  16. package/dist/modules/Building.js.map +1 -0
  17. package/dist/modules/Camera.d.ts +37 -0
  18. package/dist/modules/Camera.d.ts.map +1 -0
  19. package/dist/modules/Camera.js +110 -0
  20. package/dist/modules/Camera.js.map +1 -0
  21. package/dist/modules/CameraView.d.ts +37 -0
  22. package/dist/modules/CameraView.d.ts.map +1 -0
  23. package/dist/modules/CameraView.js +110 -0
  24. package/dist/modules/CameraView.js.map +1 -0
  25. package/dist/modules/Effect.d.ts +37 -0
  26. package/dist/modules/Effect.d.ts.map +1 -0
  27. package/dist/modules/Effect.js +72 -0
  28. package/dist/modules/Effect.js.map +1 -0
  29. package/dist/modules/Environment.d.ts +22 -0
  30. package/dist/modules/Environment.d.ts.map +1 -0
  31. package/dist/modules/Environment.js +53 -0
  32. package/dist/modules/Environment.js.map +1 -0
  33. package/dist/modules/Focus.d.ts +12 -0
  34. package/dist/modules/Focus.d.ts.map +1 -0
  35. package/dist/modules/Focus.js +22 -0
  36. package/dist/modules/Focus.js.map +1 -0
  37. package/dist/modules/GameMode.d.ts +17 -0
  38. package/dist/modules/GameMode.d.ts.map +1 -0
  39. package/dist/modules/GameMode.js +36 -0
  40. package/dist/modules/GameMode.js.map +1 -0
  41. package/dist/modules/Init.d.ts +28 -0
  42. package/dist/modules/Init.d.ts.map +1 -0
  43. package/dist/modules/Init.js +81 -0
  44. package/dist/modules/Init.js.map +1 -0
  45. package/dist/modules/Path.d.ts +76 -0
  46. package/dist/modules/Path.d.ts.map +1 -0
  47. package/dist/modules/Path.js +155 -0
  48. package/dist/modules/Path.js.map +1 -0
  49. package/dist/modules/Poi.d.ts +45 -62
  50. package/dist/modules/Poi.d.ts.map +1 -0
  51. package/dist/modules/Poi.js +117 -88
  52. package/dist/modules/Poi.js.map +1 -0
  53. package/dist/modules/Routing.d.ts +23 -31
  54. package/dist/modules/Routing.d.ts.map +1 -0
  55. package/dist/modules/Routing.js +62 -63
  56. package/dist/modules/Routing.js.map +1 -0
  57. package/dist/modules/Scene.d.ts +12 -15
  58. package/dist/modules/Scene.d.ts.map +1 -0
  59. package/dist/modules/Scene.js +26 -15
  60. package/dist/modules/Scene.js.map +1 -0
  61. package/dist/modules/Status.d.ts +59 -0
  62. package/dist/modules/Status.d.ts.map +1 -0
  63. package/dist/modules/Status.js +91 -0
  64. package/dist/modules/Status.js.map +1 -0
  65. package/dist/modules/Track.d.ts +65 -22
  66. package/dist/modules/Track.d.ts.map +1 -0
  67. package/dist/modules/Track.js +128 -20
  68. package/dist/modules/Track.js.map +1 -0
  69. package/dist/modules/VideoFusion.d.ts +1 -0
  70. package/dist/modules/VideoFusion.d.ts.map +1 -0
  71. package/dist/modules/VideoFusion.js +1 -0
  72. package/dist/modules/VideoFusion.js.map +1 -0
  73. package/dist/modules/Window.d.ts +1 -0
  74. package/dist/modules/Window.d.ts.map +1 -0
  75. package/dist/modules/Window.js +1 -0
  76. package/dist/modules/Window.js.map +1 -0
  77. package/dist/peer-stream.d.ts +123 -0
  78. package/dist/peer-stream.d.ts.map +1 -0
  79. package/dist/peer-stream.js +852 -0
  80. package/dist/peer-stream.js.map +1 -0
  81. package/package.json +1 -1
  82. package/src/index.ts +12 -4
  83. package/src/modules/Action.ts +5 -25
  84. package/src/modules/Animation.ts +171 -0
  85. package/src/modules/Building.ts +103 -0
  86. package/src/modules/CameraView.ts +175 -0
  87. package/src/modules/Effect.ts +127 -0
  88. package/src/modules/Environment.ts +81 -0
  89. package/src/modules/Focus.ts +33 -0
  90. package/src/modules/GameMode.ts +60 -0
  91. package/src/modules/Init.ts +104 -0
  92. package/src/modules/Path.ts +293 -0
  93. package/src/modules/Poi.ts +194 -117
  94. package/src/modules/Routing.ts +96 -85
  95. package/src/modules/Scene.ts +43 -21
  96. package/src/modules/Status.ts +150 -0
  97. package/src/peer-stream.js +938 -0
  98. package/src/modules/Track.ts +0 -64
  99. package/src/modules/VideoFusion.ts +0 -122
  100. package/src/modules/Window.ts +0 -40
@@ -1,168 +1,245 @@
1
-
2
1
  /**
3
2
  * POI点方法
4
3
  */
5
- import { Action, LocationItem, RequiredSome, SendParam } from "./Action";
6
-
7
- type PoiActionType = 'show' | 'hide' | 'add' | 'delete' | 'update' | 'getInfo' | 'status'
8
- type PoiType = {
9
- action: PoiActionType, //方法
10
- id?: string, //POI点UE中的ID
11
- type?: string, //POI类型
12
- typeChild?: string, //POI子类型
13
- text?: string, //POI标题
14
- location?: LocationItem, //POI在场景中的坐标格式
15
- place?: string, //POI所在位置
16
- description?: string, //POI描述
17
- linkId?: string, //POI关联设备ID
18
- floorNum?: string, //总楼层
19
- lowestFloor?: string, //最低楼层
20
- state?: 'normal' | 'alarm'
21
- } & SendParam
22
-
23
- type IdList = Array<{
24
- id: string;
25
- state: 'normal' | 'alarm'
26
- }>
4
+ import { Action, SendParam } from "./Action";
5
+
6
+ type PoiActionType = 'show' | 'hide' | 'showAll' | 'hideAll' | 'add' | 'remove' | 'update' | 'find'
7
+
8
+ // POI基础信息
9
+ export interface PoiBaseInfo {
10
+ id: string; // POI的ID
11
+ type: string; // POI类型,如 "Camera"
12
+ label: string; // 标签
13
+ location: string; // 位置,格式 "X=0.0,Y=0.0,Z=0.0"
14
+ rotation: string; // 旋转,格式 "P=-35.004208,Y=113.576096,R=0.000000"
15
+ scale: number; // 缩放
16
+ place: string; // 地方
17
+ linkId: string; // 链接ID
18
+ category: string; // 分类,如 "Camera"
19
+ description: string; // 描述
20
+ hasMesh: boolean; // 是否有网格
21
+ }
22
+
23
+ // POI更新信息(不包含type字段)
24
+ export type PoiUpdateInfo = Omit<PoiBaseInfo, 'type'>
25
+
26
+ type PoiType = SendParam & {
27
+ cmd: "POI";
28
+ data: {
29
+ action: PoiActionType;
30
+ [key: string]: any;
31
+ };
32
+ }
27
33
 
28
34
  export class PoiAction extends Action {
29
35
  /**
30
- * 添加poi
31
- * @param {*} type 相机type
32
- * @param {*} location poi点位置
33
- * @param {*} text POI标题
34
- * @param {*} place POI所在位置
35
- * @param {*} description POI描述
36
- * @param {*} linkId POI关联的设备ID
37
- */
38
- static poiAdd(type: PoiType['type'] = 'Camera', location: LocationItem, text: PoiType['text'] = '', place: PoiType['place'] = '', description: PoiType['description'] = '', linkId: PoiType['linkId'] = '') {
39
- const param: RequiredSome<PoiType, 'action' | 'type' | 'location'> = {
36
+ * 显隐指定id的POI
37
+ * @param action 操作类型:show 显示 | hide 隐藏
38
+ * @param id POI的ID
39
+ */
40
+ static poiShowHide(
41
+ action: 'show' | 'hide',
42
+ id: string
43
+ ) {
44
+ const data: {
45
+ action: 'show' | 'hide';
46
+ id: string;
47
+ } = {
48
+ action,
49
+ id
50
+ };
51
+
52
+ const param: PoiType = {
40
53
  cmd: "POI",
41
- action: "add",
42
- type,
43
- text,
44
- location,
45
- place,
46
- description,
47
- linkId
48
- };
49
- this.sendParam(param, '新增POI')
54
+ data
55
+ };
56
+
57
+ const actionMap = {
58
+ show: '显示指定POI',
59
+ hide: '隐藏指定POI'
60
+ };
61
+ this.sendParam(param, actionMap[action])
50
62
  }
51
63
 
52
64
  /**
53
- * 更新poi
54
- * @param {*} type 相机type
55
- * @param {*} location poi点位置
56
- * @param {*} text POI标题
57
- * @param {*} place POI所在位置
58
- * @param {*} description POI描述
59
- * @param {*} linkId POI关联的设备ID
65
+ * 显隐指定类型和地方的POI
66
+ * @param action 操作类型:show 显示 | hide 隐藏
67
+ * @param type POI类型,如 "Camera"、"JK" 等
68
+ * @param place 地方,如 "A_1F",如果不传place字段,三维自动判断是显示楼里的还是楼外的
60
69
  */
61
- static poiUpdate(type: PoiType['type'] = 'Camera', location: LocationItem, text: PoiType['text'] = '', place: PoiType['place'] = '', description: PoiType['description'] = '', linkId: PoiType['linkId'] = '') {
62
- const param: RequiredSome<PoiType, 'action' | 'type' | 'location'> = {
70
+ static poiShowHideByType(
71
+ action: 'show' | 'hide',
72
+ type: string,
73
+ place?: string
74
+ ) {
75
+ const data: {
76
+ action: 'show' | 'hide';
77
+ type: string;
78
+ place?: string;
79
+ } = {
80
+ action,
81
+ type
82
+ };
83
+
84
+ // 如果提供了 place,则添加
85
+ if (place) {
86
+ data.place = place;
87
+ }
88
+
89
+ const param: PoiType = {
63
90
  cmd: "POI",
64
- action: "update",
65
- type,
66
- text,
67
- location,
68
- place,
69
- description,
70
- linkId
71
- };
72
- this.sendParam(param, '更新POI')
91
+ data
92
+ };
93
+
94
+ const actionMap = {
95
+ show: '显示指定类型POI',
96
+ hide: '隐藏指定类型POI'
97
+ };
98
+ this.sendParam(param, actionMap[action])
73
99
  }
74
100
 
75
101
  /**
76
- * 删除poi
77
- * @param {*} id 点ID
78
- */
79
- static poiDel(id: string) {
102
+ * 显示所有POI
103
+ */
104
+ static poiShowAll() {
105
+ const data: {
106
+ action: 'showAll';
107
+ } = {
108
+ action: 'showAll'
109
+ };
110
+
80
111
  const param: PoiType = {
81
112
  cmd: "POI",
82
- action: "delete",
83
- id,
113
+ data
84
114
  };
85
- this.sendParam(param, '删除POI')
115
+ this.sendParam(param, '显示所有POI')
86
116
  }
87
117
 
88
118
  /**
89
- * 显示poi
90
- * @param {*} id POI的ID
91
- * @param {*} type 相机type
92
- * @param {*} place POI所在位置
119
+ * 隐藏所有POI
93
120
  */
94
- static poiShow(id: PoiType['id'], type: PoiType['type'], place: PoiType['place']) {
121
+ static poiHideAll() {
122
+ const data: {
123
+ action: 'hideAll';
124
+ } = {
125
+ action: 'hideAll'
126
+ };
127
+
95
128
  const param: PoiType = {
96
129
  cmd: "POI",
97
- action: "show",
98
- type,
99
- place
130
+ data
100
131
  };
101
- if (id) {
102
- param['id'] = id
103
- }
104
-
105
- this.sendParam(param, '显示POI')
132
+ this.sendParam(param, '隐藏所有POI')
106
133
  }
107
134
 
108
135
  /**
109
- * 隐藏poi
110
- * @param {*} id POI的ID
111
- * @param {*} type 相机type
112
- * @param {*} place POI所在位置
113
- */
114
- static poiHide(id: PoiType['id'], type: PoiType['type'], place: PoiType['place']) {
136
+ * 添加POI点
137
+ * @param baseInfos POI基础信息数组
138
+ */
139
+ static poiAdd(baseInfos: PoiBaseInfo[]) {
140
+ const data: {
141
+ action: 'add';
142
+ baseInfos: PoiBaseInfo[];
143
+ } = {
144
+ action: 'add',
145
+ baseInfos
146
+ };
147
+
115
148
  const param: PoiType = {
116
149
  cmd: "POI",
117
- action: "hide",
118
- type,
119
- place
150
+ data
120
151
  };
121
- if (id) {
122
- param['id'] = id
123
- }
124
-
125
- this.sendParam(param, '隐藏POI')
152
+ this.sendParam(param, '添加POI点')
126
153
  }
127
154
 
128
155
  /**
129
- * 把所有的POI恢复到Normal状态
130
- * @param {*} state normal一般状态 alarm 告警状态
156
+ * 删除POI
157
+ * @param id POI的ID、linkId或type,根据传入的值删除对应的POI
131
158
  */
132
- static poiNormal(state: 'normal' | 'alarm') {
159
+ static poiRemove(id: string) {
160
+ const data: {
161
+ action: 'remove';
162
+ id: string;
163
+ } = {
164
+ action: 'remove',
165
+ id
166
+ };
167
+
133
168
  const param: PoiType = {
134
169
  cmd: "POI",
135
- action: "status",
136
- state
170
+ data
137
171
  };
138
- this.sendParam(param, `恢复poi至${state}状态`)
172
+ this.sendParam(param, '删除POI点')
139
173
  }
140
174
 
141
175
  /**
142
- * 切换指定ID设备的poi状态
143
- * @param {*} ids 设备ID列表
144
- * @param {*} isLocation 是否定位到第一个ID对应的设备
176
+ * 更新POI点
177
+ * @param baseInfos POI更新信息数组(不包含type字段)
145
178
  */
146
- static poiSwitchStatus(ids: IdList, isLocation: boolean = false) {
147
- const param = {
148
- cmd: "status",
149
- isLocation,
150
- type: 'POI',
151
- ids
152
- }
153
- this.sendParam(param, `切换poi至指定状态`)
179
+ static poiUpdate(baseInfos: PoiUpdateInfo[]) {
180
+ const data: {
181
+ action: 'update';
182
+ baseInfos: PoiUpdateInfo[];
183
+ } = {
184
+ action: 'update',
185
+ baseInfos
186
+ };
187
+
188
+ const param: PoiType = {
189
+ cmd: "POI",
190
+ data
191
+ };
192
+ this.sendParam(param, '更新POI点')
154
193
  }
155
194
 
156
195
  /**
157
- * 获取指定POI
158
- * @param {*} type 相机type
196
+ * 获取POI点信息
197
+ * @param id 可选,POI的ID,如果提供则获取指定ID的POI信息
198
+ * @param type 可选,POI类型,如 "Camera",如果提供则获取指定类型的POI信息
199
+ * @param place 可选,地方,如 "A_1F",如果提供则获取指定地方指定类型的POI信息
159
200
  */
160
- static poiGetInfo(type: PoiType['type'] = 'Camera') {
201
+ static poiFind(id?: string, type?: string, place?: string) {
202
+ const data: {
203
+ action: 'find';
204
+ id?: string;
205
+ type?: string;
206
+ place?: string;
207
+ } = {
208
+ action: 'find'
209
+ };
210
+
211
+ // 如果提供了 id,则添加
212
+ if (id) {
213
+ data.id = id;
214
+ }
215
+
216
+ // 如果提供了 type,则添加
217
+ if (type) {
218
+ data.type = type;
219
+ }
220
+
221
+ // 如果提供了 place,则添加
222
+ if (place) {
223
+ data.place = place;
224
+ }
225
+
161
226
  const param: PoiType = {
162
227
  cmd: "POI",
163
- action: "getInfo",
164
- type,
228
+ data
165
229
  };
166
- this.sendParam(param, '获取POI信息')
230
+
231
+ // 根据参数组合生成不同的描述
232
+ let msg = '获取POI点信息';
233
+ if (id) {
234
+ msg = '获取指定ID的POI信息';
235
+ } else if (type && place) {
236
+ msg = '获取指定地方指定类型的POI信息';
237
+ } else if (type) {
238
+ msg = '获取指定类型的POI信息';
239
+ } else {
240
+ msg = '获取所有POI信息';
241
+ }
242
+
243
+ this.sendParam(param, msg)
167
244
  }
168
245
  }
@@ -1,117 +1,128 @@
1
-
2
1
  /**
3
- * 巡更
2
+ * 巡检操作方法
4
3
  */
5
- import { Action, } from "./Action";
4
+ import { Action, SendParam } from "./Action";
5
+
6
+ // 路由巡视动作类型
7
+ export type RoutingActionType = 'start' | 'stop' | 'pause' | 'restart'
8
+
9
+ // 路由巡视类型
10
+ export type RoutingType = 'videoPatrol'
11
+
12
+ // 路由巡视参数
13
+ export interface RoutingParam {
14
+ type: RoutingType; // 巡视类型,目前只有 videoPatrol
15
+ id: string; // 路线ID,命名规则:园区室外使用 VP-1, VP-2;室内分层建筑使用 A-1(A楼1楼)
16
+ isPauseAtRouting?: boolean; // 巡检途中遇到摄像头弹框时是否停下来,默认 false
17
+ isRolerMoveOnRouting?: boolean; // 巡检途中是否有人在路径上行走,默认 false
18
+ isViewFollow?: boolean; // 巡检途中视角是否跟随路径线,默认 false。true时,isRolerMoveOnRouting 应为 false
19
+ }
20
+
21
+ type RoutingParamType = SendParam & {
22
+ cmd: "routing";
23
+ data: {
24
+ action: RoutingActionType;
25
+ type?: RoutingType;
26
+ id?: string;
27
+ isPauseAtRouting?: boolean;
28
+ isRolerMoveOnRouting?: boolean;
29
+ isViewFollow?: boolean;
30
+ };
31
+ }
6
32
 
7
33
  export class RoutingAction extends Action {
8
34
  /**
9
- * 巡检开始
10
- * @param {*} id (必须)巡检的唯一ID)
11
- * @param {*} type (必须)巡检的类型)
12
- * videoPatrol => 视频巡更
13
- * cameraRoute => 视角跟随样条线
14
- */
15
- static videoPatrolStart(id: string, type: string = "videoPatrol", extendParams = {}) {
16
- const param: any = {
17
- cmd: "routing",
18
- action: "start",
19
- id,
20
- ...extendParams,
35
+ * 开始路由巡视
36
+ * 显示指定路线的巡视效果,相机跟随路线,线路是在场景中预设的一条固定的样条线
37
+ * @param param 路由巡视参数
38
+ */
39
+ static start(param: RoutingParam) {
40
+ // 如果 isViewFollow 为 true,则 isRolerMoveOnRouting 应该为 false
41
+ if (param.isViewFollow === true && param.isRolerMoveOnRouting === true) {
42
+ console.warn('当 isViewFollow true 时,isRolerMoveOnRouting 应该为 false');
43
+ }
44
+
45
+ const data: {
46
+ action: 'start';
47
+ type: RoutingType;
48
+ id: string;
49
+ isPauseAtRouting?: boolean;
50
+ isRolerMoveOnRouting?: boolean;
51
+ isViewFollow?: boolean;
52
+ } = {
53
+ action: 'start',
54
+ type: param.type,
55
+ id: param.id
21
56
  };
22
- if (type) {
23
- param.type = type
57
+
58
+ // 可选参数
59
+ if (param.isPauseAtRouting !== undefined) {
60
+ data.isPauseAtRouting = param.isPauseAtRouting;
61
+ }
62
+ if (param.isRolerMoveOnRouting !== undefined) {
63
+ data.isRolerMoveOnRouting = param.isRolerMoveOnRouting;
64
+ }
65
+ if (param.isViewFollow !== undefined) {
66
+ data.isViewFollow = param.isViewFollow;
24
67
  }
25
- this.sendParam(param, '巡更开始')
26
- }
27
68
 
28
- /**
29
- * 巡检结束
30
- * @param {*} id (必须)巡检的唯一ID)
31
- * @param {*} type (必须)巡检的类型)
32
- */
33
- static videoPatrolStop(id: string, type: string = "videoPatrol", extendParams = {}) {
34
- const param: any = {
69
+ const sendParam: RoutingParamType = {
35
70
  cmd: "routing",
36
- action: "stop",
37
- id,
38
- ...extendParams,
71
+ data
39
72
  };
40
- if (type) {
41
- param.type = type
42
- }
43
- this.sendParam(param, '巡更结束')
73
+ this.sendParam(sendParam, '开始路由巡视')
44
74
  }
45
75
 
46
76
  /**
47
- * 巡检暂停
48
- * @param {*} id (必须)巡检的唯一ID)
49
- * @param {*} type (必须)巡检的类型)
77
+ * 停止路由巡视
78
+ * 停止并隐藏巡视,整条巡检结束后,必须调用 start 才能重新开始
50
79
  */
51
- static videoPatrolPause(id: string, type: string = "videoPatrol", extendParams = {}) {
52
- const param: any = {
53
- cmd: "routing",
54
- action: "pause",
55
- id,
56
- ...extendParams,
80
+ static stop() {
81
+ const data: {
82
+ action: 'stop';
83
+ } = {
84
+ action: 'stop'
57
85
  };
58
- if (type) {
59
- param.type = type
60
- }
61
- this.sendParam(param, '巡更暂停')
62
- }
63
86
 
64
- /**
65
- * 巡检下一步
66
- * @param {*} id (必须)巡检的唯一ID)
67
- * @param {*} type (必须)巡检的类型)
68
- */
69
- static videoPatrolNext(id: string, type: string = "videoPatrol", extendParams = {}) {
70
- const param: any = {
87
+ const sendParam: RoutingParamType = {
71
88
  cmd: "routing",
72
- action: "next",
73
- id,
74
- ...extendParams,
89
+ data
75
90
  };
76
- if (type) {
77
- param.type = type
78
- }
79
- this.sendParam(param, '巡更下一步')
91
+ this.sendParam(sendParam, '停止路由巡视')
80
92
  }
81
93
 
82
94
  /**
83
- * 巡更上一步
84
- * @param {*} id (必须)巡检的唯一ID)
85
- * @param {*} type (必须)巡检的类型)
95
+ * 暂停路由巡视
86
96
  */
87
- static videoPatrolPrev(id: string, type: string = "videoPatrol", extendParams = {}) {
88
- const param: any = {
97
+ static pause() {
98
+ const data: {
99
+ action: 'pause';
100
+ } = {
101
+ action: 'pause'
102
+ };
103
+
104
+ const sendParam: RoutingParamType = {
89
105
  cmd: "routing",
90
- action: "last",
91
- id,
92
- ...extendParams,
106
+ data
93
107
  };
94
- if(type){
95
- param.type = type
96
- }
97
- this.sendParam(param, '巡更上一步')
108
+ this.sendParam(sendParam, '暂停路由巡视')
98
109
  }
99
110
 
100
111
  /**
101
- * 巡更重新开始,从暂停点开始
102
- * @param {*} id (必须)巡检的唯一ID)
103
- * @param {*} type (必须)巡检的类型)
112
+ * 重新开始路由巡视
113
+ * 从暂停点继续开始巡视
104
114
  */
105
- static videoPatrolRestart(id: string, type: string = "videoPatrol", extendParams = {}) {
106
- const param: any = {
115
+ static restart() {
116
+ const data: {
117
+ action: 'restart';
118
+ } = {
119
+ action: 'restart'
120
+ };
121
+
122
+ const sendParam: RoutingParamType = {
107
123
  cmd: "routing",
108
- action: "restart",
109
- id,
110
- ...extendParams,
124
+ data
111
125
  };
112
- if (type) {
113
- param.type = type
114
- }
115
- this.sendParam(param, '巡更重新开始,从暂停点开始')
126
+ this.sendParam(sendParam, '重新开始路由巡视')
116
127
  }
117
128
  }
@@ -1,35 +1,57 @@
1
-
2
-
3
-
4
1
  /**
5
- * 场景方法
2
+ * 场景操作方法
6
3
  */
7
4
  import { Action, SendParam } from "./Action";
8
5
 
6
+ // 场景操作类型
7
+ export type SceneActionType = 'changeSence' | 'resetSence';
9
8
 
10
- enum SceneActionType{
11
- Exit = '0', //退出独显
12
- Enter = '1', //进入独显
9
+ // 场景编码类型
10
+ export type SceneCode = 'QF' | 'RZ' | string; // QF = 曲阜,RZ = 日照
11
+
12
+ type SceneParamType = SendParam & {
13
+ cmd: "sence";
14
+ data: {
15
+ action: SceneActionType;
16
+ code?: SceneCode;
17
+ };
13
18
  }
14
- type SceneType = {
15
- action: SceneActionType,
16
- isAdjustLight: boolean //是否调整灯光
17
- tag?: string, //指定场景需要打的tag,根据项目定义,如果场景中只有一处需要独显,这里可以不传该字段
18
- } & SendParam
19
19
 
20
20
  export class SceneAction extends Action {
21
21
  /**
22
- * 独显某场景模型
23
- * @param {*} action 1进入独显 0退出独显
22
+ * 切换场景
23
+ * @param code 场景编码
24
24
  */
25
- static singleShow(action:SceneActionType,isAdjustLight:SceneType['isAdjustLight'] = false,tag:SceneType['tag']) {
26
- const param: SceneType = {
27
- cmd: "POI",
28
- action,
29
- tag,
30
- isAdjustLight
25
+ static changeSence(code: SceneCode) {
26
+ const data: {
27
+ action: 'changeSence';
28
+ code: SceneCode;
29
+ } = {
30
+ action: 'changeSence',
31
+ code
32
+ };
33
+
34
+ const sendParam: SceneParamType = {
35
+ cmd: "sence",
36
+ data
31
37
  };
32
- this.sendParam(param, `${action==='0'?'退出':'进入'}独显`);
38
+ this.sendParam(sendParam, `切换场景 - code: ${code}`);
33
39
  }
34
40
 
41
+ /**
42
+ * 重置场景到初始状态
43
+ */
44
+ static resetSence() {
45
+ const data: {
46
+ action: 'resetSence';
47
+ } = {
48
+ action: 'resetSence'
49
+ };
50
+
51
+ const sendParam: SceneParamType = {
52
+ cmd: "sence",
53
+ data
54
+ };
55
+ this.sendParam(sendParam, '重置场景到初始状态');
56
+ }
35
57
  }