UNPKG

flight-planner

Version:

Plan and route VFR flights

81 lines (80 loc) 3.44 kB
import { Aircraft, AircraftPerformance } from './aircraft'; import { Aerodrome, ReportingPoint, Waypoint } from './airport'; /** * Represents a segment of a flight route between two waypoints. * * @interface RouteLeg * @property {Waypoint} start - The starting waypoint of the leg * @property {Waypoint} end - The ending waypoint of the leg * @property {number} distance - The distance of the leg in nautical miles * @property {number} trueTrack - The true track heading in degrees * @property {number | undefined} windDirection - The wind direction in degrees, if available * @property {number | undefined} windSpeed - The wind speed in knots, if available * @property {AircraftPerformance} [performance] - Optional performance calculations for this leg */ export interface RouteLeg { start: Waypoint; end: Waypoint; distance: number; trueTrack: number; windDirection: number | undefined; windSpeed: number | undefined; performance?: AircraftPerformance; } /** * Represents a complete route trip with multiple legs. * Contains information about the route's path, distances, duration, and optionally fuel consumption and timing. * * @interface RouteTrip * @property {RouteLeg[]} route - Array of route legs that make up the complete trip * @property {number} totalDistance - Total distance of the trip in nautical miles * @property {number} totalDuration - Total duration of the trip in minutes * @property {number} [totalFuelConsumption] - Optional total fuel consumption for the trip in gallons/liters * @property {number} [totalFuelRequired] - Optional total fuel required for the trip in gallons/liters * @property {Date} [departureDate] - Optional planned departure date and time * @property {Date} [arrivalDate] - Optional estimated arrival date and time */ export interface RouteTrip { route: RouteLeg[]; totalDistance: number; totalDuration: number; totalFuelConsumption?: number; totalFuelRequired?: number; departureDate?: Date; arrivalDate?: Date; } /** * Maps a route trip to an array of waypoints. * * This function extracts all waypoints from a route trip by taking the start and end * waypoints of each leg and flattening them into a single array. * * @param routeTrip - The route trip containing legs with start and end waypoints * @returns An array of waypoints representing all points in the route trip */ export declare function routeTripWaypoints(routeTrip: RouteTrip): Waypoint[]; /** * Options for configuring a flight route. * * @interface RouteOptions * @property {number} [altitude] - The cruising altitude in feet. * @property {Date} [departureDate] - The scheduled departure date and time. * @property {Aircraft} [aircraft] - The aircraft to be used for the flight. * @property {Aerodrome} [alternate] - An alternate aerodrome for the flight plan. * @property {number} [reserveFuel] - The amount of reserve fuel to carry in gallons or liters. */ export interface RouteOptions { altitude?: number; departureDate?: Date; aircraft?: Aircraft; alternate?: Aerodrome; reserveFuel?: number; } /** * Plans a route between the given waypoints. * * @param waypoints - An array of waypoints. * @param aircraft - An optional aircraft object. * @returns A route trip object. */ export declare function planFlightRoute(waypoints: (Aerodrome | ReportingPoint | Waypoint)[], options?: RouteOptions): RouteTrip;