model-action 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,78 +1,4 @@
1
- interface SendParam {
2
- cmd: string;
3
- action: string;
4
- [propName: string]: any;
5
- }
6
- interface IdItem {
7
- id: string;
8
- }
9
- type IdList = IdItem[];
10
- type PathList = Array<{
11
- location: string;
12
- }>;
13
- /**
14
- * 3D操作
15
- */
16
- export declare class ModelAction {
17
- /**
18
- * 视角初始化
19
- */
20
- static cameraInit(): void;
21
- /**
22
- * 视频融合初始化
23
- * @param {string} token
24
- * @param {string} ip
25
- * @param {string} port
26
- * @param {boolean} isHttps
27
- */
28
- static videoFusionInit(token: string, ip: string, port?: string, isHttps?: boolean): void;
29
- /**
30
- * 飞行到视频融合点位
31
- * @param {string} id 点ID
32
- * @param {number} fov 视场角
33
- */
34
- static videoFusionFlyTo(id: string, fov: number): void;
35
- /**
36
- * 开启视频融合
37
- * @param {IdList} ids 点列表
38
- */
39
- static videoFusionStart(ids: IdList): void;
40
- /**
41
- * 关闭视频融合
42
- * @param {IdList} ids 点列表
43
- */
44
- static videoFusionStop(ids: IdList): void;
45
- /**
46
- * 刷新视频融合
47
- * @param {string} token
48
- */
49
- static videoFusionRefresh(token: string): void;
50
- /**
51
- * 删除poi
52
- * @param {string} id
53
- */
54
- static poiDel(id: string): void;
55
- /**
56
- * 清除轨迹
57
- * @param {string} pathId add命令生成的轨迹ID
58
- */
59
- static trackRemove(pathId?: string): void;
60
- /**
61
- * 获取三维路网坐标
62
- * @param {IdList} data
63
- * @param {string} rnId
64
- */
65
- static trackGetRoadNet(data: IdList, rnId?: string): void;
66
- /**
67
- * 请求三维绘制路网
68
- * @param {PathList} data
69
- */
70
- static trackPath(data: PathList): void;
71
- /**
72
- * 发送到model
73
- * @param {SendParam} param 发送的参数
74
- * @param {string} msg 打印的信息
75
- */
76
- static sendParam(param: SendParam, msg?: string): void;
77
- }
78
- export {};
1
+ export { Action } from './modules/Action';
2
+ export { VideoFusionAction } from "./modules/VideoFusion";
3
+ export { PoiAction } from './modules/Poi';
4
+ export { TrackAction } from './modules/Track';
package/dist/index.js CHANGED
@@ -1,155 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModelAction = void 0;
4
- /**
5
- * 3D操作
6
- */
7
- class ModelAction {
8
- /**
9
- * 视角初始化
10
- */
11
- static cameraInit() {
12
- const param = {
13
- cmd: "cameraView",
14
- action: "default",
15
- };
16
- this.sendParam(param, '视角初始化');
17
- }
18
- /**
19
- * 视频融合初始化
20
- * @param {string} token
21
- * @param {string} ip
22
- * @param {string} port
23
- * @param {boolean} isHttps
24
- */
25
- static videoFusionInit(token, ip, port = '1998', isHttps = false) {
26
- const param = {
27
- cmd: "videoFusion",
28
- action: "init",
29
- token,
30
- ip,
31
- port,
32
- isHttps,
33
- };
34
- this.sendParam(param, '视频融合初始化');
35
- }
36
- /**
37
- * 飞行到视频融合点位
38
- * @param {string} id 点ID
39
- * @param {number} fov 视场角
40
- */
41
- static videoFusionFlyTo(id, fov) {
42
- const param = {
43
- cmd: "videoFusion",
44
- action: "flyTo",
45
- id,
46
- fov,
47
- };
48
- this.sendParam(param);
49
- }
50
- /**
51
- * 开启视频融合
52
- * @param {IdList} ids 点列表
53
- */
54
- static videoFusionStart(ids) {
55
- const param = {
56
- cmd: "videoFusion",
57
- action: "start",
58
- isLocation: false,
59
- videoType: "Video",
60
- backPlay: false,
61
- ids,
62
- };
63
- this.sendParam(param, '开启视频融合');
64
- }
65
- /**
66
- * 关闭视频融合
67
- * @param {IdList} ids 点列表
68
- */
69
- static videoFusionStop(ids) {
70
- const param = {
71
- cmd: "videoFusion",
72
- action: "stop",
73
- isLocation: false,
74
- videoType: "Video",
75
- backPlay: false,
76
- ids,
77
- };
78
- this.sendParam(param, '关闭视频融合');
79
- }
80
- /**
81
- * 刷新视频融合
82
- * @param {string} token
83
- */
84
- static videoFusionRefresh(token) {
85
- const param = {
86
- cmd: "videoFusion",
87
- action: "refresh",
88
- token,
89
- };
90
- this.sendParam(param);
91
- }
92
- /**
93
- * 删除poi
94
- * @param {string} id
95
- */
96
- static poiDel(id) {
97
- const param = {
98
- cmd: "POI",
99
- action: "delete",
100
- id,
101
- };
102
- this.sendParam(param, '删除POI');
103
- }
104
- /**
105
- * 清除轨迹
106
- * @param {string} pathId add命令生成的轨迹ID
107
- */
108
- static trackRemove(pathId = "CameraTrack") {
109
- const param = {
110
- cmd: "path",
111
- action: "remove",
112
- pathId
113
- };
114
- this.sendParam(param, '删除指定轨迹线');
115
- }
116
- /**
117
- * 获取三维路网坐标
118
- * @param {IdList} data
119
- * @param {string} rnId
120
- */
121
- static trackGetRoadNet(data, rnId = 'RN-1') {
122
- const param = {
123
- cmd: "path",
124
- action: "getRoadNet",
125
- rnId,
126
- data
127
- };
128
- this.sendParam(param, '获取三维路网坐标');
129
- }
130
- /**
131
- * 请求三维绘制路网
132
- * @param {PathList} data
133
- */
134
- static trackPath(data) {
135
- const param = {
136
- cmd: "path",
137
- action: "add",
138
- pathId: "CameraTrack",
139
- type: "BaseOnRoadNet",
140
- data
141
- };
142
- this.sendParam(param, '请求三维绘制路径');
143
- }
144
- /**
145
- * 发送到model
146
- * @param {SendParam} param 发送的参数
147
- * @param {string} msg 打印的信息
148
- */
149
- static sendParam(param, msg = '') {
150
- console.log(`发送给三维|${msg}`, JSON.stringify(param));
151
- window.ps.emitMessage(JSON.stringify(param));
152
- }
153
- }
154
- exports.ModelAction = ModelAction;
3
+ exports.TrackAction = exports.PoiAction = exports.VideoFusionAction = exports.Action = void 0;
4
+ var Action_1 = require("./modules/Action");
5
+ Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return Action_1.Action; } });
6
+ var VideoFusion_1 = require("./modules/VideoFusion");
7
+ Object.defineProperty(exports, "VideoFusionAction", { enumerable: true, get: function () { return VideoFusion_1.VideoFusionAction; } });
8
+ var Poi_1 = require("./modules/Poi");
9
+ Object.defineProperty(exports, "PoiAction", { enumerable: true, get: function () { return Poi_1.PoiAction; } });
10
+ var Track_1 = require("./modules/Track");
11
+ Object.defineProperty(exports, "TrackAction", { enumerable: true, get: function () { return Track_1.TrackAction; } });
155
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAgBA;;GAEG;AACH,MAAa,WAAW;IACpB;;OAEG;IACH,MAAM,CAAC,UAAU;QACb,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,YAAY;YACjB,MAAM,EAAE,SAAS;SACpB,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,eAAe,CAAC,KAAa,EAAE,EAAU,EAAE,OAAe,MAAM,EAAE,UAAmB,KAAK;QAC7F,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,MAAM;YACd,KAAK;YACL,EAAE;YACF,IAAI;YACJ,OAAO;SACV,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACpC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,EAAU,EAAE,GAAW;QAC3C,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,OAAO;YACf,EAAE;YACF,GAAG;SACN,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAW;QAC/B,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,KAA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,EAAE,UAAU,CAAC,CAAA;IACrC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,IAAc;QAC3B,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,aAAa;YACrB,IAAI,EAAE,eAAe;YACrB,IAAI;SACP,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IACrC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,KAAgB,EAAE,MAAc,EAAE;QAC/C,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,MAAc,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1D,CAAC;CACJ;AA5JD,kCA4JC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,gGAAA,MAAM,OAAA;AACf,qDAA0D;AAAjD,gHAAA,iBAAiB,OAAA;AAC1B,qCAAyC;AAAhC,gGAAA,SAAS,OAAA;AAClB,yCAA6C;AAApC,oGAAA,WAAW,OAAA"}
@@ -0,0 +1,12 @@
1
+ export declare class Action {
2
+ /**
3
+ * 视角初始化
4
+ */
5
+ static cameraInit(): void;
6
+ /**
7
+ * 发送到model
8
+ * @param {SendParam} param 发送的参数
9
+ * @param {string} msg 打印的信息
10
+ */
11
+ static sendParam<T extends SendParam>(param: T, msg?: string): void;
12
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Action = void 0;
4
+ class Action {
5
+ /**
6
+ * 视角初始化
7
+ */
8
+ static cameraInit() {
9
+ const param = {
10
+ cmd: "cameraView",
11
+ action: "default",
12
+ };
13
+ this.sendParam(param, '视角初始化');
14
+ }
15
+ /**
16
+ * 发送到model
17
+ * @param {SendParam} param 发送的参数
18
+ * @param {string} msg 打印的信息
19
+ */
20
+ static sendParam(param, msg = '') {
21
+ var _a;
22
+ console.log(`发送给三维|${msg}`, JSON.stringify(param));
23
+ (_a = window.ps) === null || _a === void 0 ? void 0 : _a.emitMessage(JSON.stringify(param));
24
+ }
25
+ }
26
+ exports.Action = Action;
27
+ //# sourceMappingURL=Action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/modules/Action.ts"],"names":[],"mappings":";;;AAAA,MAAa,MAAM;IACf;;MAEE;IACF,MAAM,CAAC,UAAU;QACb,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,YAAY;YACjB,MAAM,EAAE,SAAS;SACpB,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAsB,KAAQ,EAAE,MAAc,EAAE;;QAC5D,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACnD,MAAC,MAAc,CAAC,EAAE,0CAAE,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC;CACJ;AArBD,wBAqBC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * POI点方法
3
+ */
4
+ import { Action } from "./Action";
5
+ export declare class PoiAction extends Action {
6
+ /**
7
+ * 添加poi
8
+ */
9
+ static poiAdd({ type, location, text, place, description, linkId }: RequiredSome<PoiType, 'action' | 'type' | 'location'>): void;
10
+ /**
11
+ * 删除poi
12
+ */
13
+ static poiDel({ id }: PoiType): void;
14
+ /**
15
+ * 显示poi
16
+ */
17
+ static poiShow({ id, type, place }: PoiType): void;
18
+ /**
19
+ * 隐藏poi
20
+ */
21
+ static poiHide({ id, type, place }: PoiType): void;
22
+ /**
23
+ * 获取指定POI
24
+ */
25
+ static poiGetInfo({ type }: PoiType): void;
26
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PoiAction = void 0;
4
+ /**
5
+ * POI点方法
6
+ */
7
+ const Action_1 = require("./Action");
8
+ class PoiAction extends Action_1.Action {
9
+ /**
10
+ * 添加poi
11
+ */
12
+ static poiAdd({ type = 'Camera', location, text = '', place = '', description = '', linkId = '' }) {
13
+ const param = {
14
+ cmd: "POI",
15
+ action: "add",
16
+ type,
17
+ text,
18
+ location,
19
+ place,
20
+ description,
21
+ linkId
22
+ };
23
+ this.sendParam(param, '删除POI');
24
+ }
25
+ /**
26
+ * 删除poi
27
+ */
28
+ static poiDel({ id }) {
29
+ const param = {
30
+ cmd: "POI",
31
+ action: "delete",
32
+ id,
33
+ };
34
+ this.sendParam(param, '删除POI');
35
+ }
36
+ /**
37
+ * 显示poi
38
+ */
39
+ static poiShow({ id, type = "Camera", place }) {
40
+ const param = {
41
+ cmd: "POI",
42
+ action: "show",
43
+ type,
44
+ place
45
+ };
46
+ if (id) {
47
+ param['id'] = id;
48
+ }
49
+ this.sendParam(param, '显示POI');
50
+ }
51
+ /**
52
+ * 隐藏poi
53
+ */
54
+ static poiHide({ id, type = "Camera", place }) {
55
+ const param = {
56
+ cmd: "POI",
57
+ action: "hide",
58
+ type,
59
+ place
60
+ };
61
+ if (id) {
62
+ param['id'] = id;
63
+ }
64
+ this.sendParam(param, '隐藏POI');
65
+ }
66
+ /**
67
+ * 获取指定POI
68
+ */
69
+ static poiGetInfo({ type = 'Camera' }) {
70
+ const param = {
71
+ cmd: "POI",
72
+ action: "getInfo",
73
+ type,
74
+ };
75
+ this.sendParam(param, '获取POI信息');
76
+ }
77
+ }
78
+ exports.PoiAction = PoiAction;
79
+ //# sourceMappingURL=Poi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Poi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AAG,EAAE,KAAK;YACV,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,KAAK;SACR,CAAC;QACF,IAAI,EAAE,EAAE,CAAC;YACL,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QACpB,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,EAAC,IAAI,GAAC,QAAQ,EAAS;QACrC,MAAM,KAAK,GAAY;YACnB,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,SAAS;YACjB,IAAI;SACP,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACpC,CAAC;CACJ;AA3ED,8BA2EC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 轨迹方法
3
+ */
4
+ import { Action } from "./Action";
5
+ export declare class TrackAction extends Action {
6
+ /**
7
+ * 清除轨迹
8
+ */
9
+ static trackRemove({ pathId }: TrackType): void;
10
+ /**
11
+ * 获取三维路网坐标
12
+ */
13
+ static trackGetRoadNet({ data, rnId }: TrackType): void;
14
+ /**
15
+ * 请求三维绘制路网
16
+ */
17
+ static trackPath({ data, pathId }: TrackType): void;
18
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrackAction = void 0;
4
+ /**
5
+ * 轨迹方法
6
+ */
7
+ const Action_1 = require("./Action");
8
+ class TrackAction extends Action_1.Action {
9
+ /**
10
+ * 清除轨迹
11
+ */
12
+ static trackRemove({ pathId = "CameraTrack" }) {
13
+ const param = {
14
+ cmd: "path",
15
+ action: "remove",
16
+ pathId
17
+ };
18
+ this.sendParam(param, '删除指定轨迹线');
19
+ }
20
+ /**
21
+ * 获取三维路网坐标
22
+ */
23
+ static trackGetRoadNet({ data, rnId = 'RN-1' }) {
24
+ const param = {
25
+ cmd: "path",
26
+ action: "getRoadNet",
27
+ rnId,
28
+ data
29
+ };
30
+ this.sendParam(param, '获取三维路网坐标');
31
+ }
32
+ /**
33
+ * 请求三维绘制路网
34
+ */
35
+ static trackPath({ data, pathId = "CameraTrack" }) {
36
+ const param = {
37
+ cmd: "path",
38
+ action: "add",
39
+ pathId,
40
+ type: "BaseOnRoadNet",
41
+ data
42
+ };
43
+ this.sendParam(param, '请求三维绘制路径');
44
+ }
45
+ }
46
+ exports.TrackAction = TrackAction;
47
+ //# sourceMappingURL=Track.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Track.js","sourceRoot":"","sources":["../../src/modules/Track.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qCAAkC;AAElC,MAAa,WAAY,SAAQ,eAAM;IACnC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,EAAa;QACpD,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,QAAQ;YAChB,MAAM;SACT,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,EAAa;QACrD,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,YAAY;YACpB,IAAI;YACJ,IAAI;SACP,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,EAAa;QACxD,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,KAAK;YACb,MAAM;YACN,IAAI,EAAE,eAAe;YACrB,IAAI;SACP,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IACrC,CAAC;CACJ;AAvCD,kCAuCC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 视频融合方法
3
+ */
4
+ import { Action } from "./Action";
5
+ export declare class VideoFusionAction extends Action {
6
+ /**
7
+ * 视频融合初始化
8
+ */
9
+ static videoFusionInit({ token, ip, port, isHttps }: VideoFusionType): void;
10
+ /**
11
+ * 飞行到视频融合点位
12
+ */
13
+ static videoFusionFlyTo({ id, fov }: VideoFusionType): void;
14
+ /**
15
+ * 开启视频融合
16
+ */
17
+ static videoFusionStart({ ids }: VideoFusionType): void;
18
+ /**
19
+ * 关闭视频融合
20
+ */
21
+ static videoFusionStop({ ids }: VideoFusionType): void;
22
+ /**
23
+ * 刷新视频融合
24
+ */
25
+ static videoFusionRefresh({ token }: VideoFusionType): void;
26
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoFusionAction = void 0;
4
+ /**
5
+ * 视频融合方法
6
+ */
7
+ const Action_1 = require("./Action");
8
+ class VideoFusionAction extends Action_1.Action {
9
+ /**
10
+ * 视频融合初始化
11
+ */
12
+ static videoFusionInit({ token, ip, port = '1998', isHttps = false }) {
13
+ const param = {
14
+ cmd: "videoFusion",
15
+ action: "init",
16
+ token,
17
+ ip,
18
+ port,
19
+ isHttps,
20
+ };
21
+ this.sendParam(param, '视频融合初始化');
22
+ }
23
+ /**
24
+ * 飞行到视频融合点位
25
+ */
26
+ static videoFusionFlyTo({ id, fov }) {
27
+ const param = {
28
+ cmd: "videoFusion",
29
+ action: "flyTo",
30
+ id,
31
+ fov,
32
+ };
33
+ this.sendParam(param);
34
+ }
35
+ /**
36
+ * 开启视频融合
37
+ */
38
+ static videoFusionStart({ ids }) {
39
+ const param = {
40
+ cmd: "videoFusion",
41
+ action: "start",
42
+ isLocation: false,
43
+ videoType: "Video",
44
+ backPlay: false,
45
+ ids,
46
+ };
47
+ this.sendParam(param, '开启视频融合');
48
+ }
49
+ /**
50
+ * 关闭视频融合
51
+ */
52
+ static videoFusionStop({ ids }) {
53
+ const param = {
54
+ cmd: "videoFusion",
55
+ action: "stop",
56
+ isLocation: false,
57
+ videoType: "Video",
58
+ backPlay: false,
59
+ ids,
60
+ };
61
+ this.sendParam(param, '关闭视频融合');
62
+ }
63
+ /**
64
+ * 刷新视频融合
65
+ */
66
+ static videoFusionRefresh({ token }) {
67
+ const param = {
68
+ cmd: "videoFusion",
69
+ action: "refresh",
70
+ token,
71
+ };
72
+ this.sendParam(param);
73
+ }
74
+ }
75
+ exports.VideoFusionAction = VideoFusionAction;
76
+ //# sourceMappingURL=VideoFusion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoFusion.js","sourceRoot":"","sources":["../../src/modules/VideoFusion.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qCAAkC;AAElC,MAAa,iBAAkB,SAAQ,eAAM;IACzC;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,GAAG,MAAM,EAAE,OAAO,GAAG,KAAK,EAAmB;QACjF,MAAM,KAAK,GAAoB;YAC3B,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,MAAM;YACd,KAAK;YACL,EAAE;YACF,IAAI;YACJ,OAAO;SACV,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACpC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,EAAC,EAAE,EAAE,GAAG,EAAiB;QAC7C,MAAM,KAAK,GAAoB;YAC3B,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,OAAO;YACf,EAAE;YACF,GAAG;SACN,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,EAAC,GAAG,EAAiB;QACzC,MAAM,KAAK,GAAoB;YAC3B,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,KAAK;YACf,GAAG;SACN,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,EAAC,GAAG,EAAiB;QACxC,MAAM,KAAK,GAAoB;YAC3B,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,KAAK;YACjB,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,KAAK;YACf,GAAG;SACN,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,EAAC,KAAK,EAAiB;QAC7C,MAAM,KAAK,GAAoB;YAC3B,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,SAAS;YACjB,KAAK;SACR,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;CACJ;AAtED,8CAsEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "model-action",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "与三维交互api",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,176 +1,4 @@
1
- interface SendParam {
2
- cmd: string,
3
- action: string,
4
- [propName: string]: any
5
- }
6
-
7
- interface IdItem {
8
- id: string;
9
- }
10
-
11
- type IdList = IdItem[];
12
-
13
-
14
- type PathList = Array<{
15
- location: string
16
- }>
17
- /**
18
- * 3D操作
19
- */
20
- export class ModelAction {
21
- /**
22
- * 视角初始化
23
- */
24
- static cameraInit() {
25
- const param: SendParam = {
26
- cmd: "cameraView",
27
- action: "default",
28
- };
29
- this.sendParam(param, '视角初始化')
30
- }
31
-
32
- /**
33
- * 视频融合初始化
34
- * @param {string} token
35
- * @param {string} ip
36
- * @param {string} port
37
- * @param {boolean} isHttps
38
- */
39
- static videoFusionInit(token: string, ip: string, port: string = '1998', isHttps: boolean = false) {
40
- const param: SendParam = {
41
- cmd: "videoFusion",
42
- action: "init",
43
- token,
44
- ip,
45
- port,
46
- isHttps,
47
- };
48
- this.sendParam(param, '视频融合初始化')
49
- }
50
-
51
- /**
52
- * 飞行到视频融合点位
53
- * @param {string} id 点ID
54
- * @param {number} fov 视场角
55
- */
56
- static videoFusionFlyTo(id: string, fov: number) {
57
- const param: SendParam = {
58
- cmd: "videoFusion",
59
- action: "flyTo",
60
- id,
61
- fov,
62
- };
63
- this.sendParam(param)
64
- }
65
-
66
- /**
67
- * 开启视频融合
68
- * @param {IdList} ids 点列表
69
- */
70
- static videoFusionStart(ids: IdList) {
71
- const param: SendParam = {
72
- cmd: "videoFusion",
73
- action: "start",
74
- isLocation: false,
75
- videoType: "Video",
76
- backPlay: false,
77
- ids,
78
- };
79
- this.sendParam(param, '开启视频融合')
80
- }
81
-
82
- /**
83
- * 关闭视频融合
84
- * @param {IdList} ids 点列表
85
- */
86
- static videoFusionStop(ids: IdList) {
87
- const param: SendParam = {
88
- cmd: "videoFusion",
89
- action: "stop",
90
- isLocation: false,
91
- videoType: "Video",
92
- backPlay: false,
93
- ids,
94
- };
95
- this.sendParam(param, '关闭视频融合')
96
- }
97
-
98
- /**
99
- * 刷新视频融合
100
- * @param {string} token
101
- */
102
- static videoFusionRefresh(token: string) {
103
- const param: SendParam = {
104
- cmd: "videoFusion",
105
- action: "refresh",
106
- token,
107
- };
108
- this.sendParam(param)
109
- }
110
-
111
- /**
112
- * 删除poi
113
- * @param {string} id
114
- */
115
- static poiDel(id: string) {
116
- const param: SendParam = {
117
- cmd: "POI",
118
- action: "delete",
119
- id,
120
- };
121
- this.sendParam(param, '删除POI')
122
- }
123
-
124
- /**
125
- * 清除轨迹
126
- * @param {string} pathId add命令生成的轨迹ID
127
- */
128
- static trackRemove(pathId: string = "CameraTrack") {
129
- const param: SendParam = {
130
- cmd: "path",
131
- action: "remove",
132
- pathId
133
- };
134
- this.sendParam(param, '删除指定轨迹线');
135
- }
136
-
137
- /**
138
- * 获取三维路网坐标
139
- * @param {IdList} data
140
- * @param {string} rnId
141
- */
142
- static trackGetRoadNet(data: IdList, rnId: string = 'RN-1') {
143
- const param: SendParam = {
144
- cmd: "path",
145
- action: "getRoadNet",
146
- rnId,
147
- data
148
- };
149
- this.sendParam(param, '获取三维路网坐标')
150
- }
151
-
152
- /**
153
- * 请求三维绘制路网
154
- * @param {PathList} data
155
- */
156
- static trackPath(data: PathList) {
157
- const param: SendParam = {
158
- cmd: "path",
159
- action: "add",
160
- pathId: "CameraTrack",
161
- type: "BaseOnRoadNet",
162
- data
163
- };
164
- this.sendParam(param, '请求三维绘制路径')
165
- }
166
-
167
- /**
168
- * 发送到model
169
- * @param {SendParam} param 发送的参数
170
- * @param {string} msg 打印的信息
171
- */
172
- static sendParam(param: SendParam, msg: string = '') {
173
- console.log(`发送给三维|${msg}`, JSON.stringify(param));
174
- (window as any).ps.emitMessage(JSON.stringify(param));
175
- }
176
- }
1
+ export { Action } from './modules/Action'
2
+ export { VideoFusionAction } from "./modules/VideoFusion";
3
+ export { PoiAction } from './modules/Poi'
4
+ export { TrackAction } from './modules/Track'
@@ -0,0 +1,22 @@
1
+ export class Action {
2
+ /**
3
+ * 视角初始化
4
+ */
5
+ static cameraInit() {
6
+ const param: SendParam = {
7
+ cmd: "cameraView",
8
+ action: "default",
9
+ };
10
+ this.sendParam(param, '视角初始化')
11
+ }
12
+
13
+ /**
14
+ * 发送到model
15
+ * @param {SendParam} param 发送的参数
16
+ * @param {string} msg 打印的信息
17
+ */
18
+ static sendParam<T extends SendParam>(param: T, msg: string = '') {
19
+ console.log(`发送给三维|${msg}`, JSON.stringify(param));
20
+ (window as any).ps?.emitMessage(JSON.stringify(param));
21
+ }
22
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * POI点方法
3
+ */
4
+ import { Action } from "./Action";
5
+
6
+ export class PoiAction extends Action {
7
+ /**
8
+ * 添加poi
9
+ */
10
+ static poiAdd({ type = 'Camera', location, text = '', place = '', description = '', linkId = '' }: RequiredSome<PoiType, 'action' | 'type' | 'location'>) {
11
+ const param: RequiredSome<PoiType, 'action' | 'type' | 'location'> = {
12
+ cmd: "POI",
13
+ action: "add",
14
+ type,
15
+ text,
16
+ location,
17
+ place,
18
+ description,
19
+ linkId
20
+ };
21
+ this.sendParam(param, '删除POI')
22
+ }
23
+
24
+ /**
25
+ * 删除poi
26
+ */
27
+ static poiDel({ id }: PoiType) {
28
+ const param: PoiType = {
29
+ cmd: "POI",
30
+ action: "delete",
31
+ id,
32
+ };
33
+ this.sendParam(param, '删除POI')
34
+ }
35
+
36
+ /**
37
+ * 显示poi
38
+ */
39
+ static poiShow({ id, type = "Camera", place }: PoiType) {
40
+ const param: PoiType = {
41
+ cmd: "POI",
42
+ action: "show",
43
+ type,
44
+ place
45
+ };
46
+ if (id) {
47
+ param['id'] = id
48
+ }
49
+
50
+ this.sendParam(param, '显示POI')
51
+ }
52
+
53
+ /**
54
+ * 隐藏poi
55
+ */
56
+ static poiHide({ id, type = "Camera", place }: PoiType) {
57
+ const param: PoiType = {
58
+ cmd: "POI",
59
+ action: "hide",
60
+ type,
61
+ place
62
+ };
63
+ if (id) {
64
+ param['id'] = id
65
+ }
66
+
67
+ this.sendParam(param, '隐藏POI')
68
+ }
69
+
70
+ /**
71
+ * 获取指定POI
72
+ */
73
+ static poiGetInfo({type='Camera'}:PoiType) {
74
+ const param: PoiType = {
75
+ cmd: "POI",
76
+ action: "getInfo",
77
+ type,
78
+ };
79
+ this.sendParam(param, '获取POI信息')
80
+ }
81
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * 轨迹方法
3
+ */
4
+ import { Action } from "./Action";
5
+
6
+ export class TrackAction extends Action {
7
+ /**
8
+ * 清除轨迹
9
+ */
10
+ static trackRemove({ pathId = "CameraTrack" }: TrackType) {
11
+ const param: TrackType = {
12
+ cmd: "path",
13
+ action: "remove",
14
+ pathId
15
+ };
16
+ this.sendParam(param, '删除指定轨迹线');
17
+ }
18
+
19
+ /**
20
+ * 获取三维路网坐标
21
+ */
22
+ static trackGetRoadNet({ data, rnId = 'RN-1' }: TrackType) {
23
+ const param: TrackType = {
24
+ cmd: "path",
25
+ action: "getRoadNet",
26
+ rnId,
27
+ data
28
+ };
29
+ this.sendParam(param, '获取三维路网坐标')
30
+ }
31
+
32
+ /**
33
+ * 请求三维绘制路网
34
+ */
35
+ static trackPath({ data, pathId = "CameraTrack" }: TrackType) {
36
+ const param: TrackType = {
37
+ cmd: "path",
38
+ action: "add",
39
+ pathId,
40
+ type: "BaseOnRoadNet",
41
+ data
42
+ };
43
+ this.sendParam(param, '请求三维绘制路径')
44
+ }
45
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * 视频融合方法
3
+ */
4
+ import { Action } from "./Action";
5
+
6
+ export class VideoFusionAction extends Action {
7
+ /**
8
+ * 视频融合初始化
9
+ */
10
+ static videoFusionInit({ token, ip, port = '1998', isHttps = false }: VideoFusionType) {
11
+ const param: VideoFusionType = {
12
+ cmd: "videoFusion",
13
+ action: "init",
14
+ token,
15
+ ip,
16
+ port,
17
+ isHttps,
18
+ };
19
+ this.sendParam(param, '视频融合初始化')
20
+ }
21
+
22
+ /**
23
+ * 飞行到视频融合点位
24
+ */
25
+ static videoFusionFlyTo({id, fov}:VideoFusionType) {
26
+ const param: VideoFusionType = {
27
+ cmd: "videoFusion",
28
+ action: "flyTo",
29
+ id,
30
+ fov,
31
+ };
32
+ this.sendParam(param)
33
+ }
34
+
35
+ /**
36
+ * 开启视频融合
37
+ */
38
+ static videoFusionStart({ids}:VideoFusionType) {
39
+ const param: VideoFusionType = {
40
+ cmd: "videoFusion",
41
+ action: "start",
42
+ isLocation: false,
43
+ videoType: "Video",
44
+ backPlay: false,
45
+ ids,
46
+ };
47
+ this.sendParam(param, '开启视频融合')
48
+ }
49
+
50
+ /**
51
+ * 关闭视频融合
52
+ */
53
+ static videoFusionStop({ids}:VideoFusionType) {
54
+ const param: VideoFusionType = {
55
+ cmd: "videoFusion",
56
+ action: "stop",
57
+ isLocation: false,
58
+ videoType: "Video",
59
+ backPlay: false,
60
+ ids,
61
+ };
62
+ this.sendParam(param, '关闭视频融合')
63
+ }
64
+
65
+ /**
66
+ * 刷新视频融合
67
+ */
68
+ static videoFusionRefresh({token}:VideoFusionType) {
69
+ const param: VideoFusionType = {
70
+ cmd: "videoFusion",
71
+ action: "refresh",
72
+ token,
73
+ };
74
+ this.sendParam(param)
75
+ }
76
+ }