acmi-parser 1.0.0

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.
@@ -0,0 +1,179 @@
1
+ import { Cartesian3 } from '@cesium/engine';
2
+ import { Dayjs } from 'dayjs';
3
+ import dayjs from 'dayjs';
4
+ import { Quaternion } from '@cesium/engine';
5
+
6
+ export declare class AcmiData {
7
+ isValid: boolean;
8
+ header: AcmiHeader;
9
+ globalProperties: GlobalProperties;
10
+ timeSpan: TimeSpan;
11
+ entities: Map<number, IEntityProps>;
12
+ frames: Frames;
13
+ private readonly _fixedFrame;
14
+ getFrame(time: Dayjs): Frame | undefined;
15
+ private _addFrame;
16
+ createSampledTrajectories(options?: ITrajectoryOptions): Trajectories;
17
+ }
18
+
19
+ export declare class AcmiHeader {
20
+ fileType: string;
21
+ fileVersion: string;
22
+ }
23
+
24
+ declare class AcmiParser {
25
+ private _decoder;
26
+ private _currentLine;
27
+ private _currentTimeStamp;
28
+ private _currentFrame;
29
+ private _destroyedIds;
30
+ private _filteredIds;
31
+ private _data;
32
+ private _filter;
33
+ private _refLat;
34
+ private _refLong;
35
+ private readonly _acmiVersions;
36
+ private readonly _acmiType;
37
+ private readonly _propertySeparator;
38
+ private readonly _headerPattern;
39
+ constructor(geoidModel: Uint8Array);
40
+ private _isValidVersion;
41
+ private _isValidType;
42
+ private _parseHeader;
43
+ private _parseContent;
44
+ private _parseLine;
45
+ private _isZipped;
46
+ private _unzip;
47
+ private _parseBuffer;
48
+ parse(data: Uint8Array, options?: AcmiParserOptions): Promise<AcmiData>;
49
+ }
50
+ export default AcmiParser;
51
+
52
+ export declare interface AcmiParserOptions {
53
+ filter?: string[];
54
+ controller?: AbortController;
55
+ }
56
+
57
+ export declare class EntityProps implements IEntityProps {
58
+ id: number;
59
+ timeSpan: TimeSpan;
60
+ name?: string;
61
+ types?: string[];
62
+ callsign?: string;
63
+ pilot?: string;
64
+ group?: string;
65
+ country?: string;
66
+ coalition?: string;
67
+ color?: string;
68
+ constructor(id: number);
69
+ }
70
+
71
+ export declare class Frame {
72
+ timeStamp: number;
73
+ scene: Scene;
74
+ constructor(timeStamp: number, scene?: Scene);
75
+ }
76
+
77
+ export declare type Frames = Array<Frame>;
78
+
79
+ export declare class GlobalProperties {
80
+ referenceTime: dayjs.Dayjs;
81
+ dataSource?: string;
82
+ dataRecorder?: string;
83
+ recordingTime?: Dayjs;
84
+ author?: string;
85
+ title?: string;
86
+ category?: string;
87
+ briefing?: string;
88
+ debriefing?: string;
89
+ comments?: string;
90
+ referenceLongitude?: number;
91
+ referenceLatitude?: number;
92
+ additionalProps?: Map<string, string>;
93
+ }
94
+
95
+ export declare interface IEntityProps {
96
+ id: number;
97
+ timeSpan: {
98
+ start: Dayjs;
99
+ end: Dayjs;
100
+ };
101
+ name?: string;
102
+ types?: string[];
103
+ callsign?: string;
104
+ pilot?: string;
105
+ group?: string;
106
+ country?: string;
107
+ coalition?: string;
108
+ color?: string;
109
+ }
110
+
111
+ export declare interface IStateVector {
112
+ position: Cartesian3;
113
+ orientation?: Quaternion;
114
+ }
115
+
116
+ export declare interface ITrajectoryOptions {
117
+ sampleRate?: number;
118
+ fixMslHeight?: boolean;
119
+ emulateOrientation?: boolean;
120
+ }
121
+
122
+ export declare interface ITrajectorySample {
123
+ time: Dayjs;
124
+ state: IStateVector;
125
+ }
126
+
127
+ export declare interface ITransform {
128
+ longitude: number;
129
+ latitude: number;
130
+ altitude: number;
131
+ roll?: number;
132
+ pitch?: number;
133
+ yaw?: number;
134
+ }
135
+
136
+ export declare type Scene = Map<number, ITransform>;
137
+
138
+ export declare class TimeSpan {
139
+ start: dayjs.Dayjs;
140
+ end: dayjs.Dayjs;
141
+ isValid(): boolean;
142
+ duration(): number;
143
+ }
144
+
145
+ export declare type Trajectories = Map<number, Trajectory>;
146
+
147
+ export declare class Trajectory {
148
+ samples: ITrajectorySample[];
149
+ private _mslHeightFixed;
150
+ private static _geoid?;
151
+ private readonly _fixedFrame;
152
+ static loadGeoidModel(model: Uint8Array): void;
153
+ hasOrientations(): boolean;
154
+ private _lastRoll;
155
+ private _simpleSmooth;
156
+ private _m0;
157
+ private _m1;
158
+ private _hpr0;
159
+ private _hpr1;
160
+ private _alpha;
161
+ private _computeRoll;
162
+ private _p0;
163
+ private _p1;
164
+ private _p2;
165
+ private _v0;
166
+ private _v1;
167
+ private _r0;
168
+ private _r1;
169
+ private _q0;
170
+ private _q1;
171
+ private _rollQuat;
172
+ private _defaultHpr;
173
+ private _computeOrientation;
174
+ emulateOrientations(dt: number, withRoll?: boolean): void;
175
+ private _cartographicScratch;
176
+ fixMslHeight(): void;
177
+ }
178
+
179
+ export { }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "acmi-parser",
3
+ "version": "1.0.0",
4
+ "description": "ACMI file format parser",
5
+ "author": "jfayot",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/jfayot/acmi-parser.git"
9
+ },
10
+ "keywords": [
11
+ "ACMI",
12
+ "Tacview",
13
+ "parser",
14
+ "cesium"
15
+ ],
16
+ "homepage": "https://github.com/jfayot/acmi-parser",
17
+ "bugs": "https://github.com/jfayot/acmi-parser/issues",
18
+ "license": "MIT",
19
+ "publishConfig": {
20
+ "registry": "https://registry.npmjs.org/"
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "type": "module",
26
+ "main": "./dist/acmi-parser.cjs",
27
+ "module": "./dist/acmi-parser.js",
28
+ "types": "./dist/types/acmi-parser.d.ts",
29
+ "exports": {
30
+ "types": "./dist/types/acmi-parser.d.ts",
31
+ "import": "./dist/acmi-parser.js",
32
+ "require": "./dist/acmi-parser.cjs"
33
+ },
34
+ "scripts": {
35
+ "build": "vite build",
36
+ "clean": "rimraf dist",
37
+ "clean:all": "pnpm clean && rimraf node_modules",
38
+ "release": "pnpm build && npm publish"
39
+ },
40
+ "commitlint": {
41
+ "extends": [
42
+ "@commitlint/config-conventional"
43
+ ]
44
+ },
45
+ "lint-staged": {
46
+ "*.ts": [
47
+ "eslint",
48
+ "prettier --write"
49
+ ],
50
+ "*.json": [
51
+ "prettier --write"
52
+ ]
53
+ },
54
+ "dependencies": {
55
+ "@math.gl/geoid": "^4.0.0",
56
+ "binary-search-bounds": "^2.0.5",
57
+ "@cesium/engine": "^6.1.1",
58
+ "dayjs": "^1.11.10",
59
+ "unzipit": "^1.4.3"
60
+ },
61
+ "devDependencies": {
62
+ "typescript": "^5.3.3",
63
+ "vite": "^5.0.11",
64
+ "vite-plugin-dts": "^3.7.0"
65
+ }
66
+ }