Refactor overfly fix
This commit is contained in:
Kilian Hofmann 2025-07-15 11:02:25 +02:00
parent 8b04be187e
commit 50077746f0
64 changed files with 1093 additions and 1205 deletions

3
.vscode/launch.json vendored
View File

@ -14,7 +14,8 @@
"${workspaceFolder}\\browser\\src\\parser\\node.ts"
],
"cwd": "${workspaceFolder}\\browser\\",
"outFiles": ["${workspaceFolder}/**/*.js"]
"outFiles": ["${workspaceFolder}/**/*.js"],
"console": "integratedTerminal"
}
]
}

16
TODO.md
View File

@ -0,0 +1,16 @@
How to use:
- Select Airport by ICAO
- List runways for selected airport
- List SID for selected runway
- List transitions for selected SID
- Parse SID and transition
- Display
- List STAR for selected runway
- List transitions for selected STAR
- Parse STAR and transition
- Display
- List IAPs for selected runway
- List transitions for selected IAP
- Parse IAP and transition
- Display

9
browser/.prettierrc.cjs Normal file
View File

@ -0,0 +1,9 @@
module.exports = {
printWidth: 120,
tabWidth: 2,
semi: true,
trailingComma: "es5",
singleQuote: true,
arrowParens: "always",
plugins: ["prettier-plugin-organize-imports"],
};

View File

@ -1,18 +1,18 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import { globalIgnores } from "eslint/config";
import js from '@eslint/js';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import { globalIgnores } from 'eslint/config';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default tseslint.config([
globalIgnores(["dist"]),
globalIgnores(['dist']),
{
files: ["**/*.{ts,tsx}"],
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs["recommended-latest"],
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
@ -20,7 +20,7 @@ export default tseslint.config([
globals: globals.browser,
},
rules: {
"@typescript-eslint/no-shadow": "error",
'@typescript-eslint/no-shadow': 'error',
},
},
]);

View File

@ -33,6 +33,8 @@
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.3.0",
"object-hash": "^3.0.0",
"prettier": "^3.6.2",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "~5.8.3",
"typescript-eslint": "^8.36.0",
"vite": "^7.0.4"

675
browser/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,13 @@
import { MapContainer, GeoJSON, TileLayer } from "react-leaflet";
import Parser from "./parser/parser";
import { createRef, useEffect, useState } from "react";
import hash from "object-hash";
import Leaflet from "leaflet";
import "leaflet-svg-shape-markers";
import L from "leaflet";
import { default as L, default as Leaflet } from 'leaflet';
import 'leaflet-svg-shape-markers';
import hash from 'object-hash';
import { createRef, useEffect, useState } from 'react';
import { GeoJSON, MapContainer, TileLayer } from 'react-leaflet';
import Parser from './parser/parser';
const parser = await Parser.instance();
const terminals = [
10394, 10395, 10475, 10480, 10482, 10485, 10653, 10654, 10657, 10659, 10679,
11798, 11909, 12765,
];
const terminals = [10394, 10395, 10475, 10480, 10482, 10485, 10653, 10654, 10657, 10659, 10679, 11798, 11909, 12765];
function App() {
const [selectedTerminal, setSelectedTerminal] = useState(terminals[0]);
@ -36,14 +32,14 @@ function App() {
});
return (
<div style={{ display: "flex", height: "100vh", width: "100vw" }}>
<div style={{ display: 'flex', height: '100vh', width: '100vw' }}>
<MapContainer
center={[51.505, -0.09]}
zoom={13}
zoomSnap={0}
zoomDelta={0.1}
wheelPxPerZoomLevel={1000}
style={{ height: "100%", width: "100%" }}
style={{ height: '100%', width: '100%' }}
ref={mapRef}
>
<TileLayer
@ -53,90 +49,86 @@ function App() {
{procedures.map((procedure) => (
<>
<GeoJSON
key={hash(procedure ?? "") + "lines"}
key={hash(procedure ?? '') + 'lines'}
data={procedure}
style={({ properties }) => ({
color: "#ff00ff",
color: '#ff00ff',
stroke: true,
weight: 5,
opacity: 1,
dashArray: properties.isManual ? "20, 20" : undefined,
dashArray: properties.isManual ? '20, 20' : undefined,
})}
filter={(feature) => feature.geometry.type !== "Point"}
filter={(feature) => feature.geometry.type !== 'Point'}
ref={layerRef}
/>
<GeoJSON
key={hash(procedure ?? "") + "points"}
key={hash(procedure ?? '') + 'points'}
data={procedure}
style={{
color: "black",
color: 'black',
fill: true,
fillColor: "transparent",
fillColor: 'transparent',
stroke: true,
weight: 3,
}}
pointToLayer={({ properties }, latlng) => {
if (properties.isFlyOver)
return L.shapeMarker(latlng, {
shape: "triangle",
shape: 'triangle',
radius: 6,
});
if (properties.isIntersection)
return L.circleMarker(latlng, { radius: 6 });
if (properties.isIntersection) return L.circleMarker(latlng, { radius: 6 });
return L.shapeMarker(latlng, {
shape: "star-4",
shape: 'star-4',
radius: 10,
rotation: 45,
});
}}
onEachFeature={({ geometry, properties }, layer) => {
if (geometry.type === "Point") {
if (geometry.type === 'Point') {
layer.bindPopup(
`${properties.name}<br>
${properties.altitude} ft<br>
${properties.speed} kts<br>
CNSTR:
${properties.altitudeConstraint ?? ""}
${properties.speedConstraint ?? ""}<br>`
${properties.altitudeConstraint ?? ''}
${properties.speedConstraint ?? ''}<br>`
);
}
}}
filter={(feature) => feature.geometry.type === "Point"}
filter={(feature) => feature.geometry.type === 'Point'}
/>
</>
))}
</MapContainer>
<div
style={{
overflowY: "scroll",
width: "200px",
overflowY: 'scroll',
width: '200px',
}}
>
<div
style={{
padding: "5px",
display: "flex",
flexDirection: "column",
gap: "10px",
padding: '5px',
display: 'flex',
flexDirection: 'column',
gap: '10px',
}}
>
{terminals.map((terminal) => (
<div
key={terminal}
style={{
display: "flex",
flexDirection: "column",
background: "#eeeeee",
border:
selectedTerminal === terminal
? "1px solid black"
: "1px solid #eeeeee",
padding: "5px",
display: 'flex',
flexDirection: 'column',
background: '#eeeeee',
border: selectedTerminal === terminal ? '1px solid black' : '1px solid #eeeeee',
padding: '5px',
}}
onClick={() => setSelectedTerminal(terminal)}
>
<span style={{ whiteSpace: "nowrap" }}>
<span style={{ whiteSpace: 'nowrap' }}>
{(() => {
const t = parser.terminals.find(({ ID }) => ID === terminal);
return `${t?.ICAO} - ${t?.FullName}`;

View File

@ -1,11 +1,11 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import "./index.css";
import "leaflet/dist/leaflet.css";
import 'leaflet/dist/leaflet.css';
import './index.css';
createRoot(document.getElementById("root")!).render(
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>

View File

@ -1,17 +1,24 @@
import Parser from "./parser.ts";
import readline from 'readline';
import Parser from './parser.ts';
// mutate fetch to be local
// @ts-expect-error Global override
// eslint-disable-next-line no-global-assign
fetch = async (path: string) => {
const fs = await import("fs");
const fs = await import('fs');
return {
json: () =>
JSON.parse(fs.readFileSync(`public/${path}`) as unknown as string),
json: () => JSON.parse(fs.readFileSync(`public/${path}`) as unknown as string),
};
};
const parser = await Parser.instance();
console.log(JSON.stringify(await parser.parse(12765)));
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question(`Terminal ID? `, async (id) => {
console.log(JSON.stringify(await parser.parse(Number.parseInt(id))));
rl.close();
});

View File

@ -1,25 +1,25 @@
import "./utils/extensions.ts";
import * as geolib from "geolib";
import geojson from "geojson";
import { TerminatorsCF } from "./terminators/CF.ts";
import { TerminatorsAF } from "./terminators/AF.ts";
import { TerminatorsCR } from "./terminators/CR.ts";
import { TerminatorsVM } from "./terminators/VM.ts";
import { TerminatorsFM } from "./terminators/FM.ts";
import { TerminatorsCI } from "./terminators/CI.ts";
import { TerminatorsVA } from "./terminators/VA.ts";
import { TerminatorsTF } from "./terminators/TF.ts";
import { TerminatorsVI } from "./terminators/VI.ts";
import { TerminatorsVD } from "./terminators/VD.ts";
import { TerminatorsRF } from "./terminators/RF.ts";
import { TerminatorsCA } from "./terminators/CA.ts";
import { TerminatorsDF } from "./terminators/DF.ts";
import { TerminatorsFD } from "./terminators/FD.ts";
import { TerminatorsFA } from "./terminators/FA.ts";
import { TerminatorsCD } from "./terminators/CD.ts";
import { TerminatorsVR } from "./terminators/VR.ts";
import { TerminatorsIF } from "./terminators/IF.ts";
import { TerminatorsFC } from "./terminators/FC.ts";
import geojson from 'geojson';
import * as geolib from 'geolib';
import { TerminatorsAF } from './terminators/AF.ts';
import { TerminatorsCA } from './terminators/CA.ts';
import { TerminatorsCD } from './terminators/CD.ts';
import { TerminatorsCF } from './terminators/CF.ts';
import { TerminatorsCI } from './terminators/CI.ts';
import { TerminatorsCR } from './terminators/CR.ts';
import { TerminatorsDF } from './terminators/DF.ts';
import { TerminatorsFA } from './terminators/FA.ts';
import { TerminatorsFC } from './terminators/FC.ts';
import { TerminatorsFD } from './terminators/FD.ts';
import { TerminatorsFM } from './terminators/FM.ts';
import { TerminatorsIF } from './terminators/IF.ts';
import { TerminatorsRF } from './terminators/RF.ts';
import { TerminatorsTF } from './terminators/TF.ts';
import { TerminatorsVA } from './terminators/VA.ts';
import { TerminatorsVD } from './terminators/VD.ts';
import { TerminatorsVI } from './terminators/VI.ts';
import { TerminatorsVM } from './terminators/VM.ts';
import { TerminatorsVR } from './terminators/VR.ts';
import './utils/extensions.ts';
/*
Runway IDs for LIED
@ -38,11 +38,7 @@ class Parser {
public static AC_BANK = 30;
public static AC_VS = 1400;
private constructor(
waypoints: Waypoint[],
runways: Runway[],
terminals: Terminal[]
) {
private constructor(waypoints: Waypoint[], runways: Runway[], terminals: Terminal[]) {
this._waypoints = waypoints;
this._runways = runways;
this._terminals = terminals;
@ -50,9 +46,9 @@ class Parser {
public static instance = async () => {
if (!Parser._instance) {
const waypoints = await (await fetch("NavData/Waypoints.json")).json();
const runways = await (await fetch("NavData/Runways.json")).json();
const terminals = await (await fetch("NavData/Terminals.json")).json();
const waypoints = await (await fetch('NavData/Waypoints.json')).json();
const runways = await (await fetch('NavData/Runways.json')).json();
const terminals = await (await fetch('NavData/Terminals.json')).json();
Parser._instance = new Parser(waypoints, runways, terminals);
}
@ -73,22 +69,20 @@ class Parser {
public parse = async (terminalID: number) => {
// Get Procedure main
const terminal = this.terminals.find(({ ID }) => ID === terminalID);
if (!terminal) throw new Error("Procedure does not exists");
if (!terminal) throw new Error('Procedure does not exists');
// Get runway this procedure is for
let runway = this.runways.find(({ ID }) => ID === terminal.RwyID);
if (!runway) {
let id = 26156;
if (typeof prompt !== "undefined")
if (typeof prompt !== 'undefined')
// throw new Error("Prompt not defined, cannot continue");
id = Number.parseInt(prompt("Runway ID") ?? "");
id = Number.parseInt(prompt('Runway ID') ?? '');
runway = this.runways.find(({ ID }) => ID === id);
if (!runway) throw new Error("Procedure links to non existent Runway");
if (!runway) throw new Error('Procedure links to non existent Runway');
}
// Load procedure
const procedures = (await (
await fetch(`NavData/TermID_${terminalID}.json`)
).json()) as TerminalEntry[];
const procedures = (await (await fetch(`NavData/TermID_${terminalID}.json`)).json()) as TerminalEntry[];
// Split into transitions
const transitions = new Set(procedures.map((proc) => proc.Transition));
@ -118,11 +112,7 @@ class Parser {
* @param line New line
* @param options Options for line rendering
*/
const update = (
fix?: NavFix,
line?: LineSegment[],
options?: Record<string, unknown>
) => {
const update = (fix?: NavFix, line?: LineSegment[], options?: Record<string, unknown>) => {
if (fix) navFixes.push(fix);
if (line) {
lineSegments.push({ line, ...options });
@ -144,53 +134,34 @@ class Parser {
});
let lastCourse = runway.TrueHeading;
const procedure = procedures.filter(
(proc) => proc.Transition === transition
);
const procedure = procedures.filter((proc) => proc.Transition === transition);
for (let index = 0; index < procedure.length; index++) {
const leg = procedure[index];
const previousFix = navFixes.at(-1)!;
const waypoint = this.waypoints.filter(({ ID }) => ID === leg.WptID)[0];
switch (leg.TrackCode) {
case "AF": {
const [fixToAdd, lineToAdd] = TerminatorsAF(
leg as AFTerminalEntry,
previousFix,
waypoint
);
case 'AF': {
const [fixToAdd, lineToAdd] = TerminatorsAF(leg as AFTerminalEntry, previousFix, waypoint);
update(fixToAdd, lineToAdd);
break;
}
case "CA": {
const [fixToAdd, lineToAdd] = TerminatorsCA(
leg as CATerminalEntry,
previousFix,
lastCourse
);
case 'CA': {
const [fixToAdd, lineToAdd] = TerminatorsCA(leg as CATerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "CD": {
const [fixToAdd, lineToAdd] = TerminatorsCD(
leg as CDTerminalEntry,
previousFix,
lastCourse
);
case 'CD': {
const [fixToAdd, lineToAdd] = TerminatorsCD(leg as CDTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "CF": {
const [fixToAdd, lineToAdd] = TerminatorsCF(
leg as CFTerminalEntry,
previousFix,
lastCourse,
waypoint
);
case 'CF': {
const [fixToAdd, lineToAdd] = TerminatorsCF(leg as CFTerminalEntry, previousFix, lastCourse, waypoint);
update(fixToAdd, lineToAdd);
break;
}
case "CI": {
case 'CI': {
const [fixToAdd, lineToAdd] = TerminatorsCI(
leg as CITerminalEntry,
procedure[index + 1],
@ -200,76 +171,51 @@ class Parser {
update(fixToAdd, lineToAdd);
break;
}
case "CR": {
const [fixToAdd, lineToAdd] = TerminatorsCR(
leg as CRTerminalEntry,
previousFix,
lastCourse
);
case 'CR': {
const [fixToAdd, lineToAdd] = TerminatorsCR(leg as CRTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "DF": {
const [fixToAdd, lineToAdd] = TerminatorsDF(
leg as DFTerminalEntry,
previousFix,
lastCourse,
waypoint
);
case 'DF': {
const [fixToAdd, lineToAdd] = TerminatorsDF(leg as DFTerminalEntry, previousFix, lastCourse, waypoint);
update(fixToAdd, lineToAdd);
break;
}
case "FA": {
const [fixToAdd, lineToAdd] = TerminatorsFA(
leg as FATerminalEntry,
previousFix,
lastCourse
);
case 'FA': {
const [fixToAdd, lineToAdd] = TerminatorsFA(leg as FATerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "FC": {
const [fixToAdd, lineToAdd] = TerminatorsFC(
leg as FCTerminalEntry,
previousFix,
lastCourse
);
case 'FC': {
const [fixToAdd, lineToAdd] = TerminatorsFC(leg as FCTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "FD": {
const [fixToAdd, lineToAdd] = TerminatorsFD(
leg as FDTerminalEntry,
previousFix,
lastCourse
);
case 'FD': {
const [fixToAdd, lineToAdd] = TerminatorsFD(leg as FDTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "FM": {
const [fixToAdd, lineToAdd] = TerminatorsFM(
leg as FMTerminalEntry,
previousFix,
lastCourse
);
case 'FM': {
const [fixToAdd, lineToAdd] = TerminatorsFM(leg as FMTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd, { isManual: true });
break;
}
case "HA":
case "HF":
case "HM":
console.error("Unknown TrackCode", leg.TrackCode);
case 'HA':
case 'HF':
case 'HM':
console.error('Unknown TrackCode', leg.TrackCode);
break;
case "IF": {
case 'IF': {
const fixToAdd = TerminatorsIF(leg as RFTerminalEntry, waypoint);
navFixes.length = 0;
navFixes.push(fixToAdd);
break;
}
case "PI":
console.error("Unknown TrackCode", leg.TrackCode);
case 'PI':
console.error('Unknown TrackCode', leg.TrackCode);
break;
case "RF": {
case 'RF': {
const [fixToAdd, lineToAdd] = TerminatorsRF(
leg as RFTerminalEntry,
procedure[index + 1],
@ -280,35 +226,22 @@ class Parser {
update(fixToAdd, lineToAdd);
break;
}
case "TF": {
const [fixToAdd, lineToAdd] = TerminatorsTF(
leg as TFTerminalEntry,
previousFix,
lastCourse,
waypoint
);
case 'TF': {
const [fixToAdd, lineToAdd] = TerminatorsTF(leg as TFTerminalEntry, previousFix, lastCourse, waypoint);
update(fixToAdd, lineToAdd);
break;
}
case "VA": {
const [fixToAdd, lineToAdd] = TerminatorsVA(
leg as VATerminalEntry,
previousFix,
lastCourse
);
case 'VA': {
const [fixToAdd, lineToAdd] = TerminatorsVA(leg as VATerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "VD": {
const [fixToAdd, lineToAdd] = TerminatorsVD(
leg as VDTerminalEntry,
previousFix,
lastCourse
);
case 'VD': {
const [fixToAdd, lineToAdd] = TerminatorsVD(leg as VDTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
case "VI": {
case 'VI': {
const [fixToAdd, lineToAdd] = TerminatorsVI(
leg as VITerminalEntry,
procedure[index + 1],
@ -318,34 +251,26 @@ class Parser {
update(fixToAdd, lineToAdd);
break;
}
case "VM": {
const [fixToAdd, lineToAdd] = TerminatorsVM(
leg as VMTerminalEntry,
previousFix,
lastCourse
);
case 'VM': {
const [fixToAdd, lineToAdd] = TerminatorsVM(leg as VMTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd, { isManual: true });
break;
}
case "VR": {
const [fixToAdd, lineToAdd] = TerminatorsVR(
leg as VRTerminalEntry,
previousFix,
lastCourse
);
case 'VR': {
const [fixToAdd, lineToAdd] = TerminatorsVR(leg as VRTerminalEntry, previousFix, lastCourse);
update(fixToAdd, lineToAdd);
break;
}
default:
console.error("Unknown TrackCode", leg.TrackCode);
console.error('Unknown TrackCode', leg.TrackCode);
break;
}
}
output.push(
geojson.parse([...navFixes, ...lineSegments], {
LineString: "line",
Point: ["latitude", "longitude"],
LineString: 'line',
Point: ['latitude', 'longitude'],
})
);
});

View File

@ -1,4 +1,4 @@
import * as geolib from "geolib";
import * as geolib from 'geolib';
/**
* @param crsIntoEndpoint Course into arc endpoint
@ -21,14 +21,14 @@ export const generateAFArc = (
if (crsIntoEndpoint !== crsFromOrigin) {
// Turn Dir
if (!turnDir || turnDir === "E") {
if (!turnDir || turnDir === 'E') {
let prov = crsFromOrigin - crsIntoEndpoint;
prov = prov > 180 ? prov - 360 : prov <= -180 ? prov + 360 : prov;
turnDir = prov > 0 ? "L" : "R";
turnDir = prov > 0 ? 'L' : 'R';
}
while (crsFromOrigin !== crsIntoEndpoint) {
if (turnDir === "R") {
if (turnDir === 'R') {
const delta = (crsIntoEndpoint - crsFromOrigin).normaliseDegrees();
crsFromOrigin += delta < 1 ? delta : 1;
crsFromOrigin = crsFromOrigin.normaliseDegrees();
@ -39,11 +39,7 @@ export const generateAFArc = (
}
if (crsFromOrigin === crsIntoEndpoint) break;
const arcFix = geolib.computeDestinationPoint(
center,
radius.toMetre(),
crsFromOrigin
);
const arcFix = geolib.computeDestinationPoint(center, radius.toMetre(), crsFromOrigin);
line.push([arcFix.longitude, arcFix.latitude]);
}

View File

@ -0,0 +1,44 @@
import * as geolib from 'geolib';
import { generatePerformanceArc } from './generatePerformanceArc.ts';
/**
* @param crsIntoEndpoint Course into arc endpoint
* @param crsFromOrigin Course from arc origin point
* @param start Arc origin point
* @param speed Speed within arc
* @param turnDir Turn direction
* @returns Line segments, arc endpoint, course into arc endpoint
*/
export const generateOverflyArc = (
crsIntoEndpoint: number,
crsFromOrigin: number,
start: NavFix,
speed: number,
turnDir?: TurnDirection,
force360?: boolean
): [LineSegment[], NavFix, number] => {
let line: LineSegment[] = [];
// Compute overfly arc
if (start.isFlyOver) {
line = generatePerformanceArc(crsIntoEndpoint, crsFromOrigin, start, speed, turnDir, force360);
}
// Compute procedural arc
else {
line.push([start.longitude, start.latitude]);
}
// Get arc endpoint and crs into arc endpoint
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
crsFromOrigin = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
return [line, arcEnd, crsFromOrigin];
};

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import Parser from "../parser.ts";
import { computeTurnRate } from "../utils/computeTurnRate.ts";
import * as geolib from 'geolib';
import Parser from '../parser.ts';
import { computeTurnRate } from '../utils/computeTurnRate.ts';
/**
* @param crsIntoEndpoint Course into arc endpoint
@ -27,16 +27,16 @@ export const generatePerformanceArc = (
// Check if there even is an arc
if (force360 || !crsFromOrigin.equal(crsIntoEndpoint)) {
// Turn Dir
if (!turnDir || turnDir === "E") {
if (!turnDir || turnDir === 'E') {
let prov = crsFromOrigin - crsIntoEndpoint;
prov = prov > 180 ? prov - 360 : prov <= -180 ? prov + 360 : prov;
turnDir = prov > 0 ? "L" : "R";
turnDir = prov > 0 ? 'L' : 'R';
}
// Generate arc
while (!crsFromOrigin.equal(crsIntoEndpoint)) {
let time = 0;
if (turnDir === "R") {
if (turnDir === 'R') {
const delta = (crsIntoEndpoint - crsFromOrigin).normaliseDegrees();
const increment = delta < 1 ? delta : 1;
crsFromOrigin = (crsFromOrigin + increment).normaliseDegrees();
@ -68,7 +68,7 @@ export const generatePerformanceArc = (
while (!crsFromOrigin.equal(crsIntoEndpoint)) {
let time = 0;
if (turnDir === "R") {
if (turnDir === 'R') {
const delta = (crsIntoEndpoint - crsFromOrigin).normaliseDegrees();
const increment = delta < 1 ? delta : 1;
crsFromOrigin = (crsFromOrigin + increment).normaliseDegrees();

View File

@ -1,4 +1,4 @@
import * as geolib from "geolib";
import * as geolib from 'geolib';
/**
* @param crsIntoEndpoint Course into arc endpoint
@ -19,15 +19,15 @@ export const generateRFArc = (
if (crsIntoEndpoint !== crsIntoOrigin) {
// Turn Dir
if (!turnDir || turnDir === "E") {
if (!turnDir || turnDir === 'E') {
let prov = crsIntoOrigin - crsIntoEndpoint;
prov = prov > 180 ? prov - 360 : prov <= -180 ? prov + 360 : prov;
turnDir = prov > 0 ? "L" : "R";
turnDir = prov > 0 ? 'L' : 'R';
}
let crsOrthogonalOnOrigin;
let crsOrthogonalOnEndpoint;
if (turnDir === "R") {
if (turnDir === 'R') {
crsOrthogonalOnOrigin = (crsIntoOrigin + 90).normaliseDegrees();
crsOrthogonalOnEndpoint = (crsIntoEndpoint + 90).normaliseDegrees();
} else {
@ -40,34 +40,24 @@ export const generateRFArc = (
crsOrthogonalOnOrigin = crsOrthogonalOnOrigin.reciprocalCourse();
crsOrthogonalOnEndpoint = crsOrthogonalOnEndpoint.reciprocalCourse();
// Start turn immediately
if (turnDir === "R") {
crsOrthogonalOnOrigin +=
crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
if (turnDir === 'R') {
crsOrthogonalOnOrigin += crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
} else {
crsOrthogonalOnOrigin -=
crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
crsOrthogonalOnOrigin -= crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
}
while (crsOrthogonalOnOrigin !== crsOrthogonalOnEndpoint) {
if (turnDir === "R") {
const delta = (
crsOrthogonalOnEndpoint - crsOrthogonalOnOrigin
).normaliseDegrees();
if (turnDir === 'R') {
const delta = (crsOrthogonalOnEndpoint - crsOrthogonalOnOrigin).normaliseDegrees();
crsOrthogonalOnOrigin += delta < 1 ? delta : 1;
crsOrthogonalOnOrigin = crsOrthogonalOnOrigin.normaliseDegrees();
} else {
const delta = (
crsOrthogonalOnOrigin - crsOrthogonalOnEndpoint
).normaliseDegrees();
const delta = (crsOrthogonalOnOrigin - crsOrthogonalOnEndpoint).normaliseDegrees();
crsOrthogonalOnOrigin -= delta < 1 ? delta : 1;
crsOrthogonalOnOrigin = crsOrthogonalOnOrigin.normaliseDegrees();
}
const arcFix = geolib.computeDestinationPoint(
center,
arcRad,
crsOrthogonalOnOrigin
);
const arcFix = geolib.computeDestinationPoint(center, arcRad, crsOrthogonalOnOrigin);
line.push([arcFix.longitude, arcFix.latitude]);
}

View File

@ -1,5 +1,5 @@
import * as geolib from "geolib";
import { computeIntersection } from "../utils/computeIntersection.ts";
import * as geolib from 'geolib';
import { computeIntersection } from '../utils/computeIntersection.ts';
/**
* @param crsIntoEndpoint Course into arc endpoint
@ -22,12 +22,12 @@ export const generateTangentArc = (
if (!crsFromOrigin.equal(crsIntoEndpoint)) {
// Course to the end of the arc
let crsFromStartToEnd;
if (!turnDir || turnDir === "E") {
if (!turnDir || turnDir === 'E') {
let prov = crsFromOrigin - crsIntoEndpoint;
prov = prov > 180 ? prov - 360 : prov <= -180 ? prov + 360 : prov;
turnDir = prov > 0 ? "L" : "R";
turnDir = prov > 0 ? 'L' : 'R';
}
if (turnDir === "R") {
if (turnDir === 'R') {
const delta = (360 - crsFromOrigin + crsIntoEndpoint).normaliseDegrees();
crsFromStartToEnd = (crsFromOrigin + delta / 2).normaliseDegrees();
} else {
@ -46,7 +46,7 @@ export const generateTangentArc = (
let crsOrthogonalOnOrigin;
let crsOrthogonalOnEndpoint;
if (turnDir === "R") {
if (turnDir === 'R') {
crsOrthogonalOnOrigin = (crsFromOrigin + 90).normaliseDegrees();
crsOrthogonalOnEndpoint = (crsIntoEndpoint + 90).normaliseDegrees();
} else {
@ -67,34 +67,24 @@ export const generateTangentArc = (
crsOrthogonalOnOrigin = crsOrthogonalOnOrigin.reciprocalCourse();
crsOrthogonalOnEndpoint = crsOrthogonalOnEndpoint.reciprocalCourse();
// Start turn immediately
if (turnDir === "R") {
crsOrthogonalOnOrigin +=
crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
if (turnDir === 'R') {
crsOrthogonalOnOrigin += crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
} else {
crsOrthogonalOnOrigin -=
crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
crsOrthogonalOnOrigin -= crsOrthogonalOnOrigin < 1 ? crsOrthogonalOnOrigin : 1;
}
while (!crsOrthogonalOnOrigin.equal(crsOrthogonalOnEndpoint)) {
if (turnDir === "R") {
const delta = (
crsOrthogonalOnEndpoint - crsOrthogonalOnOrigin
).normaliseDegrees();
if (turnDir === 'R') {
const delta = (crsOrthogonalOnEndpoint - crsOrthogonalOnOrigin).normaliseDegrees();
crsOrthogonalOnOrigin += delta < 1 ? delta : 1;
crsOrthogonalOnOrigin = crsOrthogonalOnOrigin.normaliseDegrees();
} else {
const delta = (
crsOrthogonalOnOrigin - crsOrthogonalOnEndpoint
).normaliseDegrees();
const delta = (crsOrthogonalOnOrigin - crsOrthogonalOnEndpoint).normaliseDegrees();
crsOrthogonalOnOrigin -= delta < 1 ? delta : 1;
crsOrthogonalOnOrigin = crsOrthogonalOnOrigin.normaliseDegrees();
}
const arcFix = geolib.computeDestinationPoint(
arcCenter,
arcRad,
crsOrthogonalOnOrigin
);
const arcFix = geolib.computeDestinationPoint(arcCenter, arcRad, crsOrthogonalOnOrigin);
line.push([arcFix.longitude, arcFix.latitude]);
}

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { generateTangentArc } from "./generateTangentArc.ts";
import { generatePerformanceArc } from "./generatePerformanceArc.ts";
import * as geolib from 'geolib';
import { generatePerformanceArc } from './generatePerformanceArc.ts';
import { generateTangentArc } from './generateTangentArc.ts';
/**
* @param crsIntoEndpoint Course into endpoint
@ -25,21 +25,9 @@ export const handleTurnAtFix = (
// Overfly turn
if (start.isFlyOver) {
const arc1 = generateTangentArc(
crsIntoEndpoint,
crsFromOrigin,
start,
end,
turnDir
);
const arc1 = generateTangentArc(crsIntoEndpoint, crsFromOrigin, start, end, turnDir);
const arc2 = generatePerformanceArc(
crsIntoIntercept,
crsFromOrigin,
start,
speed,
turnDir
);
const arc2 = generatePerformanceArc(crsIntoIntercept, crsFromOrigin, start, speed, turnDir);
// Decide on arc
let arc;
@ -52,8 +40,7 @@ export const handleTurnAtFix = (
end
);
if (endCrs <= crsIntoEndpoint + 1 && endCrs >= crsIntoEndpoint - 1)
arc = arc1;
if (endCrs <= crsIntoEndpoint + 1 && endCrs >= crsIntoEndpoint - 1) arc = arc1;
else arc = arc2;
} else {
arc = arc2;

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { generateAFArc } from "../pathGenerators/generateAFArc.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import * as geolib from 'geolib';
import { generateAFArc } from '../pathGenerators/generateAFArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsAF = (
leg: AFTerminalEntry,

View File

@ -1,7 +1,7 @@
import * as geolib from "geolib";
import Parser from "../parser.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import * as geolib from 'geolib';
import Parser from '../parser.ts';
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsCA = (
leg: CATerminalEntry,
@ -11,37 +11,16 @@ export const TerminatorsCA = (
const speed = computeSpeed(leg, previousFix);
const crsIntoEndpoint = leg.Course.toTrue(previousFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
line = generatePerformanceArc(
crsIntoEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsIntoEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute intercept of crs from arc end and expected altitude
const targetFix: NavFix = {
...geolib.computeDestinationPoint(
arcEnd,
(
((leg.Alt.parseAltitude() - (previousFix.altitude ?? 0)) /
Parser.AC_VS) *
((leg.Alt.parseAltitude() - (previousFix.altitude ?? 0)) / Parser.AC_VS) *
((previousFix.speed ? previousFix.speed : Parser.AC_SPEED) / 60)
).toMetre(),
crsIntoEndpoint
@ -53,7 +32,6 @@ export const TerminatorsCA = (
speedConstraint: leg.SpeedLimit,
altitudeConstraint: leg.Alt,
};
line.push([targetFix.longitude, targetFix.latitude]);
return [targetFix, line];

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import * as geolib from 'geolib';
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
// NOTE: Distance not adjusted for altitude in this demo
export const TerminatorsCD = (
@ -12,35 +12,14 @@ export const TerminatorsCD = (
latitude: leg.NavLat,
longitude: leg.NavLon,
};
const crsIntoEndpoint = leg.Course.toTrue(previousFix);
const speed = computeSpeed(leg, previousFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
const crsIntoEndpoint = leg.Course.toTrue(previousFix);
line = generatePerformanceArc(
crsIntoEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsIntoEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute distance to fly from arc end
const crsToNavaid = geolib.getGreatCircleBearing(arcEnd, navaid);
const distToNavaid = geolib.getDistance(arcEnd, navaid);
let remainingDistance = leg.Distance.toMetre();
@ -51,9 +30,10 @@ export const TerminatorsCD = (
// Navaid in front of us
else {
// Navaid will not be passed before distance is hit
if (distToNavaid > remainingDistance)
remainingDistance = distToNavaid - remainingDistance;
if (distToNavaid > remainingDistance) remainingDistance = distToNavaid - remainingDistance;
}
// Compute intercept of crs from arc end and distance
const targetFix: NavFix = {
...geolib.computeDestinationPoint(arcEnd, remainingDistance, lastCourse),
name: leg.Distance.toString(),
@ -63,7 +43,6 @@ export const TerminatorsCD = (
speedConstraint: leg.SpeedLimit,
altitudeConstraint: leg.Alt,
};
line.push([targetFix.longitude, targetFix.latitude]);
return [targetFix, line];

View File

@ -1,5 +1,5 @@
import { handleTurnAtFix } from "../pathGenerators/handleTurnAtFix.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { handleTurnAtFix } from '../pathGenerators/handleTurnAtFix.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsCF = (
leg: CFTerminalEntry,
@ -20,6 +20,7 @@ export const TerminatorsCF = (
altitudeConstraint: leg.Alt,
};
// Compute arc
const line = handleTurnAtFix(
leg.Course.toTrue(previousFix),
leg.Course.toTrue(previousFix),

View File

@ -1,7 +1,7 @@
import { handleTurnAtFix } from "../pathGenerators/handleTurnAtFix.ts";
import { computeIntersection } from "../utils/computeIntersection.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { getCourseAndFixForIntercepts } from "../utils/getCourseAndFixForIntercepts.ts";
import { handleTurnAtFix } from '../pathGenerators/handleTurnAtFix.ts';
import { computeIntersection } from '../utils/computeIntersection.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
import { getCourseAndFixForIntercepts } from '../utils/getCourseAndFixForIntercepts.ts';
export const TerminatorsCI = (
leg: CITerminalEntry,
@ -12,14 +12,9 @@ export const TerminatorsCI = (
const [crs, nextFix] = getCourseAndFixForIntercepts(nextLeg, previousFix);
const speed = computeSpeed(leg, previousFix);
// Compute INTC
// Compute intercept fix
const interceptFix: NavFix = {
...computeIntersection(
previousFix,
leg.Course.toTrue(nextFix),
nextFix,
crs
)!,
...computeIntersection(previousFix, leg.Course.toTrue(nextFix), nextFix, crs)!,
isFlyOver: leg.IsFlyOver,
altitude: leg.Alt ? leg.Alt.parseAltitude() : previousFix.altitude,
speed: speed,
@ -27,6 +22,7 @@ export const TerminatorsCI = (
altitudeConstraint: leg.Alt,
};
// Compute arc
const line = handleTurnAtFix(
crs,
leg.Course.toTrue(nextFix),
@ -37,7 +33,7 @@ export const TerminatorsCI = (
leg.TurnDir
);
// Intercept based on previous intercept
// Recompute intercept
const interceptPoint2 = computeIntersection(
{ latitude: line.at(-2)![1], longitude: line.at(-2)![0] },
leg.Course.toTrue(nextFix),
@ -47,10 +43,7 @@ export const TerminatorsCI = (
if (interceptPoint2)
return [
{ ...interceptFix, ...interceptPoint2 },
[
...line.slice(0, -1),
[interceptPoint2.longitude, interceptPoint2.latitude],
],
[...line.slice(0, -1), [interceptPoint2.longitude, interceptPoint2.latitude]],
];
return [interceptFix, line];

View File

@ -1,7 +1,6 @@
import * as geolib from "geolib";
import { computeIntersection } from "../utils/computeIntersection.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeIntersection } from '../utils/computeIntersection.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsCR = (
leg: CRTerminalEntry,
@ -16,31 +15,11 @@ export const TerminatorsCR = (
const crsIntoEndpoint = leg.NavBear.toTrue(navaid);
const speed = computeSpeed(leg, previousFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
line = generatePerformanceArc(
crsFromEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsFromEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute intercept of crs from arc end and radial
const interceptFix: NavFix = {
...computeIntersection(arcEnd, crsFromEndpoint, navaid, crsIntoEndpoint)!,
isFlyOver: leg.IsFlyOver,
@ -49,7 +28,6 @@ export const TerminatorsCR = (
speedConstraint: leg.SpeedLimit,
altitudeConstraint: leg.Alt,
};
line.push([interceptFix.longitude, interceptFix.latitude]);
return [interceptFix, line];

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import * as geolib from 'geolib';
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsDF = (
leg: DFTerminalEntry,
@ -21,26 +21,18 @@ export const TerminatorsDF = (
altitudeConstraint: leg.Alt,
};
let line: LineSegment[] = [];
const crsIntoEndpoint = geolib.getGreatCircleBearing(previousFix, targetFix);
if (previousFix.isFlyOver) {
const crsIntoEndpoint = geolib.getGreatCircleBearing(
previousFix,
targetFix
);
line = generatePerformanceArc(
// Compute overfly
const [line, _, _lastCourse] = generateOverflyArc(
crsIntoEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir,
previousFix.latitude.equal(targetFix.latitude) &&
previousFix.longitude.equal(targetFix.longitude)
previousFix.latitude.equal(targetFix.latitude) && previousFix.longitude.equal(targetFix.longitude)
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
lastCourse = _lastCourse;
line.push([targetFix.longitude, targetFix.latitude]);

View File

@ -1,7 +1,7 @@
import * as geolib from "geolib";
import { computeSpeed } from "../utils/computeSpeed.ts";
import Parser from "../parser.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import * as geolib from 'geolib';
import Parser from '../parser.ts';
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsFA = (
leg: FATerminalEntry,
@ -15,37 +15,16 @@ export const TerminatorsFA = (
const speed = computeSpeed(leg, previousFix);
const crsIntoEndpoint = leg.Course.toTrue(refFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
line = generatePerformanceArc(
crsIntoEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsIntoEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute intercept of crs from arc end and expected altitude
const targetFix: NavFix = {
...geolib.computeDestinationPoint(
arcEnd,
(
((leg.Alt.parseAltitude() - (previousFix.altitude ?? 0)) /
Parser.AC_VS) *
((leg.Alt.parseAltitude() - (previousFix.altitude ?? 0)) / Parser.AC_VS) *
((previousFix.speed ? previousFix.speed : Parser.AC_SPEED) / 60)
).toMetre(),
crsIntoEndpoint
@ -57,7 +36,6 @@ export const TerminatorsFA = (
speedConstraint: leg.SpeedLimit,
altitudeConstraint: leg.Alt,
};
line.push([targetFix.longitude, targetFix.latitude]);
return [targetFix, line];

View File

@ -1,7 +1,7 @@
import * as geolib from "geolib";
import { computeSpeed } from "../utils/computeSpeed.ts";
import Parser from "../parser.ts";
import { computeTurnRate } from "../utils/computeTurnRate.ts";
import * as geolib from 'geolib';
import Parser from '../parser.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
import { computeTurnRate } from '../utils/computeTurnRate.ts';
// NOTE: Distance not adjusted for altitude in this demo
export const TerminatorsFC = (
@ -25,17 +25,17 @@ export const TerminatorsFC = (
// Check if there even is an arc
if (!crsIntoEndpoint.equal(lastCourse)) {
// Turn Dir
if (!leg.TurnDir || leg.TurnDir === "E") {
if (!leg.TurnDir || leg.TurnDir === 'E') {
let prov = lastCourse - crsIntoEndpoint;
prov = prov > 180 ? prov - 360 : prov <= -180 ? prov + 360 : prov;
leg.TurnDir = prov > 0 ? "L" : "R";
leg.TurnDir = prov > 0 ? 'L' : 'R';
}
// Generate arc
let condition = false;
do {
let time = 0;
if (leg.TurnDir === "R") {
if (leg.TurnDir === 'R') {
const delta = (crsIntoEndpoint - lastCourse).normaliseDegrees();
const increment = delta < 1 ? delta : 1;
lastCourse = (lastCourse + increment).normaliseDegrees();
@ -58,7 +58,7 @@ export const TerminatorsFC = (
line.push([arcFix.longitude, arcFix.latitude]);
if (leg.TurnDir === "R") {
if (leg.TurnDir === 'R') {
condition = lastCourse > trackIntoEndpoint;
} else {
condition = lastCourse < trackIntoEndpoint;
@ -79,11 +79,7 @@ export const TerminatorsFC = (
}
const targetFix: NavFix = {
...geolib.computeDestinationPoint(
arcEnd,
leg.Distance.toMetre(),
lastCourse
),
...geolib.computeDestinationPoint(arcEnd, leg.Distance.toMetre(), lastCourse),
name: leg.Distance.toString(),
isFlyOver: true,
altitude: leg.Alt ? leg.Alt.parseAltitude() : previousFix.altitude,

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import * as geolib from 'geolib';
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
// NOTE: Distance not adjusted for altitude in this demo
export const TerminatorsFD = (
@ -16,35 +16,14 @@ export const TerminatorsFD = (
latitude: leg.NavLat,
longitude: leg.NavLon,
};
const crsIntoEndpoint = leg.Course.toTrue(refFix);
const speed = computeSpeed(leg, previousFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
const crsIntoEndpoint = leg.Course.toTrue(refFix);
line = generatePerformanceArc(
crsIntoEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsIntoEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute distance to fly from arc end
const crsToNavaid = geolib.getGreatCircleBearing(arcEnd, navaid);
const distToNavaid = geolib.getDistance(arcEnd, navaid);
let remainingDistance = leg.Distance.toMetre();
@ -55,9 +34,10 @@ export const TerminatorsFD = (
// Navaid in front of us
else {
// Navaid will not be passed before distance is hit
if (distToNavaid > remainingDistance)
remainingDistance = distToNavaid - remainingDistance;
if (distToNavaid > remainingDistance) remainingDistance = distToNavaid - remainingDistance;
}
// Compute intercept of crs from arc end and distance
const targetFix: NavFix = {
...geolib.computeDestinationPoint(arcEnd, remainingDistance, lastCourse),
name: leg.Distance.toString(),
@ -67,7 +47,6 @@ export const TerminatorsFD = (
speedConstraint: leg.SpeedLimit,
altitudeConstraint: leg.Alt,
};
line.push([targetFix.longitude, targetFix.latitude]);
return [targetFix, line];

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { handleTurnAtFix } from "../pathGenerators/handleTurnAtFix.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import * as geolib from 'geolib';
import { handleTurnAtFix } from '../pathGenerators/handleTurnAtFix.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsFM = (
leg: FMTerminalEntry,
@ -9,11 +9,7 @@ export const TerminatorsFM = (
): [NavFix?, LineSegment[]?] => {
const speed = computeSpeed(leg, previousFix);
const endpoint = geolib.computeDestinationPoint(
previousFix,
(10).toMetre(),
leg.Course.toTrue(previousFix)
);
const endpoint = geolib.computeDestinationPoint(previousFix, (10).toMetre(), leg.Course.toTrue(previousFix));
const line = handleTurnAtFix(
leg.Course.toTrue(previousFix),

View File

@ -1,9 +1,6 @@
import Parser from "../parser.ts";
import Parser from '../parser.ts';
export const TerminatorsIF = (
leg: IFTerminalEntry,
waypoint?: Waypoint
): NavFix => {
export const TerminatorsIF = (leg: IFTerminalEntry, waypoint?: Waypoint): NavFix => {
const targetFix: NavFix = {
latitude: leg.WptLat,
longitude: leg.WptLon,

View File

@ -1,6 +1,6 @@
import { getCourseAndFixForIntercepts } from "../utils/getCourseAndFixForIntercepts.ts";
import { generateRFArc } from "../pathGenerators/generateRFArc.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generateRFArc } from '../pathGenerators/generateRFArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
import { getCourseAndFixForIntercepts } from '../utils/getCourseAndFixForIntercepts.ts';
export const TerminatorsRF = (
leg: RFTerminalEntry,

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { computeSpeed } from "../utils/computeSpeed.ts";
import Parser from "../parser.ts";
import * as geolib from 'geolib';
import Parser from '../parser.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
export const TerminatorsTF = (
leg: TFTerminalEntry,
@ -21,10 +21,7 @@ export const TerminatorsTF = (
const line: LineSegment[] = [[previousFix.longitude, previousFix.latitude]];
const trackIntoEndpoint = geolib.getGreatCircleBearing(
previousFix,
targetFix
);
const trackIntoEndpoint = geolib.getGreatCircleBearing(previousFix, targetFix);
if (previousFix.isFlyOver) {
let crsIntoEndpoint = trackIntoEndpoint;
@ -32,16 +29,16 @@ export const TerminatorsTF = (
// Check if there even is an arc
if (crsIntoEndpoint !== lastCourse) {
// Turn Dir
if (!leg.TurnDir || leg.TurnDir === "E") {
if (!leg.TurnDir || leg.TurnDir === 'E') {
let prov = lastCourse - crsIntoEndpoint;
prov = prov > 180 ? prov - 360 : prov <= -180 ? prov + 360 : prov;
leg.TurnDir = prov > 0 ? "L" : "R";
leg.TurnDir = prov > 0 ? 'L' : 'R';
}
// Generate arc
let condition = false;
do {
if (leg.TurnDir === "R") {
if (leg.TurnDir === 'R') {
const delta = (crsIntoEndpoint - lastCourse).normaliseDegrees();
lastCourse += delta < 1 ? delta : 1;
lastCourse = lastCourse.normaliseDegrees();
@ -56,9 +53,7 @@ export const TerminatorsTF = (
latitude: line.at(-1)![1],
longitude: line.at(-1)![0],
},
(
(previousFix.speed ? previousFix.speed : Parser.AC_SPEED) / 3600
).toMetre(),
((previousFix.speed ? previousFix.speed : Parser.AC_SPEED) / 3600).toMetre(),
lastCourse
);
@ -66,7 +61,7 @@ export const TerminatorsTF = (
crsIntoEndpoint = geolib.getGreatCircleBearing(arcFix, targetFix);
if (leg.TurnDir === "R") {
if (leg.TurnDir === 'R') {
condition = crsIntoEndpoint > trackIntoEndpoint;
} else {
condition = crsIntoEndpoint < trackIntoEndpoint;

View File

@ -1,7 +1,7 @@
import * as geolib from "geolib";
import Parser from "../parser.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import * as geolib from 'geolib';
import Parser from '../parser.ts';
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
// NOTE: No wind adjustments to be made, no clue how *that* would draw
export const TerminatorsVA = (
@ -12,37 +12,16 @@ export const TerminatorsVA = (
const speed = computeSpeed(leg, previousFix);
const crsIntoEndpoint = leg.Course.toTrue(previousFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
line = generatePerformanceArc(
crsIntoEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsIntoEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute intercept of crs from arc end and expected altitude
const targetFix: NavFix = {
...geolib.computeDestinationPoint(
arcEnd,
(
((leg.Alt.parseAltitude() - (previousFix.altitude ?? 0)) /
Parser.AC_VS) *
((leg.Alt.parseAltitude() - (previousFix.altitude ?? 0)) / Parser.AC_VS) *
((previousFix.speed ? previousFix.speed : Parser.AC_SPEED) / 60)
).toMetre(),
crsIntoEndpoint
@ -54,7 +33,6 @@ export const TerminatorsVA = (
speedConstraint: leg.SpeedLimit,
altitudeConstraint: leg.Alt,
};
line.push([targetFix.longitude, targetFix.latitude]);
return [targetFix, line];

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import * as geolib from 'geolib';
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
// NOTE: No wind adjustments to be made, no clue how *that* would draw
// NOTE: Distance not adjusted for altitude in this demo
@ -13,35 +13,14 @@ export const TerminatorsVD = (
latitude: leg.NavLat,
longitude: leg.NavLon,
};
const crsIntoEndpoint = leg.Course.toTrue(previousFix);
const speed = computeSpeed(leg, previousFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
const crsIntoEndpoint = leg.Course.toTrue(previousFix);
line = generatePerformanceArc(
crsIntoEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsIntoEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute distance to fly from arc end
const crsToNavaid = geolib.getGreatCircleBearing(arcEnd, navaid);
const distToNavaid = geolib.getDistance(arcEnd, navaid);
let remainingDistance = leg.Distance.toMetre();
@ -52,9 +31,10 @@ export const TerminatorsVD = (
// Navaid in front of us
else {
// Navaid will not be passed before distance is hit
if (distToNavaid > remainingDistance)
remainingDistance = distToNavaid - remainingDistance;
if (distToNavaid > remainingDistance) remainingDistance = distToNavaid - remainingDistance;
}
// Compute intercept of crs from arc end and distance
const targetFix: NavFix = {
...geolib.computeDestinationPoint(arcEnd, remainingDistance, lastCourse),
name: leg.Distance.toString(),
@ -64,7 +44,6 @@ export const TerminatorsVD = (
speedConstraint: leg.SpeedLimit,
altitudeConstraint: leg.Alt,
};
line.push([targetFix.longitude, targetFix.latitude]);
return [targetFix, line];

View File

@ -1,7 +1,7 @@
import { handleTurnAtFix } from "../pathGenerators/handleTurnAtFix.ts";
import { computeIntersection } from "../utils/computeIntersection.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { getCourseAndFixForIntercepts } from "../utils/getCourseAndFixForIntercepts.ts";
import { handleTurnAtFix } from '../pathGenerators/handleTurnAtFix.ts';
import { computeIntersection } from '../utils/computeIntersection.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
import { getCourseAndFixForIntercepts } from '../utils/getCourseAndFixForIntercepts.ts';
// NOTE: No wind adjustments to be made, no clue how *that* would draw
export const TerminatorsVI = (
@ -15,12 +15,7 @@ export const TerminatorsVI = (
// Compute INTC
const interceptFix: NavFix = {
...computeIntersection(
previousFix,
leg.Course.toTrue(nextFix),
nextFix,
crs
)!,
...computeIntersection(previousFix, leg.Course.toTrue(nextFix), nextFix, crs)!,
isFlyOver: leg.IsFlyOver,
altitude: leg.Alt ? leg.Alt.parseAltitude() : previousFix.altitude,
speed: speed,
@ -48,10 +43,7 @@ export const TerminatorsVI = (
if (interceptPoint2)
return [
{ ...interceptFix, ...interceptPoint2 },
[
...line.slice(0, -1),
[interceptPoint2.longitude, interceptPoint2.latitude],
],
[...line.slice(0, -1), [interceptPoint2.longitude, interceptPoint2.latitude]],
];
return [interceptFix, line];

View File

@ -1,6 +1,6 @@
import * as geolib from "geolib";
import { handleTurnAtFix } from "../pathGenerators/handleTurnAtFix.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import * as geolib from 'geolib';
import { handleTurnAtFix } from '../pathGenerators/handleTurnAtFix.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
// NOTE: No wind adjustments to be made, no clue how *that* would draw
export const TerminatorsVM = (
@ -10,11 +10,7 @@ export const TerminatorsVM = (
): [NavFix?, LineSegment[]?] => {
const speed = computeSpeed(leg, previousFix);
const endpoint = geolib.computeDestinationPoint(
previousFix,
(10).toMetre(),
leg.Course.toTrue(previousFix)
);
const endpoint = geolib.computeDestinationPoint(previousFix, (10).toMetre(), leg.Course.toTrue(previousFix));
const line = handleTurnAtFix(
leg.Course.toTrue(previousFix),

View File

@ -1,7 +1,6 @@
import * as geolib from "geolib";
import { computeIntersection } from "../utils/computeIntersection.ts";
import { computeSpeed } from "../utils/computeSpeed.ts";
import { generatePerformanceArc } from "../pathGenerators/generatePerformanceArc.ts";
import { generateOverflyArc } from '../pathGenerators/generateOverflyArc.ts';
import { computeIntersection } from '../utils/computeIntersection.ts';
import { computeSpeed } from '../utils/computeSpeed.ts';
// NOTE: No wind adjustments to be made, no clue how *that* would draw
export const TerminatorsVR = (
@ -17,31 +16,11 @@ export const TerminatorsVR = (
const crsIntoEndpoint = leg.NavBear.toTrue(navaid);
const speed = computeSpeed(leg, previousFix);
let line: LineSegment[] = [];
if (previousFix.isFlyOver) {
line = generatePerformanceArc(
crsFromEndpoint,
lastCourse,
previousFix,
speed,
leg.TurnDir
);
} else {
line.push([previousFix.longitude, previousFix.latitude]);
}
const arcEnd = { latitude: line.at(-1)![1], longitude: line.at(-1)![0] };
if (line.length > 1) {
lastCourse = geolib.getGreatCircleBearing(
{
latitude: line.at(-2)![1],
longitude: line.at(-2)![0],
},
arcEnd
);
}
// Compute overfly
const [line, arcEnd, _lastCourse] = generateOverflyArc(crsFromEndpoint, lastCourse, previousFix, speed, leg.TurnDir);
lastCourse = _lastCourse;
// Compute intercept of crs from arc end and radial
const interceptFix: NavFix = {
...computeIntersection(arcEnd, crsFromEndpoint, navaid, crsIntoEndpoint)!,
isFlyOver: leg.IsFlyOver,

View File

@ -5,12 +5,7 @@
* @param brng2 bearing from Point 2
* @returns Intersection point
*/
export const computeIntersection = (
p1: NavFix,
brng1: number,
p2: NavFix,
brng2: number
): NavFix | undefined => {
export const computeIntersection = (p1: NavFix, brng1: number, p2: NavFix, brng2: number): NavFix | undefined => {
if (isNaN(brng1)) throw new TypeError(`invalid brng1 ${brng1}`);
if (isNaN(brng2)) throw new TypeError(`invalid brng2 ${brng2}`);
@ -31,20 +26,13 @@ export const computeIntersection = (
const δ12 =
2 *
Math.asin(
Math.sqrt(
Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2)
)
Math.sqrt(Math.sin(Δφ / 2) * Math.sin(Δφ / 2) + Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2))
);
if (Math.abs(δ12) < Number.EPSILON) return p1; // coincident points
// initial/final bearings between points
const cosθa =
(Math.sin(φ2) - Math.sin(φ1) * Math.cos(δ12)) /
(Math.sin(δ12) * Math.cos(φ1));
const cosθb =
(Math.sin(φ1) - Math.sin(φ2) * Math.cos(δ12)) /
(Math.sin(δ12) * Math.cos(φ2));
const cosθa = (Math.sin(φ2) - Math.sin(φ1) * Math.cos(δ12)) / (Math.sin(δ12) * Math.cos(φ1));
const cosθb = (Math.sin(φ1) - Math.sin(φ2) * Math.cos(δ12)) / (Math.sin(δ12) * Math.cos(φ2));
const θa = Math.acos(Math.min(Math.max(cosθa, -1), 1)); // protect against rounding errors
const θb = Math.acos(Math.min(Math.max(cosθb, -1), 1)); // protect against rounding errors
@ -57,29 +45,15 @@ export const computeIntersection = (
if (Math.sin(α1) == 0 && Math.sin(α2) == 0) return undefined; // infinite intersections
if (Math.sin(α1) * Math.sin(α2) < 0) return undefined; // ambiguous intersection (antipodal/360°)
const cosα3 =
-Math.cos(α1) * Math.cos(α2) + Math.sin(α1) * Math.sin(α2) * Math.cos(δ12);
const cosα3 = -Math.cos(α1) * Math.cos(α2) + Math.sin(α1) * Math.sin(α2) * Math.cos(δ12);
const δ13 = Math.atan2(
Math.sin(δ12) * Math.sin(α1) * Math.sin(α2),
Math.cos(α2) + Math.cos(α1) * cosα3
);
const δ13 = Math.atan2(Math.sin(δ12) * Math.sin(α1) * Math.sin(α2), Math.cos(α2) + Math.cos(α1) * cosα3);
const φ3 = Math.asin(
Math.min(
Math.max(
Math.sin(φ1) * Math.cos(δ13) +
Math.cos(φ1) * Math.sin(δ13) * Math.cos(θ13),
-1
),
1
)
Math.min(Math.max(Math.sin(φ1) * Math.cos(δ13) + Math.cos(φ1) * Math.sin(δ13) * Math.cos(θ13), -1), 1)
);
const Δλ13 = Math.atan2(
Math.sin(θ13) * Math.sin(δ13) * Math.cos(φ1),
Math.cos(δ13) - Math.sin(φ1) * Math.sin(φ3)
);
const Δλ13 = Math.atan2(Math.sin(θ13) * Math.sin(δ13) * Math.cos(φ1), Math.cos(δ13) - Math.sin(φ1) * Math.sin(φ3));
const λ3 = λ1 + Δλ13;
const lat = φ3.toDegrees();
@ -89,7 +63,7 @@ export const computeIntersection = (
...p1,
latitude: lat,
longitude: lon,
name: "INTC",
name: 'INTC',
isIntersection: true,
};
};

View File

@ -1,4 +1,4 @@
import Parser from "../parser.ts";
import Parser from '../parser.ts';
export const computeSpeed = (leg: TerminalEntry, previousFix: NavFix) => {
if (leg.SpeedLimit) return leg.SpeedLimit;

View File

@ -1,4 +1,4 @@
import { magvar } from "magvar";
import { magvar } from 'magvar';
Number.prototype.toRadians = function () {
return ((this as number) * Math.PI) / 180;

View File

@ -1,26 +1,23 @@
import * as geolib from "geolib";
import * as geolib from 'geolib';
/**
* @param leg Leg to examine
* @param origin Origin of current leg
* @returns Adjusted course and fix
*/
export const getCourseAndFixForIntercepts = (
leg: TerminalEntry,
origin: NavFix
): [number, NavFix] => {
export const getCourseAndFixForIntercepts = (leg: TerminalEntry, origin: NavFix): [number, NavFix] => {
switch (leg.TrackCode) {
case "CF": {
case 'CF': {
const _leg = leg as CFTerminalEntry;
const fix = { latitude: _leg.WptLat, longitude: _leg.WptLon };
return [_leg.Course.reciprocalCourse().toTrue(fix), fix];
}
case "FM": {
case 'FM': {
const _leg = leg as FMTerminalEntry;
const fix = { latitude: _leg.WptLat, longitude: _leg.WptLon };
return [_leg.Course.toTrue(fix), fix];
}
case "TF": {
case 'TF': {
const _leg = leg as FMTerminalEntry;
return [
geolib.getGreatCircleBearing(origin, {
@ -30,7 +27,7 @@ export const getCourseAndFixForIntercepts = (
{ latitude: _leg.WptLat, longitude: _leg.WptLon },
];
}
case "AF": {
case 'AF': {
const _leg = leg as AFTerminalEntry;
const fix = { latitude: _leg.WptLat, longitude: _leg.WptLon };
return [_leg.Course.reciprocalCourse().toTrue(fix), fix];

View File

@ -1,3 +1,3 @@
declare module "geojson" {
declare module 'geojson' {
export const parse: (data: object, format: object) => object;
}

View File

@ -1,21 +1,21 @@
//eslint-disable-next-line @typescript-eslint/no-unused-vars
import * as L from "leaflet";
import 'leaflet';
declare module "leaflet" {
declare module 'leaflet' {
export function shapeMarker(
latlng: LatLngExpression,
options?: PathOptions & {
shape?:
| "diamond"
| "square"
| "triangle"
| "triangle-up"
| "triangle-down"
| "arrowhead"
| "arrowhead-up"
| "arrowhead-down"
| "circle"
| "x"
| 'diamond'
| 'square'
| 'triangle'
| 'triangle-up'
| 'triangle-down'
| 'arrowhead'
| 'arrowhead-up'
| 'arrowhead-down'
| 'circle'
| 'x'
| string;
radius?: number;
rotation?: number;

View File

@ -1,3 +1,3 @@
declare module "magvar" {
declare module 'magvar' {
export const magvar: (latitude: number, longitude: number) => number;
}

View File

@ -2,16 +2,7 @@ export declare global {
type AFTerminalEntry = Required<
Pick<
TerminalEntry,
| "WptID"
| "WptLat"
| "WptLon"
| "TurnDir"
| "NavID"
| "NavLat"
| "NavLon"
| "NavBear"
| "NavDist"
| "Course"
'WptID' | 'WptLat' | 'WptLon' | 'TurnDir' | 'NavID' | 'NavLat' | 'NavLon' | 'NavBear' | 'NavDist' | 'Course'
>
> &
TerminalEntry;

View File

@ -1,4 +1,3 @@
export declare global {
type CATerminalEntry = Required<Pick<TerminalEntry, "Course" | "Alt">> &
TerminalEntry;
type CATerminalEntry = Required<Pick<TerminalEntry, 'Course' | 'Alt'>> & TerminalEntry;
}

View File

@ -1,6 +1,4 @@
export declare global {
type CDTerminalEntry = Required<
Pick<TerminalEntry, "NavID" | "NavLat" | "NavLon" | "Course" | "Distance">
> &
type CDTerminalEntry = Required<Pick<TerminalEntry, 'NavID' | 'NavLat' | 'NavLon' | 'Course' | 'Distance'>> &
TerminalEntry;
}

View File

@ -2,16 +2,7 @@ export declare global {
type CFTerminalEntry = Required<
Pick<
TerminalEntry,
| "WptID"
| "WptLat"
| "WptLon"
| "NavID"
| "NavLat"
| "NavLon"
| "NavBear"
| "NavDist"
| "Course"
| "Distance"
'WptID' | 'WptLat' | 'WptLon' | 'NavID' | 'NavLat' | 'NavLon' | 'NavBear' | 'NavDist' | 'Course' | 'Distance'
>
> &
TerminalEntry;

View File

@ -1,4 +1,3 @@
export declare global {
type CITerminalEntry = Required<Pick<TerminalEntry, "Course">> &
TerminalEntry;
type CITerminalEntry = Required<Pick<TerminalEntry, 'Course'>> & TerminalEntry;
}

View File

@ -1,6 +1,4 @@
export declare global {
type CRTerminalEntry = Required<
Pick<TerminalEntry, "NavID" | "NavLat" | "NavLon" | "NavBear" | "Course">
> &
type CRTerminalEntry = Required<Pick<TerminalEntry, 'NavID' | 'NavLat' | 'NavLon' | 'NavBear' | 'Course'>> &
TerminalEntry;
}

View File

@ -1,6 +1,3 @@
export declare global {
type DFTerminalEntry = Required<
Pick<TerminalEntry, "WptID" | "WptLat" | "WptLon" | "IsFlyOver">
> &
TerminalEntry;
type DFTerminalEntry = Required<Pick<TerminalEntry, 'WptID' | 'WptLat' | 'WptLon' | 'IsFlyOver'>> & TerminalEntry;
}

View File

@ -2,16 +2,7 @@ export declare global {
type FATerminalEntry = Required<
Pick<
TerminalEntry,
| "WptID"
| "WptLat"
| "WptLon"
| "NavID"
| "NavLat"
| "NavLon"
| "NavBear"
| "NavDist"
| "Course"
| "Alt"
'WptID' | 'WptLat' | 'WptLon' | 'NavID' | 'NavLat' | 'NavLon' | 'NavBear' | 'NavDist' | 'Course' | 'Alt'
>
> &
TerminalEntry;

View File

@ -2,17 +2,17 @@ export declare global {
type FCTerminalEntry = Required<
Pick<
TerminalEntry,
| "WptID"
| "WptLat"
| "WptLon"
| "IsFlyOver"
| "NavID"
| "NavLat"
| "NavLon"
| "NavBear"
| "NavDist"
| "Course"
| "Distance"
| 'WptID'
| 'WptLat'
| 'WptLon'
| 'IsFlyOver'
| 'NavID'
| 'NavLat'
| 'NavLon'
| 'NavBear'
| 'NavDist'
| 'Course'
| 'Distance'
>
> &
TerminalEntry;

View File

@ -2,16 +2,7 @@ export declare global {
type FDTerminalEntry = Required<
Pick<
TerminalEntry,
| "WptID"
| "WptLat"
| "WptLon"
| "NavID"
| "NavLat"
| "NavLon"
| "NavBear"
| "NavDist"
| "Course"
| "Distance"
'WptID' | 'WptLat' | 'WptLon' | 'NavID' | 'NavLat' | 'NavLon' | 'NavBear' | 'NavDist' | 'Course' | 'Distance'
>
> &
TerminalEntry;

View File

@ -2,15 +2,7 @@ export declare global {
type FMTerminalEntry = Required<
Pick<
TerminalEntry,
| "WptID"
| "WptLat"
| "WptLon"
| "NavID"
| "NavLat"
| "NavLon"
| "NavBear"
| "NavDist"
| "Course"
'WptID' | 'WptLat' | 'WptLon' | 'NavID' | 'NavLat' | 'NavLon' | 'NavBear' | 'NavDist' | 'Course'
>
> &
TerminalEntry;

View File

@ -1,6 +1,3 @@
export declare global {
type IFTerminalEntry = Required<
Pick<TerminalEntry, "WptID" | "WptLat" | "WptLon">
> &
TerminalEntry;
type IFTerminalEntry = Required<Pick<TerminalEntry, 'WptID' | 'WptLat' | 'WptLon'>> & TerminalEntry;
}

View File

@ -2,16 +2,16 @@ export declare global {
type RFTerminalEntry = Required<
Pick<
TerminalEntry,
| "WptID"
| "WptLat"
| "WptLon"
| "TurnDir"
| "NavBear"
| "Course"
| "Distance"
| "CenterID"
| "CenterLat"
| "CenterLon"
| 'WptID'
| 'WptLat'
| 'WptLon'
| 'TurnDir'
| 'NavBear'
| 'Course'
| 'Distance'
| 'CenterID'
| 'CenterLat'
| 'CenterLon'
>
> &
TerminalEntry;

View File

@ -1,6 +1,3 @@
export declare global {
type TFTerminalEntry = Required<
Pick<TerminalEntry, "WptID" | "WptLat" | "WptLon" | "IsFlyOver">
> &
TerminalEntry;
type TFTerminalEntry = Required<Pick<TerminalEntry, 'WptID' | 'WptLat' | 'WptLon' | 'IsFlyOver'>> & TerminalEntry;
}

View File

@ -1,4 +1,3 @@
export declare global {
type VATerminalEntry = Required<Pick<TerminalEntry, "Course" | "Alt">> &
TerminalEntry;
type VATerminalEntry = Required<Pick<TerminalEntry, 'Course' | 'Alt'>> & TerminalEntry;
}

View File

@ -1,6 +1,4 @@
export declare global {
type VDTerminalEntry = Required<
Pick<TerminalEntry, "NavID" | "NavLat" | "NavLon" | "Course" | "Distance">
> &
type VDTerminalEntry = Required<Pick<TerminalEntry, 'NavID' | 'NavLat' | 'NavLon' | 'Course' | 'Distance'>> &
TerminalEntry;
}

View File

@ -1,4 +1,3 @@
export declare global {
type VITerminalEntry = Required<Pick<TerminalEntry, "Course">> &
TerminalEntry;
type VITerminalEntry = Required<Pick<TerminalEntry, 'Course'>> & TerminalEntry;
}

View File

@ -1,4 +1,3 @@
export declare global {
type VMTerminalEntry = Required<Pick<TerminalEntry, "Course">> &
TerminalEntry;
type VMTerminalEntry = Required<Pick<TerminalEntry, 'Course'>> & TerminalEntry;
}

View File

@ -1,6 +1,4 @@
export declare global {
type VRTerminalEntry = Required<
Pick<TerminalEntry, "NavID" | "NavLat" | "NavLon" | "NavBear" | "Course">
> &
type VRTerminalEntry = Required<Pick<TerminalEntry, 'NavID' | 'NavLat' | 'NavLon' | 'NavBear' | 'Course'>> &
TerminalEntry;
}

View File

@ -14,31 +14,31 @@ export declare global {
};
type TrackCode =
| "AF"
| "CA"
| "CD"
| "CF"
| "CI"
| "CR"
| "DF"
| "FA"
| "FC"
| "FD"
| "FM"
| "HA"
| "HF"
| "HM"
| "IF"
| "PI"
| "RF"
| "TF"
| "VA"
| "VD"
| "VI"
| "VM"
| "VR";
| 'AF'
| 'CA'
| 'CD'
| 'CF'
| 'CI'
| 'CR'
| 'DF'
| 'FA'
| 'FC'
| 'FD'
| 'FM'
| 'HA'
| 'HF'
| 'HM'
| 'IF'
| 'PI'
| 'RF'
| 'TF'
| 'VA'
| 'VD'
| 'VI'
| 'VM'
| 'VR';
type TurnDirection = "E" | "L" | "R";
type TurnDirection = 'E' | 'L' | 'R';
type TerminalEntry = {
ID: number;
@ -82,7 +82,7 @@ export declare global {
speed?: number;
name?: string;
isFlyOver?: boolean;
"marker-color"?: string;
'marker-color'?: string;
altitudeConstraint?: string;
speedConstraint?: number;
// For map

View File

@ -1,7 +1,4 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
}

View File

@ -1,7 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
});