model-action 1.0.7 → 1.0.9
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/modules/Action.d.ts +26 -0
- package/dist/modules/Poi.d.ts +55 -0
- package/dist/modules/Poi.js +17 -0
- package/dist/modules/Track.d.ts +33 -0
- package/dist/modules/Track.js +8 -0
- package/dist/modules/VideoFusion.d.ts +52 -0
- package/dist/modules/VideoFusion.js +13 -0
- package/package.json +9 -4
- package/src/modules/Action.ts +19 -1
- package/src/modules/Poi.ts +49 -6
- package/src/modules/Track.ts +23 -5
- package/src/modules/VideoFusion.ts +33 -5
- package/dist/types/modules/Action.d.ts +0 -13
- package/dist/types/modules/Poi.d.ts +0 -27
- package/dist/types/modules/Track.d.ts +0 -19
- package/dist/types/modules/VideoFusion.d.ts +0 -27
- package/dist/types/types.d.ts +0 -68
- package/src/types.d.ts +0 -68
- /package/dist/{types/index.d.ts → index.d.ts} +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
export type RequiredSome<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
2
|
+
export interface SendParam {
|
3
|
+
cmd: string;
|
4
|
+
action: string;
|
5
|
+
}
|
6
|
+
interface IdItem {
|
7
|
+
id: string;
|
8
|
+
}
|
9
|
+
export type IdList = IdItem[];
|
10
|
+
export type LocationItem = `X=${number},Y=${number},Z=${number}`;
|
11
|
+
export type LocationList = Array<{
|
12
|
+
location: LocationItem;
|
13
|
+
}>;
|
14
|
+
export declare class Action {
|
15
|
+
/**
|
16
|
+
* 视角初始化
|
17
|
+
*/
|
18
|
+
static cameraInit(): void;
|
19
|
+
/**
|
20
|
+
* 发送到model
|
21
|
+
* @param {SendParam} param 发送的参数
|
22
|
+
* @param {string} msg 打印的信息
|
23
|
+
*/
|
24
|
+
static sendParam<T extends SendParam>(param: T, msg?: string): void;
|
25
|
+
}
|
26
|
+
export {};
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/**
|
2
|
+
* POI点方法
|
3
|
+
*/
|
4
|
+
import { Action, LocationItem, SendParam } from "./Action";
|
5
|
+
type PoiActionType = 'show' | 'hide' | 'add' | 'delete' | 'update' | 'getInfo';
|
6
|
+
type PoiType = {
|
7
|
+
action: PoiActionType;
|
8
|
+
id?: string;
|
9
|
+
type?: string;
|
10
|
+
typeChild?: string;
|
11
|
+
text?: string;
|
12
|
+
location?: LocationItem;
|
13
|
+
place?: string;
|
14
|
+
description?: string;
|
15
|
+
linkId?: string;
|
16
|
+
floorNum?: string;
|
17
|
+
lowestFloor?: string;
|
18
|
+
} & SendParam;
|
19
|
+
export declare class PoiAction extends Action {
|
20
|
+
/**
|
21
|
+
* 添加poi
|
22
|
+
* @param {*} type 相机type
|
23
|
+
* @param {*} location poi点位置
|
24
|
+
* @param {*} text POI标题
|
25
|
+
* @param {*} place POI所在位置
|
26
|
+
* @param {*} description POI描述
|
27
|
+
* @param {*} linkId POI关联的设备ID
|
28
|
+
*/
|
29
|
+
static poiAdd(type: PoiType['type'], location: LocationItem, text?: PoiType['text'], place?: PoiType['place'], description?: PoiType['description'], linkId?: PoiType['linkId']): void;
|
30
|
+
/**
|
31
|
+
* 删除poi
|
32
|
+
* @param {*} id 点ID
|
33
|
+
*/
|
34
|
+
static poiDel(id: string): void;
|
35
|
+
/**
|
36
|
+
* 显示poi
|
37
|
+
* @param {*} id POI的ID
|
38
|
+
* @param {*} type 相机type
|
39
|
+
* @param {*} place POI所在位置
|
40
|
+
*/
|
41
|
+
static poiShow(id: PoiType['id'], type: PoiType['type'], place: PoiType['place']): void;
|
42
|
+
/**
|
43
|
+
* 隐藏poi
|
44
|
+
* @param {*} id POI的ID
|
45
|
+
* @param {*} type 相机type
|
46
|
+
* @param {*} place POI所在位置
|
47
|
+
*/
|
48
|
+
static poiHide(id: PoiType['id'], type: PoiType['type'], place: PoiType['place']): void;
|
49
|
+
/**
|
50
|
+
* 获取指定POI
|
51
|
+
* @param {*} type 相机type
|
52
|
+
*/
|
53
|
+
static poiGetInfo(type?: PoiType['type']): void;
|
54
|
+
}
|
55
|
+
export {};
|
package/dist/modules/Poi.js
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* POI点方法
|
3
|
+
*/
|
1
4
|
import { Action } from "./Action";
|
2
5
|
export class PoiAction extends Action {
|
3
6
|
/**
|
4
7
|
* 添加poi
|
8
|
+
* @param {*} type 相机type
|
9
|
+
* @param {*} location poi点位置
|
10
|
+
* @param {*} text POI标题
|
11
|
+
* @param {*} place POI所在位置
|
12
|
+
* @param {*} description POI描述
|
13
|
+
* @param {*} linkId POI关联的设备ID
|
5
14
|
*/
|
6
15
|
static poiAdd(type = 'Camera', location, text = '', place = '', description = '', linkId = '') {
|
7
16
|
const param = {
|
@@ -18,6 +27,7 @@ export class PoiAction extends Action {
|
|
18
27
|
}
|
19
28
|
/**
|
20
29
|
* 删除poi
|
30
|
+
* @param {*} id 点ID
|
21
31
|
*/
|
22
32
|
static poiDel(id) {
|
23
33
|
const param = {
|
@@ -29,6 +39,9 @@ export class PoiAction extends Action {
|
|
29
39
|
}
|
30
40
|
/**
|
31
41
|
* 显示poi
|
42
|
+
* @param {*} id POI的ID
|
43
|
+
* @param {*} type 相机type
|
44
|
+
* @param {*} place POI所在位置
|
32
45
|
*/
|
33
46
|
static poiShow(id, type = "Camera", place) {
|
34
47
|
const param = {
|
@@ -44,6 +57,9 @@ export class PoiAction extends Action {
|
|
44
57
|
}
|
45
58
|
/**
|
46
59
|
* 隐藏poi
|
60
|
+
* @param {*} id POI的ID
|
61
|
+
* @param {*} type 相机type
|
62
|
+
* @param {*} place POI所在位置
|
47
63
|
*/
|
48
64
|
static poiHide(id, type = "Camera", place) {
|
49
65
|
const param = {
|
@@ -59,6 +75,7 @@ export class PoiAction extends Action {
|
|
59
75
|
}
|
60
76
|
/**
|
61
77
|
* 获取指定POI
|
78
|
+
* @param {*} type 相机type
|
62
79
|
*/
|
63
80
|
static poiGetInfo(type = 'Camera') {
|
64
81
|
const param = {
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/**
|
2
|
+
* 轨迹方法
|
3
|
+
*/
|
4
|
+
import { Action, IdList, LocationList, SendParam } from "./Action";
|
5
|
+
type TrackActionType = 'getRoadNet' | 'remove' | 'add';
|
6
|
+
type TrackType = {
|
7
|
+
action: TrackActionType;
|
8
|
+
pathId?: string;
|
9
|
+
rnId?: string;
|
10
|
+
roadNet?: string;
|
11
|
+
type?: string;
|
12
|
+
data?: LocationList | IdList;
|
13
|
+
} & SendParam;
|
14
|
+
export declare class TrackAction extends Action {
|
15
|
+
/**
|
16
|
+
* 清除轨迹
|
17
|
+
* @param {*} pathId 自定义轨迹ID
|
18
|
+
*/
|
19
|
+
static trackRemove(pathId?: TrackType['pathId']): void;
|
20
|
+
/**
|
21
|
+
* 获取三维路网坐标
|
22
|
+
* @param {*} data
|
23
|
+
* @param {*} rnId 路网ID
|
24
|
+
*/
|
25
|
+
static trackGetRoadNet(data: TrackType['data'], rnId?: TrackType['rnId']): void;
|
26
|
+
/**
|
27
|
+
* 请求三维绘制路网
|
28
|
+
* @param {*} data
|
29
|
+
* @param {*} pathId 自定义轨迹ID
|
30
|
+
*/
|
31
|
+
static trackPath(data: TrackType['data'], pathId?: TrackType['pathId']): void;
|
32
|
+
}
|
33
|
+
export {};
|
package/dist/modules/Track.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* 轨迹方法
|
3
|
+
*/
|
1
4
|
import { Action } from "./Action";
|
2
5
|
export class TrackAction extends Action {
|
3
6
|
/**
|
4
7
|
* 清除轨迹
|
8
|
+
* @param {*} pathId 自定义轨迹ID
|
5
9
|
*/
|
6
10
|
static trackRemove(pathId = "CameraTrack") {
|
7
11
|
const param = {
|
@@ -13,6 +17,8 @@ export class TrackAction extends Action {
|
|
13
17
|
}
|
14
18
|
/**
|
15
19
|
* 获取三维路网坐标
|
20
|
+
* @param {*} data
|
21
|
+
* @param {*} rnId 路网ID
|
16
22
|
*/
|
17
23
|
static trackGetRoadNet(data, rnId = 'RN-1') {
|
18
24
|
const param = {
|
@@ -25,6 +31,8 @@ export class TrackAction extends Action {
|
|
25
31
|
}
|
26
32
|
/**
|
27
33
|
* 请求三维绘制路网
|
34
|
+
* @param {*} data
|
35
|
+
* @param {*} pathId 自定义轨迹ID
|
28
36
|
*/
|
29
37
|
static trackPath(data, pathId = "CameraTrack") {
|
30
38
|
const param = {
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/**
|
2
|
+
* 视频融合方法
|
3
|
+
*/
|
4
|
+
import { Action, IdList, SendParam } from "./Action";
|
5
|
+
type VideoFusionActionType = 'init' | 'flyTo' | 'start' | 'stop' | 'pause' | 'resume' | 'refresh';
|
6
|
+
type VideoFusionType = {
|
7
|
+
action: VideoFusionActionType;
|
8
|
+
token?: string;
|
9
|
+
ip?: string;
|
10
|
+
port?: string;
|
11
|
+
isHttps?: boolean;
|
12
|
+
id?: string;
|
13
|
+
fov?: number;
|
14
|
+
backPlay?: boolean;
|
15
|
+
ids?: IdList;
|
16
|
+
isLocation?: boolean;
|
17
|
+
videoType?: 'Video' | 'Record';
|
18
|
+
recordType?: 'Cloud' | 'Device';
|
19
|
+
} & SendParam;
|
20
|
+
export declare class VideoFusionAction extends Action {
|
21
|
+
/**
|
22
|
+
* 视频融合初始化
|
23
|
+
* @param {*} token TOKEN
|
24
|
+
* @param {*} ip IP
|
25
|
+
* @param {*} port 端口
|
26
|
+
* @param {*} token TOKEN
|
27
|
+
* @param {*} isHttps 是否https
|
28
|
+
*/
|
29
|
+
static videoFusionInit(token: VideoFusionType['token'], ip: VideoFusionType['ip'], port?: VideoFusionType['port'], isHttps?: VideoFusionType['isHttps']): void;
|
30
|
+
/**
|
31
|
+
* 飞行到视频融合点位
|
32
|
+
* @param {*} id 点ID
|
33
|
+
* @param {*} fov 视场角
|
34
|
+
*/
|
35
|
+
static videoFusionFlyTo(id: VideoFusionType['id'], fov: VideoFusionType['fov']): void;
|
36
|
+
/**
|
37
|
+
* 开启视频融合
|
38
|
+
* @param {*} ids id列表
|
39
|
+
*/
|
40
|
+
static videoFusionStart(ids: VideoFusionType['ids']): void;
|
41
|
+
/**
|
42
|
+
* 关闭视频融合
|
43
|
+
* @param {*} ids id列表
|
44
|
+
*/
|
45
|
+
static videoFusionStop(ids: VideoFusionType['ids']): void;
|
46
|
+
/**
|
47
|
+
* 刷新视频融合
|
48
|
+
* @param {*} token TOKEN
|
49
|
+
*/
|
50
|
+
static videoFusionRefresh(token: VideoFusionType['token']): void;
|
51
|
+
}
|
52
|
+
export {};
|
@@ -1,7 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* 视频融合方法
|
3
|
+
*/
|
1
4
|
import { Action } from "./Action";
|
2
5
|
export class VideoFusionAction extends Action {
|
3
6
|
/**
|
4
7
|
* 视频融合初始化
|
8
|
+
* @param {*} token TOKEN
|
9
|
+
* @param {*} ip IP
|
10
|
+
* @param {*} port 端口
|
11
|
+
* @param {*} token TOKEN
|
12
|
+
* @param {*} isHttps 是否https
|
5
13
|
*/
|
6
14
|
static videoFusionInit(token, ip, port = '1998', isHttps = false) {
|
7
15
|
const param = {
|
@@ -16,6 +24,8 @@ export class VideoFusionAction extends Action {
|
|
16
24
|
}
|
17
25
|
/**
|
18
26
|
* 飞行到视频融合点位
|
27
|
+
* @param {*} id 点ID
|
28
|
+
* @param {*} fov 视场角
|
19
29
|
*/
|
20
30
|
static videoFusionFlyTo(id, fov) {
|
21
31
|
const param = {
|
@@ -28,6 +38,7 @@ export class VideoFusionAction extends Action {
|
|
28
38
|
}
|
29
39
|
/**
|
30
40
|
* 开启视频融合
|
41
|
+
* @param {*} ids id列表
|
31
42
|
*/
|
32
43
|
static videoFusionStart(ids) {
|
33
44
|
const param = {
|
@@ -42,6 +53,7 @@ export class VideoFusionAction extends Action {
|
|
42
53
|
}
|
43
54
|
/**
|
44
55
|
* 关闭视频融合
|
56
|
+
* @param {*} ids id列表
|
45
57
|
*/
|
46
58
|
static videoFusionStop(ids) {
|
47
59
|
const param = {
|
@@ -56,6 +68,7 @@ export class VideoFusionAction extends Action {
|
|
56
68
|
}
|
57
69
|
/**
|
58
70
|
* 刷新视频融合
|
71
|
+
* @param {*} token TOKEN
|
59
72
|
*/
|
60
73
|
static videoFusionRefresh(token) {
|
61
74
|
const param = {
|
package/package.json
CHANGED
@@ -1,18 +1,23 @@
|
|
1
1
|
{
|
2
2
|
"name": "model-action",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.9",
|
4
4
|
"description": "与三维交互api",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
7
7
|
"scripts": {
|
8
|
-
"
|
8
|
+
"dev": "tsc --watch",
|
9
|
+
"build": "tsc",
|
9
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
10
11
|
},
|
11
|
-
"files": [
|
12
|
+
"files": [
|
13
|
+
"dist",
|
14
|
+
"src",
|
15
|
+
"index.d.js"
|
16
|
+
],
|
12
17
|
"author": "andm31",
|
13
18
|
"license": "ISC",
|
14
19
|
"devDependencies": {
|
15
20
|
"typescript": "^5.8.3"
|
16
21
|
},
|
17
22
|
"type": "module"
|
18
|
-
}
|
23
|
+
}
|
package/src/modules/Action.ts
CHANGED
@@ -1,4 +1,22 @@
|
|
1
|
-
|
1
|
+
export type RequiredSome<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
2
|
+
|
3
|
+
export interface SendParam {
|
4
|
+
cmd: string,
|
5
|
+
action: string,
|
6
|
+
}
|
7
|
+
|
8
|
+
|
9
|
+
interface IdItem {
|
10
|
+
id: string;
|
11
|
+
}
|
12
|
+
|
13
|
+
export type IdList = IdItem[];
|
14
|
+
|
15
|
+
export type LocationItem = `X=${number},Y=${number},Z=${number}`
|
16
|
+
|
17
|
+
export type LocationList = Array<{
|
18
|
+
location: LocationItem
|
19
|
+
}>
|
2
20
|
|
3
21
|
export class Action {
|
4
22
|
/**
|
package/src/modules/Poi.ts
CHANGED
@@ -1,14 +1,36 @@
|
|
1
|
+
|
1
2
|
/**
|
2
3
|
* POI点方法
|
3
4
|
*/
|
4
|
-
import {
|
5
|
-
|
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
|
6
22
|
|
7
23
|
export class PoiAction extends Action {
|
8
24
|
/**
|
9
25
|
* 添加poi
|
26
|
+
* @param {*} type 相机type
|
27
|
+
* @param {*} location poi点位置
|
28
|
+
* @param {*} text POI标题
|
29
|
+
* @param {*} place POI所在位置
|
30
|
+
* @param {*} description POI描述
|
31
|
+
* @param {*} linkId POI关联的设备ID
|
10
32
|
*/
|
11
|
-
static poiAdd(type = 'Camera', location: LocationItem, text = '', place = '', description = '', linkId = '') {
|
33
|
+
static poiAdd(type: PoiType['type'] = 'Camera', location: LocationItem, text: PoiType['text'] = '', place: PoiType['place'] = '', description: PoiType['description'] = '', linkId: PoiType['linkId'] = '') {
|
12
34
|
const param: RequiredSome<PoiType, 'action' | 'type' | 'location'> = {
|
13
35
|
cmd: "POI",
|
14
36
|
action: "add",
|
@@ -24,6 +46,7 @@ export class PoiAction extends Action {
|
|
24
46
|
|
25
47
|
/**
|
26
48
|
* 删除poi
|
49
|
+
* @param {*} id 点ID
|
27
50
|
*/
|
28
51
|
static poiDel(id: string) {
|
29
52
|
const param: PoiType = {
|
@@ -36,8 +59,11 @@ export class PoiAction extends Action {
|
|
36
59
|
|
37
60
|
/**
|
38
61
|
* 显示poi
|
62
|
+
* @param {*} id POI的ID
|
63
|
+
* @param {*} type 相机type
|
64
|
+
* @param {*} place POI所在位置
|
39
65
|
*/
|
40
|
-
static poiShow(id:
|
66
|
+
static poiShow(id: PoiType['id'], type: PoiType['type'], place: PoiType['place']) {
|
41
67
|
const param: PoiType = {
|
42
68
|
cmd: "POI",
|
43
69
|
action: "show",
|
@@ -53,8 +79,11 @@ export class PoiAction extends Action {
|
|
53
79
|
|
54
80
|
/**
|
55
81
|
* 隐藏poi
|
82
|
+
* @param {*} id POI的ID
|
83
|
+
* @param {*} type 相机type
|
84
|
+
* @param {*} place POI所在位置
|
56
85
|
*/
|
57
|
-
static poiHide(id:
|
86
|
+
static poiHide(id: PoiType['id'], type: PoiType['type'], place: PoiType['place']) {
|
58
87
|
const param: PoiType = {
|
59
88
|
cmd: "POI",
|
60
89
|
action: "hide",
|
@@ -68,10 +97,24 @@ export class PoiAction extends Action {
|
|
68
97
|
this.sendParam(param, '隐藏POI')
|
69
98
|
}
|
70
99
|
|
100
|
+
/**
|
101
|
+
* 把所有的POI恢复到Normal状态
|
102
|
+
* @param {*} state normal一般状态 alarm 告警状态
|
103
|
+
*/
|
104
|
+
static poiNormal(state: 'normal' | 'alarm') {
|
105
|
+
const param: PoiType = {
|
106
|
+
cmd: "POI",
|
107
|
+
action: "status",
|
108
|
+
state
|
109
|
+
};
|
110
|
+
this.sendParam(param, `恢复至${state}状态`)
|
111
|
+
}
|
112
|
+
|
71
113
|
/**
|
72
114
|
* 获取指定POI
|
115
|
+
* @param {*} type 相机type
|
73
116
|
*/
|
74
|
-
static poiGetInfo(type = 'Camera') {
|
117
|
+
static poiGetInfo(type: PoiType['type'] = 'Camera') {
|
75
118
|
const param: PoiType = {
|
76
119
|
cmd: "POI",
|
77
120
|
action: "getInfo",
|
package/src/modules/Track.ts
CHANGED
@@ -1,14 +1,28 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
1
4
|
/**
|
2
5
|
* 轨迹方法
|
3
6
|
*/
|
4
|
-
import {
|
5
|
-
|
7
|
+
import { Action, IdList, LocationList, SendParam } from "./Action";
|
8
|
+
|
9
|
+
|
10
|
+
type TrackActionType = 'getRoadNet' | 'remove' | 'add'
|
11
|
+
type TrackType = {
|
12
|
+
action: TrackActionType,
|
13
|
+
pathId?: string, //自定义轨迹ID
|
14
|
+
rnId?: string, //路网ID
|
15
|
+
roadNet?: string, //路网信息
|
16
|
+
type?: string,
|
17
|
+
data?: LocationList | IdList
|
18
|
+
} & SendParam
|
6
19
|
|
7
20
|
export class TrackAction extends Action {
|
8
21
|
/**
|
9
22
|
* 清除轨迹
|
23
|
+
* @param {*} pathId 自定义轨迹ID
|
10
24
|
*/
|
11
|
-
static trackRemove(pathId = "CameraTrack") {
|
25
|
+
static trackRemove(pathId: TrackType['pathId'] = "CameraTrack") {
|
12
26
|
const param: TrackType = {
|
13
27
|
cmd: "path",
|
14
28
|
action: "remove",
|
@@ -19,8 +33,10 @@ export class TrackAction extends Action {
|
|
19
33
|
|
20
34
|
/**
|
21
35
|
* 获取三维路网坐标
|
36
|
+
* @param {*} data
|
37
|
+
* @param {*} rnId 路网ID
|
22
38
|
*/
|
23
|
-
static trackGetRoadNet(data: TrackType['data'], rnId = 'RN-1') {
|
39
|
+
static trackGetRoadNet(data: TrackType['data'], rnId: TrackType['rnId'] = 'RN-1') {
|
24
40
|
const param: TrackType = {
|
25
41
|
cmd: "path",
|
26
42
|
action: "getRoadNet",
|
@@ -32,8 +48,10 @@ export class TrackAction extends Action {
|
|
32
48
|
|
33
49
|
/**
|
34
50
|
* 请求三维绘制路网
|
51
|
+
* @param {*} data
|
52
|
+
* @param {*} pathId 自定义轨迹ID
|
35
53
|
*/
|
36
|
-
static trackPath(data: TrackType['data'], pathId = "CameraTrack") {
|
54
|
+
static trackPath(data: TrackType['data'], pathId: TrackType['pathId'] = "CameraTrack") {
|
37
55
|
const param: TrackType = {
|
38
56
|
cmd: "path",
|
39
57
|
action: "add",
|
@@ -1,14 +1,37 @@
|
|
1
|
+
|
2
|
+
|
1
3
|
/**
|
2
4
|
* 视频融合方法
|
3
5
|
*/
|
4
|
-
import {
|
5
|
-
|
6
|
+
import { Action, IdList, LocationList, SendParam } from "./Action";
|
7
|
+
|
8
|
+
type VideoFusionActionType = 'init' | 'flyTo' | 'start' | 'stop' | 'pause' | 'resume' | 'refresh'
|
9
|
+
type VideoFusionType = {
|
10
|
+
action: VideoFusionActionType,
|
11
|
+
token?: string,
|
12
|
+
ip?: string,
|
13
|
+
port?: string,
|
14
|
+
isHttps?: boolean,
|
15
|
+
id?: string,
|
16
|
+
fov?: number, //视场角
|
17
|
+
backPlay?: boolean,
|
18
|
+
ids?: IdList,
|
19
|
+
isLocation?: boolean, //是否定位到第一个点,true=定位到第一个,false=不定位
|
20
|
+
videoType?: 'Video' | 'Record', //Video:实时流,Record:录像,默认实时流 Video
|
21
|
+
recordType?: 'Cloud' | 'Device',// Cloud:中心录像,Device:设备录像,默认中心录像 Cloud,videoType为 Record 时有效
|
22
|
+
} & SendParam
|
23
|
+
|
6
24
|
|
7
25
|
export class VideoFusionAction extends Action {
|
8
26
|
/**
|
9
27
|
* 视频融合初始化
|
28
|
+
* @param {*} token TOKEN
|
29
|
+
* @param {*} ip IP
|
30
|
+
* @param {*} port 端口
|
31
|
+
* @param {*} token TOKEN
|
32
|
+
* @param {*} isHttps 是否https
|
10
33
|
*/
|
11
|
-
static videoFusionInit(token:
|
34
|
+
static videoFusionInit(token: VideoFusionType['token'], ip: VideoFusionType['ip'], port: VideoFusionType['port'] = '1998', isHttps: VideoFusionType['isHttps'] = false) {
|
12
35
|
const param: VideoFusionType = {
|
13
36
|
cmd: "videoFusion",
|
14
37
|
action: "init",
|
@@ -22,8 +45,10 @@ export class VideoFusionAction extends Action {
|
|
22
45
|
|
23
46
|
/**
|
24
47
|
* 飞行到视频融合点位
|
48
|
+
* @param {*} id 点ID
|
49
|
+
* @param {*} fov 视场角
|
25
50
|
*/
|
26
|
-
static videoFusionFlyTo(id:
|
51
|
+
static videoFusionFlyTo(id: VideoFusionType['id'], fov: VideoFusionType['fov']) {
|
27
52
|
const param: VideoFusionType = {
|
28
53
|
cmd: "videoFusion",
|
29
54
|
action: "flyTo",
|
@@ -35,6 +60,7 @@ export class VideoFusionAction extends Action {
|
|
35
60
|
|
36
61
|
/**
|
37
62
|
* 开启视频融合
|
63
|
+
* @param {*} ids id列表
|
38
64
|
*/
|
39
65
|
static videoFusionStart(ids: VideoFusionType['ids']) {
|
40
66
|
const param: VideoFusionType = {
|
@@ -50,6 +76,7 @@ export class VideoFusionAction extends Action {
|
|
50
76
|
|
51
77
|
/**
|
52
78
|
* 关闭视频融合
|
79
|
+
* @param {*} ids id列表
|
53
80
|
*/
|
54
81
|
static videoFusionStop(ids: VideoFusionType['ids']) {
|
55
82
|
const param: VideoFusionType = {
|
@@ -65,8 +92,9 @@ export class VideoFusionAction extends Action {
|
|
65
92
|
|
66
93
|
/**
|
67
94
|
* 刷新视频融合
|
95
|
+
* @param {*} token TOKEN
|
68
96
|
*/
|
69
|
-
static videoFusionRefresh(token:
|
97
|
+
static videoFusionRefresh(token: VideoFusionType['token']) {
|
70
98
|
const param: VideoFusionType = {
|
71
99
|
cmd: "videoFusion",
|
72
100
|
action: "refresh",
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { SendParam } from "../types";
|
2
|
-
export declare class Action {
|
3
|
-
/**
|
4
|
-
* 视角初始化
|
5
|
-
*/
|
6
|
-
static cameraInit(): void;
|
7
|
-
/**
|
8
|
-
* 发送到model
|
9
|
-
* @param {SendParam} param 发送的参数
|
10
|
-
* @param {string} msg 打印的信息
|
11
|
-
*/
|
12
|
-
static sendParam<T extends SendParam>(param: T, msg?: string): void;
|
13
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* POI点方法
|
3
|
-
*/
|
4
|
-
import { LocationItem } from "../types";
|
5
|
-
import { Action } from "./Action";
|
6
|
-
export declare class PoiAction extends Action {
|
7
|
-
/**
|
8
|
-
* 添加poi
|
9
|
-
*/
|
10
|
-
static poiAdd(type: string | undefined, location: LocationItem, text?: string, place?: string, description?: string, linkId?: string): void;
|
11
|
-
/**
|
12
|
-
* 删除poi
|
13
|
-
*/
|
14
|
-
static poiDel(id: string): void;
|
15
|
-
/**
|
16
|
-
* 显示poi
|
17
|
-
*/
|
18
|
-
static poiShow(id: string, type: string | undefined, place: string): void;
|
19
|
-
/**
|
20
|
-
* 隐藏poi
|
21
|
-
*/
|
22
|
-
static poiHide(id: string, type: string | undefined, place: string): void;
|
23
|
-
/**
|
24
|
-
* 获取指定POI
|
25
|
-
*/
|
26
|
-
static poiGetInfo(type?: string): void;
|
27
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 轨迹方法
|
3
|
-
*/
|
4
|
-
import { TrackType } from "../types";
|
5
|
-
import { Action } from "./Action";
|
6
|
-
export declare class TrackAction extends Action {
|
7
|
-
/**
|
8
|
-
* 清除轨迹
|
9
|
-
*/
|
10
|
-
static trackRemove(pathId?: string): void;
|
11
|
-
/**
|
12
|
-
* 获取三维路网坐标
|
13
|
-
*/
|
14
|
-
static trackGetRoadNet(data: TrackType['data'], rnId?: string): void;
|
15
|
-
/**
|
16
|
-
* 请求三维绘制路网
|
17
|
-
*/
|
18
|
-
static trackPath(data: TrackType['data'], pathId?: string): void;
|
19
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 视频融合方法
|
3
|
-
*/
|
4
|
-
import { VideoFusionType } from "../types";
|
5
|
-
import { Action } from "./Action";
|
6
|
-
export declare class VideoFusionAction extends Action {
|
7
|
-
/**
|
8
|
-
* 视频融合初始化
|
9
|
-
*/
|
10
|
-
static videoFusionInit(token: string, ip: string, port?: string, isHttps?: boolean): void;
|
11
|
-
/**
|
12
|
-
* 飞行到视频融合点位
|
13
|
-
*/
|
14
|
-
static videoFusionFlyTo(id: string, fov: number): void;
|
15
|
-
/**
|
16
|
-
* 开启视频融合
|
17
|
-
*/
|
18
|
-
static videoFusionStart(ids: VideoFusionType['ids']): void;
|
19
|
-
/**
|
20
|
-
* 关闭视频融合
|
21
|
-
*/
|
22
|
-
static videoFusionStop(ids: VideoFusionType['ids']): void;
|
23
|
-
/**
|
24
|
-
* 刷新视频融合
|
25
|
-
*/
|
26
|
-
static videoFusionRefresh(token: string): void;
|
27
|
-
}
|
package/dist/types/types.d.ts
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
|
2
|
-
export type RequiredSome<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
3
|
-
|
4
|
-
export interface SendParam {
|
5
|
-
cmd: string,
|
6
|
-
action: string,
|
7
|
-
}
|
8
|
-
|
9
|
-
export interface IdItem {
|
10
|
-
id: string;
|
11
|
-
}
|
12
|
-
|
13
|
-
export type IdList = IdItem[];
|
14
|
-
|
15
|
-
|
16
|
-
export type PathList = Array<{
|
17
|
-
location: string
|
18
|
-
}>
|
19
|
-
|
20
|
-
|
21
|
-
export type PoiAction = 'show' | 'hide' | 'add' | 'delete' | 'update' | 'getInfo'
|
22
|
-
export type LocationItem = `X=${number},Y=${number},Z=${number}`
|
23
|
-
export type PoiType = {
|
24
|
-
action: PoiAction, //方法
|
25
|
-
id?: string, //POI点UE中的ID
|
26
|
-
type?: string, //POI类型
|
27
|
-
typeChild?: string, //POI子类型
|
28
|
-
text?: string, //POI标题
|
29
|
-
location?: LocationItem, //POI在场景中的坐标格式
|
30
|
-
place?: string, //POI所在位置
|
31
|
-
description?: string, //POI描述
|
32
|
-
linkId?: string, //POI关联设备ID
|
33
|
-
floorNum?: string, //总楼层
|
34
|
-
lowestFloor?: string //最低楼层
|
35
|
-
} & SendParam
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
export type LocationList = Array<{
|
40
|
-
location: LocationItem
|
41
|
-
}>
|
42
|
-
export type TrackAction = 'getRoadNet' | 'remove' | 'add'
|
43
|
-
export type TrackType = {
|
44
|
-
action: TrackAction,
|
45
|
-
pathId?: string, //自定义轨迹ID
|
46
|
-
rnId?: string, //路网ID
|
47
|
-
roadNet?: string, //路网信息
|
48
|
-
type?: string,
|
49
|
-
data?: LocationList | IdList
|
50
|
-
} & SendParam
|
51
|
-
|
52
|
-
|
53
|
-
export type VideoFusionAction = 'init' | 'flyTo' | 'start' | 'stop' | 'pause' | 'resume' | 'refresh'
|
54
|
-
export type VideoFusionType = {
|
55
|
-
action: VideoFusionAction,
|
56
|
-
token?: string,
|
57
|
-
ip?: string,
|
58
|
-
port?: string,
|
59
|
-
isHttps?: boolean,
|
60
|
-
id?: string,
|
61
|
-
fov?: number, //视场角
|
62
|
-
backPlay?:boolean,
|
63
|
-
ids?: IdList,
|
64
|
-
isLocation?: boolean, //是否定位到第一个点,true=定位到第一个,false=不定位
|
65
|
-
videoType?: 'Video' | 'Record', //Video:实时流,Record:录像,默认实时流 Video
|
66
|
-
recordType?: 'Cloud' | 'Device',// Cloud:中心录像,Device:设备录像,默认中心录像 Cloud,videoType为 Record 时有效
|
67
|
-
|
68
|
-
} & SendParam
|
package/src/types.d.ts
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
|
2
|
-
export type RequiredSome<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
3
|
-
|
4
|
-
export interface SendParam {
|
5
|
-
cmd: string,
|
6
|
-
action: string,
|
7
|
-
}
|
8
|
-
|
9
|
-
export interface IdItem {
|
10
|
-
id: string;
|
11
|
-
}
|
12
|
-
|
13
|
-
export type IdList = IdItem[];
|
14
|
-
|
15
|
-
|
16
|
-
export type PathList = Array<{
|
17
|
-
location: string
|
18
|
-
}>
|
19
|
-
|
20
|
-
|
21
|
-
export type PoiAction = 'show' | 'hide' | 'add' | 'delete' | 'update' | 'getInfo'
|
22
|
-
export type LocationItem = `X=${number},Y=${number},Z=${number}`
|
23
|
-
export type PoiType = {
|
24
|
-
action: PoiAction, //方法
|
25
|
-
id?: string, //POI点UE中的ID
|
26
|
-
type?: string, //POI类型
|
27
|
-
typeChild?: string, //POI子类型
|
28
|
-
text?: string, //POI标题
|
29
|
-
location?: LocationItem, //POI在场景中的坐标格式
|
30
|
-
place?: string, //POI所在位置
|
31
|
-
description?: string, //POI描述
|
32
|
-
linkId?: string, //POI关联设备ID
|
33
|
-
floorNum?: string, //总楼层
|
34
|
-
lowestFloor?: string //最低楼层
|
35
|
-
} & SendParam
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
export type LocationList = Array<{
|
40
|
-
location: LocationItem
|
41
|
-
}>
|
42
|
-
export type TrackAction = 'getRoadNet' | 'remove' | 'add'
|
43
|
-
export type TrackType = {
|
44
|
-
action: TrackAction,
|
45
|
-
pathId?: string, //自定义轨迹ID
|
46
|
-
rnId?: string, //路网ID
|
47
|
-
roadNet?: string, //路网信息
|
48
|
-
type?: string,
|
49
|
-
data?: LocationList | IdList
|
50
|
-
} & SendParam
|
51
|
-
|
52
|
-
|
53
|
-
export type VideoFusionAction = 'init' | 'flyTo' | 'start' | 'stop' | 'pause' | 'resume' | 'refresh'
|
54
|
-
export type VideoFusionType = {
|
55
|
-
action: VideoFusionAction,
|
56
|
-
token?: string,
|
57
|
-
ip?: string,
|
58
|
-
port?: string,
|
59
|
-
isHttps?: boolean,
|
60
|
-
id?: string,
|
61
|
-
fov?: number, //视场角
|
62
|
-
backPlay?:boolean,
|
63
|
-
ids?: IdList,
|
64
|
-
isLocation?: boolean, //是否定位到第一个点,true=定位到第一个,false=不定位
|
65
|
-
videoType?: 'Video' | 'Record', //Video:实时流,Record:录像,默认实时流 Video
|
66
|
-
recordType?: 'Cloud' | 'Device',// Cloud:中心录像,Device:设备录像,默认中心录像 Cloud,videoType为 Record 时有效
|
67
|
-
|
68
|
-
} & SendParam
|
File without changes
|