flight-planner
Version:
Plan and route VFR flights
76 lines (75 loc) • 2.96 kB
TypeScript
import { AerodromeRepository } from './index';
import { Aerodrome, ReportingPoint, Waypoint } from "./airport";
/**
* Represents a wind vector with angle and decomposed components.
*
* @interface WindVector
* @property {number} angle - The angle of the wind in degrees.
* @property {number} headwind - The headwind component of the wind vector.
* @property {number} crosswind - The crosswind component of the wind vector.
*/
export interface WindVector {
angle: number;
headwind: number;
crosswind: number;
}
/**
* Represents wind conditions.
*
* @interface Wind
* @property {number} direction - The direction of the wind in degrees (0-359).
* @property {number} speed - The speed of the wind in knots.
*/
export interface Wind {
direction: number;
speed: number;
}
/**
* Calculates the wind vector relative to the given heading.
*
* @param wind - An object representing the wind, containing degrees and speed.
* @param heading - The current heading in degrees.
* @returns An object containing the wind angle, headwind, and crosswind components.
*/
export declare function calculateWindVector(wind: Wind, heading: number): WindVector;
/**
* Calculates the wind correction angle for the given wind, true track, and airspeed.
*
* @param wind - An object representing the wind, containing degrees and speed.
* @param trueTrack - The true track in degrees.
* @param airSpeed - The airspeed in knots.
* @returns The wind correction angle in degrees.
*/
export declare function calculateWindCorrectionAngle(wind: Wind, trueTrack: number, airSpeed: number): number;
/**
* Calculates the groundspeed for the given wind, airspeed, and heading.
*
* @param wind - An object representing the wind, containing degrees and speed.
* @param airSpeed - The airspeed in knots.
* @param heading - The heading in degrees.
* @returns The groundspeed in knots.
*/
export declare function calculateGroundspeed(wind: Wind, airSpeed: number, heading: number): number;
/**
* Parses a route string and returns an array of waypoints.
*
* @param AerodromeRepository - The repository to use for finding airports
* @param reportingPoints - The list of reporting points to use for finding reporting points
* @param routeString - The route string to parse
* @returns A promise that resolves to an array of waypoints
*/
export declare function parseRouteString(AerodromeRepository: AerodromeRepository, reportingPoints: Waypoint[], routeString: string): Promise<(Aerodrome | ReportingPoint | Waypoint)[]>;
/**
* Checks if the given string is a valid ICAO code.
*
* @param icao - The string to check
* @returns True if the string is a valid ICAO code, false otherwise
*/
export declare function isICAO(icao: string): boolean;
/**
* Normalizes the given ICAO code to uppercase.
*
* @param icao - The ICAO code to normalize
* @returns The normalized ICAO code
*/
export declare function normalizeICAO(icao: string): string;