@fboes/aerofly-custom-missions 1.8.0 → 1.9.1
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/AGENTS.md +0 -0
- package/CHANGELOG.md +9 -1
- package/dist/dto/AeroflyMission.js +3 -3
- package/dist/dto/AeroflyMissionConditions.js +1 -1
- package/dist/dto/AeroflyMissionConditionsCloud.js +7 -0
- package/dist/dto-flight/AeroflySettingsFlight.js +57 -4
- package/dist/dto-flight/AeroflySettingsFlight.test.js +16 -0
- package/dist/index.js +1 -0
- package/dist/node/Convert.js +2 -0
- package/package.json +2 -2
- package/src/dto/AeroflyMission.ts +3 -3
- package/src/dto/AeroflyMissionConditions.ts +3 -1
- package/src/dto/AeroflyMissionConditionsCloud.ts +9 -0
- package/src/dto-flight/AeroflySettingsFlight.test.ts +22 -0
- package/src/dto-flight/AeroflySettingsFlight.ts +63 -10
- package/src/index.ts +1 -0
- package/src/node/Convert.ts +2 -0
- package/tsconfig.json +2 -2
- package/types/dto/AeroflyMissionConditions.d.ts.map +1 -1
- package/types/dto/AeroflyMissionConditionsCloud.d.ts +1 -0
- package/types/dto/AeroflyMissionConditionsCloud.d.ts.map +1 -1
- package/types/dto-flight/AeroflySettingsFlight.d.ts +16 -2
- package/types/dto-flight/AeroflySettingsFlight.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/node/Convert.d.ts.map +1 -1
- package/dist/dto-flight/AeroflyWaypoint.js +0 -85
- package/dist/node/AeroflyBasicTypes.js +0 -61
- package/dist/node/Convert copy.js +0 -67
- package/docs/custom_missions_user.schema.json +0 -269
- package/types/AeroflyMissionCheckpoint.d.ts +0 -140
- package/types/AeroflyMissionTargetPlane.d.ts +0 -40
- package/types/dto/AeroflyConfigFileSet.d.ts +0 -10
- package/types/dto/AeroflyConfigFileSet.d.ts.map +0 -1
- package/types/dto/AeroflyConfiguration.interface.d.ts +0 -4
- package/types/dto/AeroflyConfiguration.interface.d.ts.map +0 -1
- package/types/dto/basicTypes.d.ts +0 -1
- package/types/dto/index.test.d.ts +0 -2
- package/types/dto/index.test.d.ts.map +0 -1
- package/types/dto-flight/AeroflyWaypoint.d.ts +0 -68
- package/types/dto-flight/AeroflyWaypoint.d.ts.map +0 -1
- package/types/index.test.d.ts +0 -2
- package/types/index.test.d.ts.map +0 -1
- package/types/node/AeroflyBasicTypes.d.ts +0 -13
- package/types/node/AeroflyBasicTypes.d.ts.map +0 -1
- package/types/node/Convert copy.d.ts +0 -15
- package/types/node/Convert copy.d.ts.map +0 -1
package/AGENTS.md
CHANGED
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This changelog documents all notable changes to the Aerofly Custom Missions project. Each version entry includes a list of changes, with the most recent version at the top.
|
|
4
4
|
|
|
5
|
-
## [1.
|
|
5
|
+
## [1.9.1] - 2026-05-24
|
|
6
|
+
|
|
7
|
+
- Exporting `AeroflyNavRouteBase`
|
|
8
|
+
|
|
9
|
+
## [1.9.0] - 2026-04-20
|
|
10
|
+
|
|
11
|
+
- Added new convenience method to set aircraft systems from general aircraft configuration state. Please note that this will also be used as fallback on flight setting creation.
|
|
12
|
+
|
|
13
|
+
## [1.8.0] - 2026-04-19
|
|
6
14
|
|
|
7
15
|
- Added new flight configuration strings to `AeroflySettingsFlight`
|
|
8
16
|
|
|
@@ -188,8 +188,8 @@ export class AeroflyMission {
|
|
|
188
188
|
return new AeroflyMission(String(data.title ?? ""), {
|
|
189
189
|
tutorialName: String(data.tutorialName ?? ""),
|
|
190
190
|
description: String(data.description ?? ""),
|
|
191
|
-
localizedTexts: [], // TODO
|
|
192
|
-
tags: []
|
|
191
|
+
localizedTexts: [], // TODO: (Array.isArray(data.localizedTexts) ? data.localizedTexts : []).map((l) => AeroflyMissionCheckpoint.fromJSON(l))
|
|
192
|
+
tags: (Array.isArray(data.tags) ? data.tags : []).map((t) => String(t)),
|
|
193
193
|
isFeatured: data.isFeatured !== undefined ? Boolean(data.isFeatured) : null,
|
|
194
194
|
difficulty: data.difficulty !== undefined ? Number(data.difficulty) : null,
|
|
195
195
|
flightSetting: String(data.flightSetting ?? "taxi"),
|
|
@@ -220,7 +220,7 @@ export class AeroflyMission {
|
|
|
220
220
|
isScheduled: data.isScheduled !== undefined ? Boolean(data.isScheduled) : null,
|
|
221
221
|
finish: null, // TODO
|
|
222
222
|
conditions: AeroflyMissionConditions.fromJSON(data.conditions),
|
|
223
|
-
checkpoints: [], // TODO
|
|
223
|
+
checkpoints: [], // TODO: (Array.isArray(data.checkpoints) ? data.checkpoints : []).map((c) => AeroflyMissionCheckpoint.fromJSON(c))
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -140,7 +140,7 @@ export class AeroflyMissionConditions {
|
|
|
140
140
|
visibility: Number(data.visibility ?? 25_000),
|
|
141
141
|
visibility_sm: Number(data.visibility_sm ?? 0),
|
|
142
142
|
temperature: Number(data.temperature ?? 0),
|
|
143
|
-
clouds: []
|
|
143
|
+
clouds: (Array.isArray(data.checkpoints) ? data.checkpoints : []).map((c) => AeroflyMissionConditionsCloud.fromJSON(c)),
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -92,4 +92,11 @@ export class AeroflyMissionConditionsCloud {
|
|
|
92
92
|
.map((element) => element.toString(index))
|
|
93
93
|
.join("\n");
|
|
94
94
|
}
|
|
95
|
+
static fromJSON(json) {
|
|
96
|
+
if (typeof json !== "object" || json === null) {
|
|
97
|
+
throw new Error("Invalid mission condition cloud data");
|
|
98
|
+
}
|
|
99
|
+
const data = json;
|
|
100
|
+
return new this(Number(data.cover ?? 0), Number(data.base ?? 0));
|
|
101
|
+
}
|
|
95
102
|
}
|
|
@@ -7,11 +7,34 @@ export class AeroflySettingsFlight {
|
|
|
7
7
|
this.altitude_meter = altitude_meter;
|
|
8
8
|
this.heading_degree = heading_degree;
|
|
9
9
|
this.speed_kts = speed_kts;
|
|
10
|
-
this.gear =
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
this.gear = 1;
|
|
11
|
+
/**
|
|
12
|
+
* Throttle is supposed to be set to
|
|
13
|
+
* - 0 on "ColdAndDark", "BeforeStart", "Parking", "OnGround" and "Takeoff" configuration
|
|
14
|
+
* - 0.4 on "ShortFinal" and "Final" configuration
|
|
15
|
+
* - 0.6 on "Cruise" configuration
|
|
16
|
+
*/
|
|
17
|
+
this.throttle = 0;
|
|
18
|
+
/**
|
|
19
|
+
* Flaps is supposed to be set to 1 on "ShortFinal" and "Final" configurations
|
|
20
|
+
*/
|
|
21
|
+
this.flaps = 0;
|
|
22
|
+
this.configuration = "Parking";
|
|
23
|
+
this.onGround = true;
|
|
13
24
|
this.configuration = configuration;
|
|
14
|
-
this.
|
|
25
|
+
this.setConfiguration(configuration);
|
|
26
|
+
if (gear !== undefined) {
|
|
27
|
+
this.gear = gear;
|
|
28
|
+
}
|
|
29
|
+
if (throttle !== undefined) {
|
|
30
|
+
this.throttle = throttle;
|
|
31
|
+
}
|
|
32
|
+
if (flaps !== undefined) {
|
|
33
|
+
this.flaps = flaps;
|
|
34
|
+
}
|
|
35
|
+
if (onGround !== undefined) {
|
|
36
|
+
this.onGround = onGround;
|
|
37
|
+
}
|
|
15
38
|
this.airport = airport;
|
|
16
39
|
this.runway = runway;
|
|
17
40
|
}
|
|
@@ -25,6 +48,36 @@ export class AeroflySettingsFlight {
|
|
|
25
48
|
flight.orientation = orientation;
|
|
26
49
|
return flight;
|
|
27
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @param {AeroflySettingsFlightConfiguration} configuration which will set other parameters like `gear`, `flaps` and `throttle` consistently
|
|
53
|
+
*/
|
|
54
|
+
setConfiguration(configuration) {
|
|
55
|
+
this.configuration = configuration;
|
|
56
|
+
if (configuration === "Keep") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.onGround =
|
|
60
|
+
configuration === "ColdAndDark" ||
|
|
61
|
+
configuration === "BeforeStart" ||
|
|
62
|
+
configuration === "Parking" ||
|
|
63
|
+
configuration === "OnGround" ||
|
|
64
|
+
configuration === "Takeoff";
|
|
65
|
+
this.gear = configuration === "Cruise" ? 0 : 1;
|
|
66
|
+
this.flaps = configuration === "Final" || configuration === "ShortFinal" ? 1 : 0;
|
|
67
|
+
switch (configuration) {
|
|
68
|
+
case "ShortFinal":
|
|
69
|
+
case "Final":
|
|
70
|
+
this.throttle = 0.4;
|
|
71
|
+
break;
|
|
72
|
+
case "Cruise":
|
|
73
|
+
this.throttle = 0.6;
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
this.throttle = 0;
|
|
77
|
+
this.speed_kts = 0;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
28
81
|
/**
|
|
29
82
|
* @returns {AeroflyVector3Float} position vector to use in Aerofly FS4's `main.mcf`
|
|
30
83
|
*/
|
|
@@ -49,4 +49,20 @@ describe("AeroflySettingsFlight", () => {
|
|
|
49
49
|
console.log("Orientation:", flight.heading_degree); // should be 270, is 331
|
|
50
50
|
assertValidAeroflyStructure(flight.toString());
|
|
51
51
|
});
|
|
52
|
+
it("should create fallbacks for flight configurations", () => {
|
|
53
|
+
const flight = new AeroflySettingsFlight(-122.3088, 47.4502, 1000, 90, 150, {
|
|
54
|
+
configuration: "OnGround",
|
|
55
|
+
});
|
|
56
|
+
assert.strictEqual(flight.gear, 1, "Gear extended");
|
|
57
|
+
assert.strictEqual(flight.flaps, 0, "Flaps retracted");
|
|
58
|
+
assert.strictEqual(flight.onGround, true);
|
|
59
|
+
flight.setConfiguration("Cruise");
|
|
60
|
+
assert.strictEqual(flight.gear, 0, "Gear retracted");
|
|
61
|
+
assert.strictEqual(flight.flaps, 0, "Flaps retracted");
|
|
62
|
+
assert.strictEqual(flight.onGround, false);
|
|
63
|
+
flight.setConfiguration("ShortFinal");
|
|
64
|
+
assert.strictEqual(flight.gear, 1, "Gear extended");
|
|
65
|
+
assert.ok(flight.flaps > 0, "Flaps extended");
|
|
66
|
+
assert.strictEqual(flight.onGround, false);
|
|
67
|
+
});
|
|
52
68
|
});
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { AeroflyTimeUtc } from "./dto-flight/AeroflyTimeUtc.js";
|
|
|
14
14
|
export { AeroflySettingsWind } from "./dto-flight/AeroflySettingsWind.js";
|
|
15
15
|
export { AeroflySettingsCloud } from "./dto-flight/AeroflySettingsCloud.js";
|
|
16
16
|
export { AeroflyNavigationConfig } from "./dto-flight/AeroflyNavigationConfig.js";
|
|
17
|
+
export { AeroflyNavRouteBase } from "./dto-flight/AeroflyNavRouteBase.js";
|
|
17
18
|
export { AeroflyNavRouteDestination, AeroflyNavRouteOrigin } from "./dto-flight/AeroflyNavRouteAirports.js";
|
|
18
19
|
export { AeroflyNavRouteDepartureRunway, AeroflyNavRouteDestinationRunway, } from "./dto-flight/AeroflyNavRouteRunway.js";
|
|
19
20
|
export { AeroflyNavRouteApproach, AeroflyNavRouteArrival, AeroflyNavRouteDeparture, } from "./dto-flight/AeroflyNavRouteTransition.js";
|
package/dist/node/Convert.js
CHANGED
|
@@ -17,6 +17,7 @@ export class Convert {
|
|
|
17
17
|
return [x, y, z];
|
|
18
18
|
}
|
|
19
19
|
static convertVectorToLonLat(coordinates) {
|
|
20
|
+
// TODO: This implementation is not correct
|
|
20
21
|
const f = 1.0 / 298.257223563; // WGS84
|
|
21
22
|
const e2 = 2 * f - f * f;
|
|
22
23
|
//const lambda = VectorToAngle( coordinates[0], coordinates[1] );
|
|
@@ -50,6 +51,7 @@ export class Convert {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
static convertDegreeToMatrix(heading_degree) {
|
|
54
|
+
// TODO: This implementation is not correct
|
|
53
55
|
const theta = heading_degree * (Math.PI / 180); // heading in radians
|
|
54
56
|
const cosTheta = Math.cos(theta);
|
|
55
57
|
const sinTheta = Math.sin(theta);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fboes/aerofly-custom-missions",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Builder for Aerofly FS4 Custom Missions Files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^20.
|
|
26
|
+
"@types/node": "^20.19.39",
|
|
27
27
|
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
28
28
|
"@typescript-eslint/parser": "^7.0.1",
|
|
29
29
|
"eslint": "^8.56.0",
|
|
@@ -402,8 +402,8 @@ export class AeroflyMission {
|
|
|
402
402
|
return new AeroflyMission(String(data.title ?? ""), {
|
|
403
403
|
tutorialName: String(data.tutorialName ?? ""),
|
|
404
404
|
description: String(data.description ?? ""),
|
|
405
|
-
localizedTexts: [], // TODO
|
|
406
|
-
tags: []
|
|
405
|
+
localizedTexts: [], // TODO: (Array.isArray(data.localizedTexts) ? data.localizedTexts : []).map((l) => AeroflyMissionCheckpoint.fromJSON(l))
|
|
406
|
+
tags: (Array.isArray(data.tags) ? data.tags : []).map((t) => String(t)),
|
|
407
407
|
isFeatured: data.isFeatured !== undefined ? Boolean(data.isFeatured) : null,
|
|
408
408
|
difficulty: data.difficulty !== undefined ? Number(data.difficulty) : null,
|
|
409
409
|
flightSetting: String(data.flightSetting ?? "taxi") as AeroflyMissionSetting,
|
|
@@ -434,7 +434,7 @@ export class AeroflyMission {
|
|
|
434
434
|
isScheduled: data.isScheduled !== undefined ? Boolean(data.isScheduled) : null,
|
|
435
435
|
finish: null, // TODO
|
|
436
436
|
conditions: AeroflyMissionConditions.fromJSON(data.conditions),
|
|
437
|
-
checkpoints: [], // TODO
|
|
437
|
+
checkpoints: [], // TODO: (Array.isArray(data.checkpoints) ? data.checkpoints : []).map((c) => AeroflyMissionCheckpoint.fromJSON(c))
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
}
|
|
@@ -208,7 +208,9 @@ export class AeroflyMissionConditions {
|
|
|
208
208
|
visibility: Number(data.visibility ?? 25_000),
|
|
209
209
|
visibility_sm: Number(data.visibility_sm ?? 0),
|
|
210
210
|
temperature: Number(data.temperature ?? 0),
|
|
211
|
-
clouds: []
|
|
211
|
+
clouds: (Array.isArray(data.checkpoints) ? data.checkpoints : []).map((c) =>
|
|
212
|
+
AeroflyMissionConditionsCloud.fromJSON(c),
|
|
213
|
+
),
|
|
212
214
|
});
|
|
213
215
|
}
|
|
214
216
|
}
|
|
@@ -123,4 +123,13 @@ export class AeroflyMissionConditionsCloud {
|
|
|
123
123
|
.map((element) => element.toString(index))
|
|
124
124
|
.join("\n");
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
static fromJSON(json: unknown): AeroflyMissionConditionsCloud {
|
|
128
|
+
if (typeof json !== "object" || json === null) {
|
|
129
|
+
throw new Error("Invalid mission condition cloud data");
|
|
130
|
+
}
|
|
131
|
+
const data = json as Record<string, unknown>;
|
|
132
|
+
|
|
133
|
+
return new this(Number(data.cover ?? 0), Number(data.base ?? 0));
|
|
134
|
+
}
|
|
126
135
|
}
|
|
@@ -67,4 +67,26 @@ describe("AeroflySettingsFlight", () => {
|
|
|
67
67
|
|
|
68
68
|
assertValidAeroflyStructure(flight.toString());
|
|
69
69
|
});
|
|
70
|
+
|
|
71
|
+
it("should create fallbacks for flight configurations", () => {
|
|
72
|
+
const flight = new AeroflySettingsFlight(-122.3088, 47.4502, 1000, 90, 150, {
|
|
73
|
+
configuration: "OnGround",
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
assert.strictEqual(flight.gear, 1, "Gear extended");
|
|
77
|
+
assert.strictEqual(flight.flaps, 0, "Flaps retracted");
|
|
78
|
+
assert.strictEqual(flight.onGround, true);
|
|
79
|
+
|
|
80
|
+
flight.setConfiguration("Cruise");
|
|
81
|
+
|
|
82
|
+
assert.strictEqual(flight.gear, 0, "Gear retracted");
|
|
83
|
+
assert.strictEqual(flight.flaps, 0, "Flaps retracted");
|
|
84
|
+
assert.strictEqual(flight.onGround, false);
|
|
85
|
+
|
|
86
|
+
flight.setConfiguration("ShortFinal");
|
|
87
|
+
|
|
88
|
+
assert.strictEqual(flight.gear, 1, "Gear extended");
|
|
89
|
+
assert.ok(flight.flaps > 0, "Flaps extended");
|
|
90
|
+
assert.strictEqual(flight.onGround, false);
|
|
91
|
+
});
|
|
70
92
|
});
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
import { AeroflyVector3Float, AeroflyMatrix3Float, Convert } from "../node/Convert.js";
|
|
2
2
|
import { AeroflyConfigurationNode } from "../node/AeroflyConfigurationNode.js";
|
|
3
3
|
|
|
4
|
+
export type AeroflySettingsFlightConfiguration =
|
|
5
|
+
| "Keep"
|
|
6
|
+
| "ColdAndDark"
|
|
7
|
+
| "BeforeStart" // TODO
|
|
8
|
+
| "Parking"
|
|
9
|
+
| "OnGround"
|
|
10
|
+
| "Takeoff"
|
|
11
|
+
| "Cruise"
|
|
12
|
+
| "ShortFinal"
|
|
13
|
+
| "Final";
|
|
14
|
+
|
|
4
15
|
export class AeroflySettingsFlight {
|
|
5
|
-
gear: number;
|
|
16
|
+
gear: number = 1;
|
|
6
17
|
|
|
7
18
|
/**
|
|
8
19
|
* Throttle is supposed to be set to
|
|
9
|
-
* - 0 on "ColdAndDark", "OnGround" and "Takeoff" configuration
|
|
20
|
+
* - 0 on "ColdAndDark", "BeforeStart", "Parking", "OnGround" and "Takeoff" configuration
|
|
10
21
|
* - 0.4 on "ShortFinal" and "Final" configuration
|
|
11
22
|
* - 0.6 on "Cruise" configuration
|
|
12
23
|
*/
|
|
13
|
-
throttle: number;
|
|
24
|
+
throttle: number = 0;
|
|
14
25
|
|
|
15
26
|
/**
|
|
16
27
|
* Flaps is supposed to be set to 1 on "ShortFinal" and "Final" configurations
|
|
17
28
|
*/
|
|
18
|
-
flaps: number;
|
|
19
|
-
configuration:
|
|
20
|
-
onGround: boolean;
|
|
29
|
+
flaps: number = 0;
|
|
30
|
+
configuration: AeroflySettingsFlightConfiguration = "Parking";
|
|
31
|
+
onGround: boolean = true;
|
|
21
32
|
|
|
22
33
|
/**
|
|
23
34
|
* Airport is supposed to be set on any configurations but "Cruise" and "Keep"
|
|
@@ -45,11 +56,21 @@ export class AeroflySettingsFlight {
|
|
|
45
56
|
runway = "",
|
|
46
57
|
}: Partial<AeroflySettingsFlight> = {},
|
|
47
58
|
) {
|
|
48
|
-
this.gear = gear;
|
|
49
|
-
this.throttle = throttle;
|
|
50
|
-
this.flaps = flaps;
|
|
51
59
|
this.configuration = configuration;
|
|
52
|
-
this.
|
|
60
|
+
this.setConfiguration(configuration);
|
|
61
|
+
|
|
62
|
+
if (gear !== undefined) {
|
|
63
|
+
this.gear = gear;
|
|
64
|
+
}
|
|
65
|
+
if (throttle !== undefined) {
|
|
66
|
+
this.throttle = throttle;
|
|
67
|
+
}
|
|
68
|
+
if (flaps !== undefined) {
|
|
69
|
+
this.flaps = flaps;
|
|
70
|
+
}
|
|
71
|
+
if (onGround !== undefined) {
|
|
72
|
+
this.onGround = onGround;
|
|
73
|
+
}
|
|
53
74
|
this.airport = airport;
|
|
54
75
|
this.runway = runway;
|
|
55
76
|
}
|
|
@@ -85,6 +106,38 @@ export class AeroflySettingsFlight {
|
|
|
85
106
|
return flight;
|
|
86
107
|
}
|
|
87
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @param {AeroflySettingsFlightConfiguration} configuration which will set other parameters like `gear`, `flaps` and `throttle` consistently
|
|
111
|
+
*/
|
|
112
|
+
setConfiguration(configuration: AeroflySettingsFlightConfiguration) {
|
|
113
|
+
this.configuration = configuration;
|
|
114
|
+
if (configuration === "Keep") {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.onGround =
|
|
119
|
+
configuration === "ColdAndDark" ||
|
|
120
|
+
configuration === "BeforeStart" ||
|
|
121
|
+
configuration === "Parking" ||
|
|
122
|
+
configuration === "OnGround" ||
|
|
123
|
+
configuration === "Takeoff";
|
|
124
|
+
this.gear = configuration === "Cruise" ? 0 : 1;
|
|
125
|
+
this.flaps = configuration === "Final" || configuration === "ShortFinal" ? 1 : 0;
|
|
126
|
+
switch (configuration) {
|
|
127
|
+
case "ShortFinal":
|
|
128
|
+
case "Final":
|
|
129
|
+
this.throttle = 0.4;
|
|
130
|
+
break;
|
|
131
|
+
case "Cruise":
|
|
132
|
+
this.throttle = 0.6;
|
|
133
|
+
break;
|
|
134
|
+
default:
|
|
135
|
+
this.throttle = 0;
|
|
136
|
+
this.speed_kts = 0;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
88
141
|
/**
|
|
89
142
|
* @returns {AeroflyVector3Float} position vector to use in Aerofly FS4's `main.mcf`
|
|
90
143
|
*/
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { AeroflySettingsWind } from "./dto-flight/AeroflySettingsWind.js";
|
|
|
17
17
|
export { AeroflySettingsCloud } from "./dto-flight/AeroflySettingsCloud.js";
|
|
18
18
|
export { AeroflyNavigationConfig } from "./dto-flight/AeroflyNavigationConfig.js";
|
|
19
19
|
|
|
20
|
+
export { AeroflyNavRouteBase } from "./dto-flight/AeroflyNavRouteBase.js";
|
|
20
21
|
export { AeroflyNavRouteDestination, AeroflyNavRouteOrigin } from "./dto-flight/AeroflyNavRouteAirports.js";
|
|
21
22
|
export {
|
|
22
23
|
AeroflyNavRouteDepartureRunway,
|
package/src/node/Convert.ts
CHANGED
|
@@ -30,6 +30,7 @@ export class Convert {
|
|
|
30
30
|
latitude: number;
|
|
31
31
|
altitude_meter: number;
|
|
32
32
|
} {
|
|
33
|
+
// TODO: This implementation is not correct
|
|
33
34
|
const f = 1.0 / 298.257223563; // WGS84
|
|
34
35
|
const e2 = 2 * f - f * f;
|
|
35
36
|
|
|
@@ -64,6 +65,7 @@ export class Convert {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
static convertDegreeToMatrix(heading_degree: number): AeroflyMatrix3Float {
|
|
68
|
+
// TODO: This implementation is not correct
|
|
67
69
|
const theta = heading_degree * (Math.PI / 180); // heading in radians
|
|
68
70
|
|
|
69
71
|
const cosTheta = Math.cos(theta);
|
package/tsconfig.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
"target": "es2021",
|
|
5
|
-
"module": "
|
|
5
|
+
"module": "nodenext",
|
|
6
6
|
"rootDir": "./src",
|
|
7
7
|
"outDir": "./dist",
|
|
8
|
-
"moduleResolution": "
|
|
8
|
+
"moduleResolution": "nodenext",
|
|
9
9
|
"strict": true,
|
|
10
10
|
"esModuleInterop": true,
|
|
11
11
|
"sourceMap": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AeroflyMissionConditions.d.ts","sourceRoot":"","sources":["../../src/dto/AeroflyMissionConditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,wBAAwB;IACjC;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,4BAA4B,CAAC;IAEnC;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,6BAA6B,EAAE,CAAM;IAE7C;;;;;;;;;;;OAWG;gBACS,EACR,IAAiB,EACjB,IAIC,EACD,kBAAsB,EACtB,eAAmB,EACnB,UAAmB,EACnB,aAAiB,EACjB,WAAe,EACf,MAAW,GACd,GAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG;QACnC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;KACnB;IAgBN;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAMhC;IAED;;OAEG;IACH,IAAI,aAAa,CAAC,aAAa,EAAE,MAAM,EAEtC;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;;OAGG;IACH,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,EAGlC;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,gBAAgB,IAAI,wBAAwB,EAAE;IAI9C;;OAEG;IACH,UAAU,IAAI,wBAAwB;IAsBtC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,wBAAwB;
|
|
1
|
+
{"version":3,"file":"AeroflyMissionConditions.d.ts","sourceRoot":"","sources":["../../src/dto/AeroflyMissionConditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,wBAAwB;IACjC;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,4BAA4B,CAAC;IAEnC;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,6BAA6B,EAAE,CAAM;IAE7C;;;;;;;;;;;OAWG;gBACS,EACR,IAAiB,EACjB,IAIC,EACD,kBAAsB,EACtB,eAAmB,EACnB,UAAmB,EACnB,aAAiB,EACjB,WAAe,EACf,MAAW,GACd,GAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG;QACnC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;KACnB;IAgBN;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAMhC;IAED;;OAEG;IACH,IAAI,aAAa,CAAC,aAAa,EAAE,MAAM,EAEtC;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;;OAGG;IACH,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,EAGlC;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,gBAAgB,IAAI,wBAAwB,EAAE;IAI9C;;OAEG;IACH,UAAU,IAAI,wBAAwB;IAsBtC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,wBAAwB;CA4B3D"}
|
|
@@ -53,5 +53,6 @@ export declare class AeroflyMissionConditionsCloud {
|
|
|
53
53
|
* @returns {string} to use in Aerofly FS4's `custom_missions_user.tmc`
|
|
54
54
|
*/
|
|
55
55
|
toString(index?: number): string;
|
|
56
|
+
static fromJSON(json: unknown): AeroflyMissionConditionsCloud;
|
|
56
57
|
}
|
|
57
58
|
//# sourceMappingURL=AeroflyMissionConditionsCloud.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AeroflyMissionConditionsCloud.d.ts","sourceRoot":"","sources":["../../src/dto/AeroflyMissionConditionsCloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAmC,MAAM,qCAAqC,CAAC;AAGhH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3F;;;;;;;GAOG;AACH,qBAAa,6BAA6B;IACtC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;gBACS,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKvC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,6BAA6B;IAIpF;;OAEG;IACH,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,EAE9B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,sCAAsC,CAWvD;IAED;;;OAGG;IACH,WAAW,CAAC,KAAK,GAAE,MAAU,GAAG,wBAAwB,EAAE;IAqC1D;;;OAGG;IACH,QAAQ,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"AeroflyMissionConditionsCloud.d.ts","sourceRoot":"","sources":["../../src/dto/AeroflyMissionConditionsCloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAmC,MAAM,qCAAqC,CAAC;AAGhH;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3F;;;;;;;GAOG;AACH,qBAAa,6BAA6B;IACtC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;gBACS,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKvC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,6BAA6B;IAIpF;;OAEG;IACH,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,EAE9B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,sCAAsC,CAWvD;IAED;;;OAGG;IACH,WAAW,CAAC,KAAK,GAAE,MAAU,GAAG,wBAAwB,EAAE;IAqC1D;;;OAGG;IACH,QAAQ,CAAC,KAAK,GAAE,MAAU,GAAG,MAAM;IAMnC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,6BAA6B;CAQhE"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { AeroflyVector3Float, AeroflyMatrix3Float } from "../node/Convert.js";
|
|
2
2
|
import { AeroflyConfigurationNode } from "../node/AeroflyConfigurationNode.js";
|
|
3
|
+
export type AeroflySettingsFlightConfiguration =
|
|
4
|
+
| "Keep"
|
|
5
|
+
| "ColdAndDark"
|
|
6
|
+
| "BeforeStart"
|
|
7
|
+
| "Parking"
|
|
8
|
+
| "OnGround"
|
|
9
|
+
| "Takeoff"
|
|
10
|
+
| "Cruise"
|
|
11
|
+
| "ShortFinal"
|
|
12
|
+
| "Final";
|
|
3
13
|
export declare class AeroflySettingsFlight {
|
|
4
14
|
longitude: number;
|
|
5
15
|
latitude: number;
|
|
@@ -9,7 +19,7 @@ export declare class AeroflySettingsFlight {
|
|
|
9
19
|
gear: number;
|
|
10
20
|
/**
|
|
11
21
|
* Throttle is supposed to be set to
|
|
12
|
-
* - 0 on "ColdAndDark", "OnGround" and "Takeoff" configuration
|
|
22
|
+
* - 0 on "ColdAndDark", "BeforeStart", "Parking", "OnGround" and "Takeoff" configuration
|
|
13
23
|
* - 0.4 on "ShortFinal" and "Final" configuration
|
|
14
24
|
* - 0.6 on "Cruise" configuration
|
|
15
25
|
*/
|
|
@@ -18,7 +28,7 @@ export declare class AeroflySettingsFlight {
|
|
|
18
28
|
* Flaps is supposed to be set to 1 on "ShortFinal" and "Final" configurations
|
|
19
29
|
*/
|
|
20
30
|
flaps: number;
|
|
21
|
-
configuration:
|
|
31
|
+
configuration: AeroflySettingsFlightConfiguration;
|
|
22
32
|
onGround: boolean;
|
|
23
33
|
/**
|
|
24
34
|
* Airport is supposed to be set on any configurations but "Cruise" and "Keep"
|
|
@@ -50,6 +60,10 @@ export declare class AeroflySettingsFlight {
|
|
|
50
60
|
orientation: AeroflyMatrix3Float,
|
|
51
61
|
additionalAttributes?: Partial<AeroflySettingsFlight>,
|
|
52
62
|
): AeroflySettingsFlight;
|
|
63
|
+
/**
|
|
64
|
+
* @param {AeroflySettingsFlightConfiguration} configuration which will set other parameters like `gear`, `flaps` and `throttle` consistently
|
|
65
|
+
*/
|
|
66
|
+
setConfiguration(configuration: AeroflySettingsFlightConfiguration): void;
|
|
53
67
|
/**
|
|
54
68
|
* @returns {AeroflyVector3Float} position vector to use in Aerofly FS4's `main.mcf`
|
|
55
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AeroflySettingsFlight.d.ts","sourceRoot":"","sources":["../../src/dto-flight/AeroflySettingsFlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAW,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,qBAAa,qBAAqB;IA6BnB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,cAAc,EAAE,MAAM;IACtB,cAAc,EAAE,MAAM;IACtB,SAAS,EAAE,MAAM;IAhC5B,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"AeroflySettingsFlight.d.ts","sourceRoot":"","sources":["../../src/dto-flight/AeroflySettingsFlight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAW,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,MAAM,MAAM,kCAAkC,GACxC,MAAM,GACN,aAAa,GACb,aAAa,GACb,SAAS,GACT,UAAU,GACV,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,OAAO,CAAC;AAEd,qBAAa,qBAAqB;IA6BnB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,cAAc,EAAE,MAAM;IACtB,cAAc,EAAE,MAAM;IACtB,SAAS,EAAE,MAAM;IAhC5B,IAAI,EAAE,MAAM,CAAK;IAEjB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAK;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAK;IAClB,aAAa,EAAE,kCAAkC,CAAa;IAC9D,QAAQ,EAAE,OAAO,CAAQ;IAEzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;gBAGJ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EACtB,SAAS,GAAE,MAAU,EAC5B,EACI,IAAQ,EACR,QAAY,EACZ,KAAS,EACT,aAA0B,EAC1B,QAAe,EACf,OAAY,EACZ,MAAW,GACd,GAAE,OAAO,CAAC,qBAAqB,CAAM;IAqB1C,MAAM,CAAC,YAAY,CACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EACtB,SAAS,GAAE,MAAU,EACrB,oBAAoB,GAAE,OAAO,CAAC,qBAAqB,CAAM,GAC1D,qBAAqB;IAWxB,MAAM,CAAC,iBAAiB,CACpB,QAAQ,EAAE,mBAAmB,EAC7B,QAAQ,EAAE,mBAAmB,EAC7B,WAAW,EAAE,mBAAmB,EAChC,oBAAoB,GAAE,OAAO,CAAC,qBAAqB,CAAM,GAC1D,qBAAqB;IAQxB;;OAEG;IACH,gBAAgB,CAAC,aAAa,EAAE,kCAAkC;IA6BlE;;OAEG;IACH,IAAI,QAAQ,IAAI,mBAAmB,CAElC;IAED,IAAI,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,EAKzC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,mBAAmB,CAIlC;IAED,IAAI,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,EAGzC;IAED,IAAI,WAAW,IAAI,mBAAmB,CAErC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,mBAAmB,EAE/C;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,EAElC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAE5B;IAED,UAAU,IAAI,wBAAwB;IAwBtC,MAAM;IAQN;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGrB"}
|
package/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { AeroflyTimeUtc } from "./dto-flight/AeroflyTimeUtc.js";
|
|
|
13
13
|
export { AeroflySettingsWind } from "./dto-flight/AeroflySettingsWind.js";
|
|
14
14
|
export { AeroflySettingsCloud } from "./dto-flight/AeroflySettingsCloud.js";
|
|
15
15
|
export { AeroflyNavigationConfig } from "./dto-flight/AeroflyNavigationConfig.js";
|
|
16
|
+
export { AeroflyNavRouteBase } from "./dto-flight/AeroflyNavRouteBase.js";
|
|
16
17
|
export { AeroflyNavRouteDestination, AeroflyNavRouteOrigin } from "./dto-flight/AeroflyNavRouteAirports.js";
|
|
17
18
|
export {
|
|
18
19
|
AeroflyNavRouteDepartureRunway,
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAI/E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAC5G,OAAO,EACH,8BAA8B,EAC9B,gCAAgC,GACnC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GAC3B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAI/E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAC5G,OAAO,EACH,8BAA8B,EAC9B,gCAAgC,GACnC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,GAC3B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Convert.d.ts","sourceRoot":"","sources":["../../src/node/Convert.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3G,qBAAa,OAAO;IAChB,MAAM,CAAC,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,mBAAmB;IAsB9G,MAAM,CAAC,qBAAqB,CAAC,WAAW,EAAE,mBAAmB,GAAG;QAC5D,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;KAC1B;
|
|
1
|
+
{"version":3,"file":"Convert.d.ts","sourceRoot":"","sources":["../../src/node/Convert.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3G,qBAAa,OAAO;IAChB,MAAM,CAAC,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,mBAAmB;IAsB9G,MAAM,CAAC,qBAAqB,CAAC,WAAW,EAAE,mBAAmB,GAAG;QAC5D,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;KAC1B;IAmCD,MAAM,CAAC,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,mBAAmB;IAUzE,MAAM,CAAC,qBAAqB,CAAC,WAAW,EAAE,mBAAmB,GAAG,MAAM;IAQtE,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIhD,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI/C,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM;IAI/B,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM;CAGlC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { AeroflyBasicTypes } from "../node/AeroflyBasicTypes.js";
|
|
2
|
-
import { AeroflyConfigurationNode, AeroflyConfigurationNodeComment } from "../node/AeroflyConfigurationNode.js";
|
|
3
|
-
export class AeroflyWaypoint {
|
|
4
|
-
/**
|
|
5
|
-
* @param {AeroflyWaypointType} type like "origin", "departure_runway", "departure", "waypoint", "arrival", "approach", "destination_runway" or "destination"
|
|
6
|
-
* @param {string} identifier alphanumeric identifier, e.g. "SEA", "PDX", "RWY16L", "FIX1"
|
|
7
|
-
* @param {number} longitude WGS84
|
|
8
|
-
* @param {number} latitude WGS84
|
|
9
|
-
* @param {object} [options] additional options for the waypoint
|
|
10
|
-
* @param {boolean} [options.flyOver] if true, the waypoint is meant to be flown over, otherwise it can be used as a fly-by waypoint
|
|
11
|
-
* @param {?number} [options.navaidFrequency] if the waypoint is a navaid, its frequency in Hz
|
|
12
|
-
* @param {number} [options.altitude] in meter
|
|
13
|
-
* @param {?number} [options.altitude_ft] altitude in feet, will override altitude in meter if provided
|
|
14
|
-
* @param {?number} [options.elevation] elevation of the waypoint in meter, only used for origin, departure and destination waypoints
|
|
15
|
-
* @param {?number} [options.elevation_ft] elevation of the waypoint in feet, will override elevation in meter if provided
|
|
16
|
-
* @param {?bigint} [options.uid] unique identifier for the waypoint, will be generated automatically if not provided
|
|
17
|
-
*/
|
|
18
|
-
constructor(type, identifier, longitude, latitude, { flyOver: flyOver = false, navaidFrequency = null, altitude = null, altitude_ft = null, elevation = null, elevation_ft = null, uid = null, } = {}) {
|
|
19
|
-
this.type = type;
|
|
20
|
-
this.identifier = identifier;
|
|
21
|
-
this.longitude = longitude;
|
|
22
|
-
this.latitude = latitude;
|
|
23
|
-
this.navaidFrequency = navaidFrequency;
|
|
24
|
-
this.elevation = elevation;
|
|
25
|
-
this.uid = uid;
|
|
26
|
-
this.flyOver = flyOver;
|
|
27
|
-
this.altitude = altitude;
|
|
28
|
-
if (altitude_ft !== null) {
|
|
29
|
-
this.altitude_ft = altitude_ft;
|
|
30
|
-
}
|
|
31
|
-
if (elevation_ft !== null) {
|
|
32
|
-
this.elevation_ft = elevation_ft;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
static createFromCartesian(type, identifier, position, options = {}) {
|
|
36
|
-
const { longitude, latitude, altitude_meter } = AeroflyBasicTypes.convertVectorToLonLat(position);
|
|
37
|
-
return new AeroflyWaypoint(type, identifier, longitude, latitude, { ...options, altitude: altitude_meter });
|
|
38
|
-
}
|
|
39
|
-
get altitude_ft() {
|
|
40
|
-
return this.altitude !== null ? this.altitude * 3.28084 : null;
|
|
41
|
-
}
|
|
42
|
-
set altitude_ft(altitude_ft) {
|
|
43
|
-
this.altitude = altitude_ft !== null ? altitude_ft * 0.3048 : null;
|
|
44
|
-
}
|
|
45
|
-
get elevation_ft() {
|
|
46
|
-
return this.elevation !== null ? this.elevation * 3.28084 : null;
|
|
47
|
-
}
|
|
48
|
-
set elevation_ft(elevation_ft) {
|
|
49
|
-
this.elevation = elevation_ft !== null ? elevation_ft * 0.3048 : null;
|
|
50
|
-
}
|
|
51
|
-
get position() {
|
|
52
|
-
return AeroflyBasicTypes.convertLonLatToVector(this.longitude, this.latitude, this.altitude || 0);
|
|
53
|
-
}
|
|
54
|
-
getElement(index = 0) {
|
|
55
|
-
const element = new AeroflyConfigurationNode("tmnav_route_" + this.type, this.identifier, String(index))
|
|
56
|
-
.appendChild("string8u", "Identifier", this.identifier)
|
|
57
|
-
.appendChild("vector3_float64", "Position", this.position, `Lon ${this.longitude.toPrecision(6)}, Lat ${this.latitude.toPrecision(6)}, ${Math.ceil(this.altitude_ft ?? 0)} ft`)
|
|
58
|
-
.append(this.uid
|
|
59
|
-
? new AeroflyConfigurationNode("uint64", "Uid", this.uid)
|
|
60
|
-
: new AeroflyConfigurationNodeComment("uint64", "Uid", ""));
|
|
61
|
-
if (this.type === "origin" ||
|
|
62
|
-
this.type === "departure_runway" ||
|
|
63
|
-
this.type === "departure" ||
|
|
64
|
-
this.type === "destination_runway" ||
|
|
65
|
-
this.type === "destination") {
|
|
66
|
-
element.append(this.elevation !== null
|
|
67
|
-
? new AeroflyConfigurationNode("float64", "Elevation", this.elevation, `${Math.ceil(this.elevation_ft ?? 0)} ft`)
|
|
68
|
-
: new AeroflyConfigurationNodeComment("float64", "Elevation", ""));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
element.appendChild("bool", "FlyOver", this.flyOver);
|
|
72
|
-
element.appendChild("vector2_float64", "Altitude", this.altitude !== null && this.altitude > 0 ? [this.altitude, this.altitude] : [-1001, 100001], `${this.altitude_ft !== null && this.altitude_ft > 0 ? Math.ceil(this.altitude_ft) + " ft" : "unrestricted"}`);
|
|
73
|
-
}
|
|
74
|
-
if (this.navaidFrequency) {
|
|
75
|
-
element.appendChild("float64", "NavaidFrequency", this.navaidFrequency);
|
|
76
|
-
}
|
|
77
|
-
return element;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @returns {string} to use in Aerofly FS4's `main.mcf`
|
|
81
|
-
*/
|
|
82
|
-
toString() {
|
|
83
|
-
return this.getElement().toString();
|
|
84
|
-
}
|
|
85
|
-
}
|