UNPKG

flight-planner

Version:

Plan and route VFR flights

96 lines (95 loc) 3.39 kB
import { Waypoint } from './waypoint.js'; /** * Enum representing different sun events. * * @enum {string} * @readonly */ export declare enum SunEventType { Sunrise = "sunrise", Sunset = "sunset", Dawn = "dawn",// Morning civil twilight starts Dusk = "dusk",// Evening civil twilight starts NauticalDawn = "nauticalDawn", NauticalDusk = "nauticalDusk", NightEnd = "nightEnd",// Dark enough for astronomical observations Night = "night",// Dark enough for astronomical observations GoldenHourEnd = "goldenHourEnd", GoldenHour = "goldenHour", SolarNoon = "solarNoon", NaDir = "nadir" } /** * Interface representing a sun event. * * @interface SunEvent * @property {Date} time - The time when the event occurs * @property {SunEventType} event - The type of sun event * @property {Waypoint} location - The location where the event occurs */ export interface SunEvent { time: Date; event: SunEventType; location: Waypoint; } /** * Calculates sun events for a given waypoint and date. * * @param waypoint - The waypoint for which to calculate sun events * @param date - The date for which to calculate sun events * @returns An object containing sun event times */ export declare function calculateSunEvents(waypoint: Waypoint, date?: Date): Record<SunEventType, SunEvent>; /** * Determines if a given time is during daylight at the specified waypoint. * * @param waypoint - The waypoint to check for daylight * @param time - The time to check (defaults to current time) * @returns true if the specified time is during daylight (between sunrise and sunset) */ export declare function isDaylight(waypoint: Waypoint, time?: Date): boolean; /** * Determines if a given time is during night at the specified waypoint. * Night is defined as the period between the end of evening civil twilight and the beginning of morning civil twilight. * * @param waypoint - The waypoint to check for night conditions * @param time - The time to check (defaults to current time) * @returns true if the specified time is during night */ export declare function isNight(waypoint: Waypoint, time?: Date): boolean; /** * Calculates sun and moon positions for a given waypoint and time. * * @param waypoint - The waypoint for which to calculate positions * @param time - The time for which to calculate positions * @returns An object containing sun and moon position data */ export declare function getSunAndMoonPositions(waypoint: Waypoint, time?: Date): { sun: { azimuth: number; altitude: number; }; moon: { azimuth: number; altitude: number; illumination: number; phase: number; }; }; /** * Determines if a flight between two waypoints involves night flying. * * @param from - The departure waypoint * @param to - The destination waypoint * @param departureTime - The departure time * @param speed - The ground speed in knots * @returns true if any portion of the flight occurs during night time */ export declare function flightInvolvesNight(from: Waypoint, to: Waypoint, departureTime: Date, speed: number): boolean; /** * Extends a RouteTrip with sun events at departure and destination. * * @param trip - The route trip to extend * @param date - The date for the sun events calculation * @returns The extended route trip with sun events */