model-action 1.0.0 → 1.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.
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,KAAK;YACf,GAAG;SACN,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IACnC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,GAAW;QAC9B,MAAM,KAAK,GAAc;YACrB,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;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAa;QACnC,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,SAAS;YACjB,KAAK;SACR,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,EAAU;QACpB,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,QAAQ;YAChB,EAAE;SACL,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,SAAiB,aAAa;QAC7C,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;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,IAAY,EAAE,OAAe,MAAM;QACtD,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;;;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(param: SendParam, 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,CAAC,KAAgB,EAAE,MAAc,EAAE;;QAC/C,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,11 @@
1
+ /**
2
+ * POI点方法
3
+ */
4
+ import { Action } from "./Action";
5
+ export declare class PoiAction extends Action {
6
+ /**
7
+ * 删除poi
8
+ * @param {string} id
9
+ */
10
+ static poiDel(id: string): void;
11
+ }
@@ -0,0 +1,23 @@
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
+ * @param {string} id
12
+ */
13
+ static poiDel(id) {
14
+ const param = {
15
+ cmd: "POI",
16
+ action: "delete",
17
+ id,
18
+ };
19
+ this.sendParam(param, '删除POI');
20
+ }
21
+ }
22
+ exports.PoiAction = PoiAction;
23
+ //# sourceMappingURL=Poi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Poi.js","sourceRoot":"","sources":["../../src/modules/Poi.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qCAAkC;AAElC,MAAa,SAAU,SAAQ,eAAM;IACjC;;;MAGE;IACF,MAAM,CAAC,MAAM,CAAC,EAAU;QACpB,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,KAAK;YACV,MAAM,EAAE,QAAQ;YAChB,EAAE;SACL,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;CAEJ;AAdD,8BAcC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 轨迹方法
3
+ */
4
+ import { Action } from "./Action";
5
+ export declare class TrackAction extends Action {
6
+ /**
7
+ * 清除轨迹
8
+ * @param {string} pathId add命令生成的轨迹ID
9
+ */
10
+ static trackRemove(pathId?: string): void;
11
+ /**
12
+ * 获取三维路网坐标
13
+ * @param {IdList} data
14
+ * @param {string} rnId
15
+ */
16
+ static trackGetRoadNet(data: IdList, rnId?: string): void;
17
+ /**
18
+ * 请求三维绘制路网
19
+ * @param {PathList} data
20
+ */
21
+ static trackPath(data: PathList): void;
22
+ }
@@ -0,0 +1,51 @@
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
+ * @param {string} pathId add命令生成的轨迹ID
12
+ */
13
+ static trackRemove(pathId = "CameraTrack") {
14
+ const param = {
15
+ cmd: "path",
16
+ action: "remove",
17
+ pathId
18
+ };
19
+ this.sendParam(param, '删除指定轨迹线');
20
+ }
21
+ /**
22
+ * 获取三维路网坐标
23
+ * @param {IdList} data
24
+ * @param {string} rnId
25
+ */
26
+ static trackGetRoadNet(data, rnId = 'RN-1') {
27
+ const param = {
28
+ cmd: "path",
29
+ action: "getRoadNet",
30
+ rnId,
31
+ data
32
+ };
33
+ this.sendParam(param, '获取三维路网坐标');
34
+ }
35
+ /**
36
+ * 请求三维绘制路网
37
+ * @param {PathList} data
38
+ */
39
+ static trackPath(data) {
40
+ const param = {
41
+ cmd: "path",
42
+ action: "add",
43
+ pathId: "CameraTrack",
44
+ type: "BaseOnRoadNet",
45
+ data
46
+ };
47
+ this.sendParam(param, '请求三维绘制路径');
48
+ }
49
+ }
50
+ exports.TrackAction = TrackAction;
51
+ //# 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;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,SAAiB,aAAa;QAC7C,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;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,IAAY,EAAE,OAAe,MAAM;QACtD,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;;;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;CACJ;AA3CD,kCA2CC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * 视频融合方法
3
+ */
4
+ import { Action } from "./Action";
5
+ export declare class VideoFusionAction extends Action {
6
+ /**
7
+ * 视频融合初始化
8
+ * @param {string} token
9
+ * @param {string} ip
10
+ * @param {string} port
11
+ * @param {boolean} isHttps
12
+ */
13
+ static videoFusionInit(token: string, ip: string, port?: string, isHttps?: boolean): void;
14
+ /**
15
+ * 飞行到视频融合点位
16
+ * @param {string} id 点ID
17
+ * @param {number} fov 视场角
18
+ */
19
+ static videoFusionFlyTo(id: string, fov: number): void;
20
+ /**
21
+ * 开启视频融合
22
+ * @param {IdList} ids 点列表
23
+ */
24
+ static videoFusionStart(ids: IdList): void;
25
+ /**
26
+ * 关闭视频融合
27
+ * @param {IdList} ids 点列表
28
+ */
29
+ static videoFusionStop(ids: IdList): void;
30
+ /**
31
+ * 刷新视频融合
32
+ * @param {string} token
33
+ */
34
+ static videoFusionRefresh(token: string): void;
35
+ }
@@ -0,0 +1,85 @@
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
+ * @param {string} token
12
+ * @param {string} ip
13
+ * @param {string} port
14
+ * @param {boolean} isHttps
15
+ */
16
+ static videoFusionInit(token, ip, port = '1998', isHttps = false) {
17
+ const param = {
18
+ cmd: "videoFusion",
19
+ action: "init",
20
+ token,
21
+ ip,
22
+ port,
23
+ isHttps,
24
+ };
25
+ this.sendParam(param, '视频融合初始化');
26
+ }
27
+ /**
28
+ * 飞行到视频融合点位
29
+ * @param {string} id 点ID
30
+ * @param {number} fov 视场角
31
+ */
32
+ static videoFusionFlyTo(id, fov) {
33
+ const param = {
34
+ cmd: "videoFusion",
35
+ action: "flyTo",
36
+ id,
37
+ fov,
38
+ };
39
+ this.sendParam(param);
40
+ }
41
+ /**
42
+ * 开启视频融合
43
+ * @param {IdList} ids 点列表
44
+ */
45
+ static videoFusionStart(ids) {
46
+ const param = {
47
+ cmd: "videoFusion",
48
+ action: "start",
49
+ isLocation: false,
50
+ videoType: "Video",
51
+ backPlay: false,
52
+ ids,
53
+ };
54
+ this.sendParam(param, '开启视频融合');
55
+ }
56
+ /**
57
+ * 关闭视频融合
58
+ * @param {IdList} ids 点列表
59
+ */
60
+ static videoFusionStop(ids) {
61
+ const param = {
62
+ cmd: "videoFusion",
63
+ action: "stop",
64
+ isLocation: false,
65
+ videoType: "Video",
66
+ backPlay: false,
67
+ ids,
68
+ };
69
+ this.sendParam(param, '关闭视频融合');
70
+ }
71
+ /**
72
+ * 刷新视频融合
73
+ * @param {string} token
74
+ */
75
+ static videoFusionRefresh(token) {
76
+ const param = {
77
+ cmd: "videoFusion",
78
+ action: "refresh",
79
+ token,
80
+ };
81
+ this.sendParam(param);
82
+ }
83
+ }
84
+ exports.VideoFusionAction = VideoFusionAction;
85
+ //# 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;;;;;;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,KAAK;YACf,GAAG;SACN,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IACnC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,GAAW;QAC9B,MAAM,KAAK,GAAc;YACrB,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;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAa;QACnC,MAAM,KAAK,GAAc;YACrB,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,SAAS;YACjB,KAAK;SACR,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;CACJ;AA/ED,8CA+EC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "model-action",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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(param: SendParam, msg: string = '') {
19
+ console.log(`发送给三维|${msg}`, JSON.stringify(param));
20
+ (window as any).ps?.emitMessage(JSON.stringify(param));
21
+ }
22
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * POI点方法
3
+ */
4
+ import { Action } from "./Action";
5
+
6
+ export class PoiAction extends Action {
7
+ /**
8
+ * 删除poi
9
+ * @param {string} id
10
+ */
11
+ static poiDel(id: string) {
12
+ const param: SendParam = {
13
+ cmd: "POI",
14
+ action: "delete",
15
+ id,
16
+ };
17
+ this.sendParam(param, '删除POI')
18
+ }
19
+
20
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * 轨迹方法
3
+ */
4
+ import { Action } from "./Action";
5
+
6
+ export class TrackAction extends Action {
7
+ /**
8
+ * 清除轨迹
9
+ * @param {string} pathId add命令生成的轨迹ID
10
+ */
11
+ static trackRemove(pathId: string = "CameraTrack") {
12
+ const param: SendParam = {
13
+ cmd: "path",
14
+ action: "remove",
15
+ pathId
16
+ };
17
+ this.sendParam(param, '删除指定轨迹线');
18
+ }
19
+
20
+ /**
21
+ * 获取三维路网坐标
22
+ * @param {IdList} data
23
+ * @param {string} rnId
24
+ */
25
+ static trackGetRoadNet(data: IdList, rnId: string = 'RN-1') {
26
+ const param: SendParam = {
27
+ cmd: "path",
28
+ action: "getRoadNet",
29
+ rnId,
30
+ data
31
+ };
32
+ this.sendParam(param, '获取三维路网坐标')
33
+ }
34
+
35
+ /**
36
+ * 请求三维绘制路网
37
+ * @param {PathList} data
38
+ */
39
+ static trackPath(data: PathList) {
40
+ const param: SendParam = {
41
+ cmd: "path",
42
+ action: "add",
43
+ pathId: "CameraTrack",
44
+ type: "BaseOnRoadNet",
45
+ data
46
+ };
47
+ this.sendParam(param, '请求三维绘制路径')
48
+ }
49
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * 视频融合方法
3
+ */
4
+ import { Action } from "./Action";
5
+
6
+ export class VideoFusionAction extends Action {
7
+ /**
8
+ * 视频融合初始化
9
+ * @param {string} token
10
+ * @param {string} ip
11
+ * @param {string} port
12
+ * @param {boolean} isHttps
13
+ */
14
+ static videoFusionInit(token: string, ip: string, port: string = '1998', isHttps: boolean = false) {
15
+ const param: SendParam = {
16
+ cmd: "videoFusion",
17
+ action: "init",
18
+ token,
19
+ ip,
20
+ port,
21
+ isHttps,
22
+ };
23
+ this.sendParam(param, '视频融合初始化')
24
+ }
25
+
26
+ /**
27
+ * 飞行到视频融合点位
28
+ * @param {string} id 点ID
29
+ * @param {number} fov 视场角
30
+ */
31
+ static videoFusionFlyTo(id: string, fov: number) {
32
+ const param: SendParam = {
33
+ cmd: "videoFusion",
34
+ action: "flyTo",
35
+ id,
36
+ fov,
37
+ };
38
+ this.sendParam(param)
39
+ }
40
+
41
+ /**
42
+ * 开启视频融合
43
+ * @param {IdList} ids 点列表
44
+ */
45
+ static videoFusionStart(ids: IdList) {
46
+ const param: SendParam = {
47
+ cmd: "videoFusion",
48
+ action: "start",
49
+ isLocation: false,
50
+ videoType: "Video",
51
+ backPlay: false,
52
+ ids,
53
+ };
54
+ this.sendParam(param, '开启视频融合')
55
+ }
56
+
57
+ /**
58
+ * 关闭视频融合
59
+ * @param {IdList} ids 点列表
60
+ */
61
+ static videoFusionStop(ids: IdList) {
62
+ const param: SendParam = {
63
+ cmd: "videoFusion",
64
+ action: "stop",
65
+ isLocation: false,
66
+ videoType: "Video",
67
+ backPlay: false,
68
+ ids,
69
+ };
70
+ this.sendParam(param, '关闭视频融合')
71
+ }
72
+
73
+ /**
74
+ * 刷新视频融合
75
+ * @param {string} token
76
+ */
77
+ static videoFusionRefresh(token: string) {
78
+ const param: SendParam = {
79
+ cmd: "videoFusion",
80
+ action: "refresh",
81
+ token,
82
+ };
83
+ this.sendParam(param)
84
+ }
85
+ }