22 #define _USE_MATH_DEFINES
27 #include "src/functions/time.h"
43 double deg = rad * (180 / M_PI);
54 double rad = deg * (M_PI / 180);
65 double nm = rad * 3440.06479482;
119 double solarElevation(QDateTime utc_time_point,
double lat,
double lon);
131 int calculateNightTime(
const QString &dept,
const QString &dest, QDateTime departureTime,
int tblk,
int nightAngle);
133 bool isNight(
const QString &icao, QDateTime event_time,
int night_angle);
146 NightTimeValues(
const QString& dept,
const QString& dest,
const QDateTime& departure_time,
int block_minutes,
int night_angle)
148 nightMinutes =
calculateNightTime(dept, dest, departure_time, block_minutes, night_angle);
150 nightTime = OPL::Time::qTimefromMinutes(nightMinutes);
151 totalTime = OPL::Time::qTimefromMinutes(block_minutes);
153 if (nightMinutes == 0) {
154 takeOffNight =
false;
155 landingNight =
false;
157 else if (nightMinutes == block_minutes) {
161 if(isNight(dept, departure_time, night_angle))
164 takeOffNight =
false;
165 if(isNight(dest, departure_time.addSecs(block_minutes * 60), night_angle))
168 landingNight =
false;
172 NightTimeValues(
bool to_night,
bool ldg_night,
int night_minutes, QTime night_time, QTime total_time)
173 : takeOffNight(to_night), landingNight(ldg_night), nightMinutes(night_minutes), nightTime(night_time), totalTime(total_time){};
180 inline bool isAllDay() {
return (!takeOffNight && !landingNight);}
181 inline bool isAllNight() {
return ( takeOffNight && landingNight);}
182 inline bool isDayToNight() {
return (!takeOffNight && landingNight);}
183 inline bool isNightToDay() {
return ( takeOffNight && !landingNight);}
The ACalc namespace provides various functions for calculations that are performed outside of the dat...
Definition: calc.h:34
void updateAutoTimes(int acft_id)
OPL::Calc::updateAutoTimes When the details of an aircraft are changed, this function recalculates de...
Definition: calc.cpp:301
double greatCircleDistanceBetweenAirports(const QString &dept, const QString &dest)
Opl::Calc::greatCircleDistanceBetweenAirports Calculates Great Circle distance between two coordinate...
Definition: calc.cpp:103
int calculateNightTime(const QString &dept, const QString &dest, QDateTime departureTime, int tblk, int nightAngle)
Calculates which portion of a flight was conducted in night conditions.
Definition: calc.cpp:226
double degToRad(double deg)
degToRad Converts degrees to radians
Definition: calc.h:52
void updateNightTimes()
OPL::Calc::updateNightTimes updates the night times in the database, used when changing night angle s...
Definition: calc.cpp:344
QString formatTimeInput(QString user_input)
OPL::Calc::formatTimeInput verifies user input and formats to hh:mm if the output is not a valid time...
Definition: calc.cpp:31
double radToNauticalMiles(double rad)
radToNauticalMiles Convert Radians to nautical miles
Definition: calc.h:63
QVector< QVector< double > > intermediatePointsOnGreatCircle(double lat1, double lon1, double lat2, double lon2, int tblk)
Calculates a list of points (lat,lon) along the Great Circle between two points. The points are space...
Definition: calc.cpp:133
double solarElevation(QDateTime utc_time_point, double lat, double lon)
Calculates solar elevation angle for a given point in time and latitude/longitude coordinates.
Definition: calc.cpp:167
double radToDeg(double rad)
radToDeg Converts radians to degrees
Definition: calc.h:41
double greatCircleDistance(double lat1, double lon1, double lat2, double lon2)
greatCircleDistance Calculates Great Circle distance between two coordinates, return in Radians.
Definition: calc.cpp:84
The NightTimeValues struct encapsulates values relating to night time that are needed by the NewFligh...
Definition: calc.h:144