diff --git a/.vscode/settings.json b/.vscode/settings.json index 31ce5a9..aa552db 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -64,6 +64,27 @@ "cinttypes": "cpp", "typeinfo": "cpp", "valarray": "cpp", - "__threading_support": "cpp" + "__threading_support": "cpp", + "__bit_reference": "cpp", + "__bits": "cpp", + "__config": "cpp", + "__debug": "cpp", + "__errc": "cpp", + "__hash_table": "cpp", + "__locale": "cpp", + "__mutex_base": "cpp", + "__node_handle": "cpp", + "__nullptr": "cpp", + "__split_buffer": "cpp", + "__string": "cpp", + "__tree": "cpp", + "__tuple": "cpp", + "compare": "cpp", + "concepts": "cpp", + "ios": "cpp", + "locale": "cpp", + "queue": "cpp", + "stack": "cpp", + "variant": "cpp" }, } \ No newline at end of file diff --git a/TODO.md b/TODO.md index 8501880..2015f5c 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,2 @@ -- Reverse engineer FSUIPC .NET onRunway Check - Update OSXCross Docker image to SDK 11 - Implement ARM64 arch for Plugin diff --git a/file/include/FSUIPC/FsGeoData.h b/file/include/FSUIPC/FsGeoData.h new file mode 100644 index 0000000..f0d26b7 --- /dev/null +++ b/file/include/FSUIPC/FsGeoData.h @@ -0,0 +1,18 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSGEODATA_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSGEODATA_H + +#include "FsLatLonPoint.h" +#include "FsLatLonQuadrilateral.h" +#include "FsLatitude.h" +#include "FsLatitudeSpan.h" +#include "FsLongitude.h" +#include "FsLongitudeSpan.h" + +#include "FsLatLonPointImpl.h" +#include "FsLatLonQuadrilateralImpl.h" +#include "FsLatitudeImpl.h" +#include "FsLatitudeSpanImpl.h" +#include "FsLongitudeImpl.h" +#include "FsLongitudeSpanImpl.h" + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatLonPoint.h b/file/include/FSUIPC/FsLatLonPoint.h new file mode 100644 index 0000000..2afbb81 --- /dev/null +++ b/file/include/FSUIPC/FsLatLonPoint.h @@ -0,0 +1,57 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONPOINT_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONPOINT_H + +#define _USE_MATH_DEFINES + +#include +#include +#include + +#include "FsLatitude.h" +#include "FsLatitudeSpan.h" +#include "FsLongitude.h" +#include "FsLongitudeSpan.h" + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + class FsLatLonPoint + { + private: + FsLatitude lat; + FsLongitude lon; + + public: + inline FsLatLonPoint(); + inline FsLatLonPoint(FsLatitude Latitude, FsLongitude Longitude); + + inline const FsLongitude Longitude() const; + inline const FsLatitude Latitude() const; + + inline double DistanceFromInFeet(const FsLatLonPoint &Point) const; + inline double + DistanceFromInNauticalMiles(const FsLatLonPoint &Point) const; + inline double DistanceFromInMetres(const FsLatLonPoint &Point) const; + + inline double BearingTo(const FsLatLonPoint &Point) const; + inline double BearingFrom(const FsLatLonPoint &Point) const; + + inline FsLatLonPoint OffsetByFeet(double Bearing, + double Distance) const; + inline FsLatLonPoint OffsetByMetres(double Bearing, + double Distance) const; + inline FsLatLonPoint OffsetByNauticalMiles(double Bearing, + double Distance) const; + + inline const std::string to_string(bool HemisphereAsText, + char DetailLevel) const; + inline const std::string to_string() const; + }; + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatLonPointImpl.h b/file/include/FSUIPC/FsLatLonPointImpl.h new file mode 100644 index 0000000..2473076 --- /dev/null +++ b/file/include/FSUIPC/FsLatLonPointImpl.h @@ -0,0 +1,145 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONPOINTIMPL_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONPOINTIMPL_H + +#include "FsLatLonPoint.h" + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + inline FsLatLonPoint::FsLatLonPoint() = default; + inline FsLatLonPoint::FsLatLonPoint(FsLatitude Latitude, + FsLongitude Longitude) + { + this->lon = Longitude; + this->lat = Latitude; + } + + inline const FsLongitude FsLatLonPoint::Longitude() const + { + return this->lon; + } + inline const FsLatitude FsLatLonPoint::Latitude() const + { + return this->lat; + } + + inline double + FsLatLonPoint::DistanceFromInFeet(const FsLatLonPoint &Point) const + { + FsLongitudeSpan fsLongitudeSpan = + FsLongitudeSpan::BetweenTwoLongitudes(Point.Longitude(), this->lon); + double num = (fsLongitudeSpan.ToFeet(this->lat) + + fsLongitudeSpan.ToFeet(Point.lat)) / + 2.0; + double feet = FsLatitudeSpan(Point.Latitude().DecimalDegrees() - + this->lat.DecimalDegrees()) + .ToFeet(); + return sqrt(num * num + feet * feet); + } + inline double FsLatLonPoint::DistanceFromInNauticalMiles( + const FsLatLonPoint &Point) const + { + return this->DistanceFromInFeet(Point) / 6076.1155; + } + inline double + FsLatLonPoint::DistanceFromInMetres(const FsLatLonPoint &Point) const + { + return this->DistanceFromInFeet(Point) / 3.2808; + } + + inline double FsLatLonPoint::BearingTo(const FsLatLonPoint &Point) const + { + double num1 = 0.0; + double num2 = abs(FsLatitudeSpan(this->lat.DecimalDegrees() - + Point.Latitude().DecimalDegrees()) + .ToFeet()); + double num3 = abs((FsLongitudeSpan(Point.Longitude().DecimalDegrees() - + this->lon.DecimalDegrees()) + .ToFeet(this->lat) + + FsLongitudeSpan(Point.Longitude().DecimalDegrees() - + this->lon.DecimalDegrees()) + .ToFeet(Point.lat)) / + 2.0); + if (num2 == 0.0) + num1 = this->lon.DecimalDegrees() > Point.Longitude().DecimalDegrees() + ? 270.0 + : 90.0; + else if (this->lat.DecimalDegrees() < Point.Latitude().DecimalDegrees() && + this->lon.DecimalDegrees() < Point.Longitude().DecimalDegrees()) + num1 = atan(num3 / num2) * 180.0 / M_PI; + else if (this->lat.DecimalDegrees() > Point.Latitude().DecimalDegrees() && + this->lon.DecimalDegrees() < Point.Longitude().DecimalDegrees()) + num1 = atan(num2 / num3) * 180.0 / M_PI + 90.0; + else if (this->lat.DecimalDegrees() > Point.Latitude().DecimalDegrees() && + this->lon.DecimalDegrees() > Point.Longitude().DecimalDegrees()) + num1 = atan(num3 / num2) * 180.0 / M_PI + 180.0; + else if (this->lat.DecimalDegrees() < Point.Latitude().DecimalDegrees() && + this->lon.DecimalDegrees() > Point.Longitude().DecimalDegrees()) + num1 = atan(num2 / num3) * 180.0 / M_PI + 270.0; + return num1; + } + inline double FsLatLonPoint::BearingFrom(const FsLatLonPoint &Point) const + { + double num = 180.0 + this->BearingTo(Point); + if (num >= 360.0) + num -= 360.0; + if (num < 0.0) + num += 360.0; + return num; + } + + inline FsLatLonPoint FsLatLonPoint::OffsetByFeet(double Bearing, + double Distance) const + { + double Feet1 = sin(M_PI * Bearing / 180.0) * Distance; + double Feet2 = cos(M_PI * Bearing / 180.0) * Distance; + FsLatLonPoint fsLatLonPoint = FsLatLonPoint(); + fsLatLonPoint.lat = this->lat.Add(FsLatitudeSpan::FromFeet(Feet2)); + fsLatLonPoint.lon = + this->lon.Add(FsLongitudeSpan::FromFeet(Feet1, fsLatLonPoint.lat)); + return fsLatLonPoint; + } + inline FsLatLonPoint FsLatLonPoint::OffsetByMetres(double Bearing, + double Distance) const + { + double Metres1 = sin(M_PI * Bearing / 180.0) * Distance; + double Metres2 = cos(M_PI * Bearing / 180.0) * Distance; + FsLatLonPoint fsLatLonPoint = FsLatLonPoint(); + fsLatLonPoint.lat = this->lat.Add(FsLatitudeSpan::FromMetres(Metres2)); + fsLatLonPoint.lon = this->lon.Add( + FsLongitudeSpan::FromMetres(Metres1, fsLatLonPoint.lat)); + return fsLatLonPoint; + } + inline FsLatLonPoint + FsLatLonPoint::OffsetByNauticalMiles(double Bearing, + double Distance) const + { + double NauticalMiles1 = sin(M_PI * Bearing / 180.0) * Distance; + double NauticalMiles2 = cos(M_PI * Bearing / 180.0) * Distance; + FsLatLonPoint fsLatLonPoint = FsLatLonPoint(); + fsLatLonPoint.lat = + this->lat.Add(FsLatitudeSpan::FromNauticalMiles(NauticalMiles2)); + fsLatLonPoint.lon = + this->lon.Add(FsLongitudeSpan::FromNauticalMiles(NauticalMiles1, + fsLatLonPoint.lat)); + return fsLatLonPoint; + } + + inline const std::string FsLatLonPoint::to_string(bool HemisphereAsText, + char DetailLevel) const + { + return this->lat.to_string(HemisphereAsText, DetailLevel) + ", " + + this->lon.to_string(HemisphereAsText, DetailLevel); + } + inline const std::string FsLatLonPoint::to_string() const + { + return this->to_string(true, 'm'); + } + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatLonQuadrilateral.h b/file/include/FSUIPC/FsLatLonQuadrilateral.h new file mode 100644 index 0000000..1f83385 --- /dev/null +++ b/file/include/FSUIPC/FsLatLonQuadrilateral.h @@ -0,0 +1,57 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONQUADRILATERAL_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONQUADRILATERAL_H + +#define _USE_MATH_DEFINES + +#include +#include +#include + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + class FsLatitude; + class FsLatitudeSpan; + class FsLongitude; + class FsLongitudeSpan; + class FsLatLonPoint; + class FsLatLonQuadrilateral + { + private: + FsLatLonPoint ne; + FsLatLonPoint se; + FsLatLonPoint sw; + FsLatLonPoint nw; + + public: + inline FsLatLonQuadrilateral(); + inline FsLatLonQuadrilateral(FsLatLonPoint P0, + FsLatLonPoint P1, + FsLatLonPoint P2, + FsLatLonPoint P3); + + inline FsLatLonPoint NE() const; + inline FsLatLonPoint SE() const; + inline FsLatLonPoint SW() const; + inline FsLatLonPoint NW() const; + + inline bool ContainsPoint(FsLatLonPoint point) const; + + inline const std::string to_string(bool HemisphereAsText, + char DetailLevel) const; + inline const std::string to_string() const; + + inline static FsLatLonQuadrilateral + ForRunway(FsLatLonPoint &ThresholdCentre, + double HeadingTrue, + double WidthInFeet, + double LengthInFeet); + }; + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatLonQuadrilateralImpl.h b/file/include/FSUIPC/FsLatLonQuadrilateralImpl.h new file mode 100644 index 0000000..a122fb2 --- /dev/null +++ b/file/include/FSUIPC/FsLatLonQuadrilateralImpl.h @@ -0,0 +1,166 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONQUADRILATERALIMPL_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATLONQUADRILATERALIMPL_H + +#include "FsLatLonQuadrilateral.h" + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + inline FsLatLonQuadrilateral::FsLatLonQuadrilateral() = default; + inline FsLatLonQuadrilateral::FsLatLonQuadrilateral(FsLatLonPoint P0, + FsLatLonPoint P1, + FsLatLonPoint P2, + FsLatLonPoint P3) + { + std::vector fsLatLonPointList1; + std::vector fsLatLonPointList2; + fsLatLonPointList1.push_back(P0); + fsLatLonPointList1.push_back(P1); + fsLatLonPointList1.push_back(P2); + fsLatLonPointList1.push_back(P3); + for (int index1 = 0; index1 < 3; ++index1) { + double num = 0.0; + int index2 = 0; + for (size_t index3 = 0; index3 < fsLatLonPointList1.size(); ++index3) { + if (fsLatLonPointList1[index3].Latitude().UDegrees() > num) { + num = fsLatLonPointList1[index3].Latitude().UDegrees(); + index2 = index3; + } + } + fsLatLonPointList2.push_back(fsLatLonPointList1[index2]); + fsLatLonPointList1.erase(fsLatLonPointList1.begin() + index2); + } + fsLatLonPointList2.push_back(fsLatLonPointList1[0]); + if (fsLatLonPointList2[1].Longitude().UDegrees() > + fsLatLonPointList2[0].Longitude().UDegrees()) { + this->ne = fsLatLonPointList2[1]; + this->nw = fsLatLonPointList2[0]; + } else { + this->ne = fsLatLonPointList2[0]; + this->nw = fsLatLonPointList2[1]; + } + if (fsLatLonPointList2[3].Longitude().UDegrees() > + fsLatLonPointList2[2].Longitude().UDegrees()) { + this->se = fsLatLonPointList2[3]; + this->sw = fsLatLonPointList2[2]; + } else { + this->se = fsLatLonPointList2[2]; + this->sw = fsLatLonPointList2[3]; + } + } + + inline FsLatLonPoint FsLatLonQuadrilateral::NE() const { return this->ne; } + inline FsLatLonPoint FsLatLonQuadrilateral::SE() const { return this->se; } + inline FsLatLonPoint FsLatLonQuadrilateral::SW() const { return this->sw; } + inline FsLatLonPoint FsLatLonQuadrilateral::NW() const { return this->nw; } + + inline bool FsLatLonQuadrilateral::ContainsPoint(FsLatLonPoint point) const + { + bool flag = false; + double udegrees1 = this->nw.Latitude().UDegrees(); + double udegrees2 = this->sw.Latitude().UDegrees(); + double udegrees3 = this->se.Latitude().UDegrees(); + double udegrees4 = this->ne.Latitude().UDegrees(); + double udegrees5 = this->nw.Longitude().UDegrees(); + double udegrees6 = this->sw.Longitude().UDegrees(); + double udegrees7 = this->se.Longitude().UDegrees(); + double udegrees8 = this->ne.Longitude().UDegrees(); + double udegrees9 = point.Longitude().UDegrees(); + double udegrees10 = point.Latitude().UDegrees(); + if (udegrees9 > udegrees5 + (udegrees6 - udegrees5) / + (udegrees1 - udegrees2) * + (udegrees1 - udegrees10) && + udegrees9 < udegrees8 + (udegrees7 - udegrees8) / + (udegrees4 - udegrees3) * + (udegrees4 - udegrees10) && + udegrees10 > udegrees2 + (udegrees3 - udegrees2) / + (udegrees7 - udegrees6) * + (udegrees9 - udegrees6)) + flag = udegrees10 < udegrees1 + (udegrees4 - udegrees1) / + (udegrees8 - udegrees5) * + (udegrees9 - udegrees5); + return flag; + } + + + inline const std::string + FsLatLonQuadrilateral::to_string(bool HemisphereAsText, + char DetailLevel) const + { + return this->ne.to_string(HemisphereAsText, DetailLevel) + ", " + + this->nw.to_string(HemisphereAsText, DetailLevel) + ", " + + this->sw.to_string(HemisphereAsText, DetailLevel) + ", " + + this->se.to_string(HemisphereAsText, DetailLevel); + } + inline const std::string FsLatLonQuadrilateral::to_string() const + { + return this->to_string(true, 'm'); + } + + inline FsLatLonQuadrilateral + FsLatLonQuadrilateral::ForRunway(FsLatLonPoint &ThresholdCentre, + double HeadingTrue, + double WidthInFeet, + double LengthInFeet) + { + double num = M_PI * HeadingTrue / 180.0; + double Feet = cos(num) * WidthInFeet / 2.0; + + double decimalDegrees1 = + FsLatitudeSpan::FromFeet(sin(num) * WidthInFeet / 2.0) + .DecimalDegrees(); + FsLatitude fsLatitude1 = FsLatitude( + ThresholdCentre.Latitude().DecimalDegrees() - decimalDegrees1); + + double decimalDegrees2 = + FsLongitudeSpan::FromFeet(Feet, fsLatitude1).DecimalDegrees(); + FsLongitude Longitude1 = FsLongitude( + ThresholdCentre.Longitude().DecimalDegrees() + decimalDegrees2); + FsLatLonPoint P1 = FsLatLonPoint(fsLatitude1, Longitude1); + fsLatitude1 = FsLatitude(ThresholdCentre.Latitude().DecimalDegrees() + + decimalDegrees1); + + double decimalDegrees3 = + FsLongitudeSpan::FromFeet(Feet, fsLatitude1).DecimalDegrees(); + Longitude1 = FsLongitude(ThresholdCentre.Longitude().DecimalDegrees() - + decimalDegrees3); + FsLatLonPoint P0 = FsLatLonPoint(fsLatitude1, Longitude1); + + double decimalDegrees4 = + FsLatitudeSpan::FromFeet(cos(num) * LengthInFeet).DecimalDegrees(); + FsLatitude fsLatitude2 = FsLatitude( + ThresholdCentre.Latitude().DecimalDegrees() + decimalDegrees4); + + double decimalDegrees5 = + FsLongitudeSpan ::FromFeet(sin(num) * LengthInFeet, fsLatitude2) + .DecimalDegrees(); + FsLongitude Longitude2 = FsLongitude( + ThresholdCentre.Longitude().DecimalDegrees() + decimalDegrees5); + FsLatLonPoint fsLatLonPoint = FsLatLonPoint(fsLatitude2, Longitude2); + fsLatitude1 = FsLatitude(fsLatLonPoint.Latitude().DecimalDegrees() - + decimalDegrees1); + + double decimalDegrees6 = + FsLongitudeSpan::FromFeet(Feet, fsLatitude1).DecimalDegrees(); + Longitude1 = FsLongitude(fsLatLonPoint.Longitude().DecimalDegrees() + + decimalDegrees6); + FsLatLonPoint P3 = FsLatLonPoint(fsLatitude1, Longitude1); + fsLatitude1 = FsLatitude(fsLatLonPoint.Latitude().DecimalDegrees() + + decimalDegrees1); + + double decimalDegrees7 = + FsLongitudeSpan::FromFeet(Feet, fsLatitude1).DecimalDegrees(); + Longitude1 = FsLongitude(fsLatLonPoint.Longitude().DecimalDegrees() - + decimalDegrees7); + FsLatLonPoint P2 = FsLatLonPoint(fsLatitude1, Longitude1); + + return FsLatLonQuadrilateral(P0, P1, P2, P3); + } + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatitude.h b/file/include/FSUIPC/FsLatitude.h new file mode 100644 index 0000000..17f8555 --- /dev/null +++ b/file/include/FSUIPC/FsLatitude.h @@ -0,0 +1,60 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDE_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDE_H + +#include +#include +#include +#include + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + class FsLatitudeSpan; + class FsLatitude + { + private: + double pos; + + public: + inline FsLatitude(); + inline FsLatitude(double DecimalDegrees); + inline FsLatitude(std::int64_t FSUnits); + inline FsLatitude(std::int32_t FSUnits); + inline FsLatitude(std::int32_t Degrees, double DecimalMinutes); + inline FsLatitude(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds); + + inline std::int64_t ToFSUnits8() const; + inline std::int32_t ToFSUnits4() const; + + inline double DecimalDegrees() const; + inline double DecimalMinutes() const; + inline double DecimalSeconds() const; + + inline std::int32_t Degree() const; + inline std::int32_t Minute() const; + inline std::int32_t Second() const; + + inline double UDegrees() const; + + inline const std::string to_string(bool HemisphereAsText, + char DetailLevel) const; + inline const std::string to_string() const; + + inline FsLatitude Add(const FsLatitudeSpan &Distance) const; + inline FsLatitude Subtract(const FsLatitudeSpan &Distance) const; + + inline FsLatitude AddDegrees(double Degrees) const; + inline FsLatitude AddMinutes(double Minutes) const; + inline FsLatitude AddSeconds(double Seconds) const; + }; + + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatitudeImpl.h b/file/include/FSUIPC/FsLatitudeImpl.h new file mode 100644 index 0000000..b69a30a --- /dev/null +++ b/file/include/FSUIPC/FsLatitudeImpl.h @@ -0,0 +1,129 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDEIMPL_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDEIMPL_H + +#include "FsLatitude.h" + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + inline FsLatitude::FsLatitude() = default; + inline FsLatitude::FsLatitude(double DecimalDegrees) + { + this->pos = DecimalDegrees; + while (this->pos > 90.0 || this->pos < -90.0) { + if (this->pos > 90.0) + this->pos = 180.0 - this->pos; + if (this->pos < -90.0) + this->pos = -180.0 - this->pos; + } + } + + inline FsLatitude::FsLatitude(std::int64_t FSUnits) + : FsLatitude(FSUnits * 90.0 / 4.2957189152768E+16) + { + } + inline FsLatitude::FsLatitude(std::int32_t FSUnits) + : FsLatitude(FSUnits * 90.0 / 10001750.0) + { + } + inline FsLatitude::FsLatitude(std::int32_t Degrees, double DecimalMinutes) + : FsLatitude(Degrees + DecimalMinutes / 60.0) + { + } + inline FsLatitude::FsLatitude(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds) + : FsLatitude(Degrees + Minutes / 60.0 + DecimalSeconds / 3600.0) + { + } + + inline std::int64_t FsLatitude::ToFSUnits8() const + { + return this->pos * 4.2957189152768E+16 / 90.0; + } + inline std::int32_t FsLatitude::ToFSUnits4() const + { + return this->pos * 10001750.0 / 90.0; + } + + inline double FsLatitude::DecimalDegrees() const { return this->pos; } + inline double FsLatitude::DecimalMinutes() const + { + return (this->pos - trunc(this->pos)) * 60.0; + } + inline double FsLatitude::DecimalSeconds() const + { + double decimalMinutes = this->DecimalMinutes(); + return (decimalMinutes - trunc(decimalMinutes)) * 60.0; + } + + inline std::int32_t FsLatitude::Degree() const { return trunc(this->pos); } + inline std::int32_t FsLatitude::Minute() const + { + return trunc(this->DecimalMinutes()); + } + inline std::int32_t FsLatitude::Second() const + { + return trunc(this->DecimalSeconds()); + } + + inline double FsLatitude::UDegrees() const { return this->pos + 90.0; } + + inline const std::string FsLatitude::to_string(bool HemisphereAsText, + char DetailLevel) const + { + std::ostringstream str; + if (!HemisphereAsText) { + str << (this->pos < 0.0 ? "-" : ""); + } else { + str << (this->pos < 0.0 ? "S" : "N"); + } + + switch (DetailLevel) { + case 'm': + str << this->Degree() << "° " << this->DecimalMinutes() << "'"; + break; + case 's': + str << this->Degree() << "° " << this->Minute() << "' " + << this->DecimalSeconds() << "\""; + break; + default: + str << this->pos << "*"; + break; + } + return str.str(); + } + inline const std::string FsLatitude::to_string() const + { + return this->to_string(true, 'm'); + } + + inline FsLatitude FsLatitude::Add(const FsLatitudeSpan &Distance) const + { + return FsLatitude(this->pos + Distance.DecimalDegrees()); + } + inline FsLatitude FsLatitude::Subtract(const FsLatitudeSpan &Distance) const + { + return FsLatitude(this->pos - Distance.DecimalDegrees()); + } + + inline FsLatitude FsLatitude::AddDegrees(double Degrees) const + { + return FsLatitude(this->pos + Degrees); + } + inline FsLatitude FsLatitude::AddMinutes(double Minutes) const + { + return FsLatitude(this->pos + Minutes / 60.0); + } + inline FsLatitude FsLatitude::AddSeconds(double Seconds) const + { + return FsLatitude(this->pos + Seconds / 3600.0); + } + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatitudeSpan.h b/file/include/FSUIPC/FsLatitudeSpan.h new file mode 100644 index 0000000..e6a2f67 --- /dev/null +++ b/file/include/FSUIPC/FsLatitudeSpan.h @@ -0,0 +1,58 @@ + +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDESPAN_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDESPAN_H + +#include +#include +#include +#include + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + class FsLatitude; + class FsLatitudeSpan + { + private: + double span; + + public: + inline FsLatitudeSpan(); + inline FsLatitudeSpan(double DecimalDegrees); + inline FsLatitudeSpan(std::int32_t Degrees, double DecimalMinutes); + inline FsLatitudeSpan(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds); + + inline static FsLatitudeSpan FromFeet(double Feet); + inline static FsLatitudeSpan FromNauticalMiles(double NauticalMiles); + inline static FsLatitudeSpan FromMetres(double Metres); + inline static FsLatitudeSpan + BetweenTwoLatitides(const FsLatitude &Lat1, const FsLatitude &Lat2); + + inline double DecimalDegrees() const; + inline double DecimalMinutes() const; + inline double DecimalSeconds() const; + + inline std::int32_t Degrees() const; + inline std::int32_t Minutes() const; + inline std::int32_t Seconds() const; + + inline double TotalMinutes() const; + inline double TotalSeconds() const; + + inline double ToFeet() const; + inline double ToNauticalMiles() const; + inline double ToMetres() const; + + inline const std::string to_string(char DetailLevel) const; + inline const std::string to_string(); + }; + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLatitudeSpanImpl.h b/file/include/FSUIPC/FsLatitudeSpanImpl.h new file mode 100644 index 0000000..d833dfd --- /dev/null +++ b/file/include/FSUIPC/FsLatitudeSpanImpl.h @@ -0,0 +1,121 @@ + +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDESPANIMPL_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDESPANIMPL_H + +#include "FsLatitudeSpan.h" + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + inline FsLatitudeSpan::FsLatitudeSpan() = default; + inline FsLatitudeSpan::FsLatitudeSpan(double DecimalDegrees) + { + this->span = DecimalDegrees; + } + inline FsLatitudeSpan::FsLatitudeSpan(std::int32_t Degrees, + double DecimalMinutes) + : FsLatitudeSpan(Degrees + DecimalMinutes / 60.0) + { + } + inline FsLatitudeSpan::FsLatitudeSpan(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds) + : FsLatitudeSpan(Degrees + Minutes / 60.0 + DecimalSeconds / 3600.0) + { + } + + inline FsLatitudeSpan FsLatitudeSpan::FromFeet(double Feet) + { + return FsLatitudeSpan(Feet / 364601.4567); + } + inline FsLatitudeSpan + FsLatitudeSpan::FromNauticalMiles(double NauticalMiles) + { + return FsLatitudeSpan::FromFeet(NauticalMiles * 6076.1155); + } + inline FsLatitudeSpan FsLatitudeSpan::FromMetres(double Metres) + { + return FsLatitudeSpan::FromFeet(Metres * 3.2808); + } + inline FsLatitudeSpan + FsLatitudeSpan::BetweenTwoLatitides(const FsLatitude &Lat1, + const FsLatitude &Lat2) + { + return FsLatitudeSpan(abs(Lat2.UDegrees() - Lat1.UDegrees())); + } + + inline double FsLatitudeSpan::DecimalDegrees() const { return this->span; } + inline double FsLatitudeSpan::DecimalMinutes() const + { + return (this->span - trunc(this->span)) * 60.0; + } + inline double FsLatitudeSpan::DecimalSeconds() const + { + double decimalMinutes = this->DecimalMinutes(); + return (decimalMinutes - trunc(decimalMinutes)) * 60.0; + } + + inline std::int32_t FsLatitudeSpan::Degrees() const + { + return trunc(this->span); + } + inline std::int32_t FsLatitudeSpan::Minutes() const + { + return trunc(this->DecimalMinutes()); + } + inline std::int32_t FsLatitudeSpan::Seconds() const + { + return trunc(this->DecimalSeconds()); + } + + inline double FsLatitudeSpan::TotalMinutes() const + { + return this->span * 60.0; + } + inline double FsLatitudeSpan::TotalSeconds() const + { + return this->span * 3600.0; + } + + inline double FsLatitudeSpan::ToFeet() const + { + return 364601.4567 * this->span; + } + inline double FsLatitudeSpan::ToNauticalMiles() const + { + return this->ToFeet() / 6076.1155; + } + inline double FsLatitudeSpan::ToMetres() const + { + return this->ToFeet() / 3.2808; + } + + inline const std::string FsLatitudeSpan::to_string(char DetailLevel) const + { + std::ostringstream str; + switch (DetailLevel) { + case 'm': + str << this->Degrees() << "* " << this->DecimalMinutes() << "'"; + break; + case 's': + str << this->Degrees() << "* " << this->Minutes() << "' " + << this->DecimalSeconds() << "\""; + break; + default: + str << this->span << "*"; + break; + } + return str.str(); + } + inline const std::string FsLatitudeSpan::to_string() + { + return this->to_string('m'); + } + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLongitude.h b/file/include/FSUIPC/FsLongitude.h new file mode 100644 index 0000000..f91346f --- /dev/null +++ b/file/include/FSUIPC/FsLongitude.h @@ -0,0 +1,60 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDE_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDE_H + +#include +#include +#include +#include + + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + class FsLongitudeSpan; + class FsLongitude + { + private: + double pos; + + public: + inline FsLongitude(); + inline FsLongitude(double DecimalDegrees); + inline FsLongitude(std::int64_t FSUnits); + inline FsLongitude(std::int32_t FSUnits); + inline FsLongitude(std::int32_t Degrees, double DecimalMinutes); + inline FsLongitude(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds); + + inline long ToFSUnits8() const; + inline std::int32_t ToFSUnits4() const; + + inline double DecimalDegrees() const; + + inline double DecimalMinutes() const; + inline double DecimalSeconds() const; + + inline std::int32_t Degree() const; + inline std::int32_t Minute() const; + inline std::int32_t Second() const; + + inline double UDegrees() const; + + inline const std::string to_string(bool HemisphereAsText, + char DetailLevel) const; + inline const std::string to_string() const; + inline FsLongitude Add(const FsLongitudeSpan &Distance) const; + inline FsLongitude Subtract(const FsLongitudeSpan &Distance) const; + + inline FsLongitude AddDegrees(double Degrees) const; + inline FsLongitude AddMinutes(double Minutes) const; + inline FsLongitude AddSeconds(double Seconds) const; + }; + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLongitudeImpl.h b/file/include/FSUIPC/FsLongitudeImpl.h new file mode 100644 index 0000000..56d60f2 --- /dev/null +++ b/file/include/FSUIPC/FsLongitudeImpl.h @@ -0,0 +1,133 @@ +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDEIMPL_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDEIMPL_H + +#include "FsLongitude.h" + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + inline FsLongitude::FsLongitude() = default; + inline FsLongitude::FsLongitude(double DecimalDegrees) + { + this->pos = DecimalDegrees; + while (this->pos < -180.0 || this->pos > 180.0) { + if (this->pos > 180.0) + this->pos -= 360.0; + if (this->pos < -180.0) + this->pos += 360.0; + } + } + inline FsLongitude::FsLongitude(std::int64_t FSUnits) + : FsLongitude(FSUnits * 360.0 / 1.8446744073709552E+19) + { + } + inline FsLongitude::FsLongitude(std::int32_t FSUnits) + : FsLongitude(FSUnits * 360.0 / 4294967296.0) + { + } + inline FsLongitude::FsLongitude(std::int32_t Degrees, double DecimalMinutes) + : FsLongitude(Degrees + DecimalMinutes / 60.0) + { + } + inline FsLongitude::FsLongitude(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds) + : FsLongitude(Degrees + Minutes / 60.0 + DecimalSeconds / 3600.0) + { + } + + inline long FsLongitude::ToFSUnits8() const + { + return this->pos * 1.8446744073709552E+19 / 360.0; + } + inline std::int32_t FsLongitude::ToFSUnits4() const + { + return this->pos * 4294967296.0 / 360.0; + } + + inline double FsLongitude::DecimalDegrees() const { return this->pos; } + + inline double FsLongitude::DecimalMinutes() const + { + return (this->pos - trunc(this->pos)) * 60.0; + } + inline double FsLongitude::DecimalSeconds() const + { + double decimalMinutes = this->DecimalMinutes(); + return (decimalMinutes - trunc(decimalMinutes)) * 60.0; + } + + inline std::int32_t FsLongitude::Degree() const + { + return trunc(this->DecimalDegrees()); + } + inline std::int32_t FsLongitude::Minute() const + { + return trunc(this->DecimalMinutes()); + } + inline std::int32_t FsLongitude::Second() const + { + return trunc(this->DecimalSeconds()); + } + + inline double FsLongitude::UDegrees() const { return this->pos + 180.0; } + + inline const std::string FsLongitude::to_string(bool HemisphereAsText, + char DetailLevel) const + { + std::ostringstream str; + if (!HemisphereAsText) { + str << (this->pos < 0.0 ? "-" : ""); + } else { + str << (this->pos < 0.0 ? "W" : "E"); + } + + switch (DetailLevel) { + case 'm': + str << this->Degree() << "° " << this->DecimalMinutes() << "'"; + break; + case 's': + str << this->Degree() << "° " << this->Minute() << "' " + << this->DecimalSeconds() << "\""; + break; + default: + str << this->pos << "*"; + break; + } + return str.str(); + } + inline const std::string FsLongitude::to_string() const + { + return this->to_string(true, 'm'); + } + + inline FsLongitude FsLongitude::Add(const FsLongitudeSpan &Distance) const + { + return FsLongitude(this->pos + Distance.DecimalDegrees()); + } + inline FsLongitude + FsLongitude::Subtract(const FsLongitudeSpan &Distance) const + { + return FsLongitude(this->pos - Distance.DecimalDegrees()); + } + + inline FsLongitude FsLongitude::AddDegrees(double Degrees) const + { + return FsLongitude(this->pos + Degrees); + } + inline FsLongitude FsLongitude::AddMinutes(double Minutes) const + { + return FsLongitude(this->pos + Minutes / 60.0); + } + inline FsLongitude FsLongitude::AddSeconds(double Seconds) const + { + return FsLongitude(this->pos + Seconds / 3600.0); + } + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLongitudeSpan.h b/file/include/FSUIPC/FsLongitudeSpan.h new file mode 100644 index 0000000..22bbed0 --- /dev/null +++ b/file/include/FSUIPC/FsLongitudeSpan.h @@ -0,0 +1,65 @@ + +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDESPAN_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDESPAN_H + +#define _USE_MATH_DEFINES + +#include +#include +#include +#include + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + class FsLongitude; + class FsLatitude; + class FsLongitudeSpan + { + private: + double span; + + public: + inline FsLongitudeSpan(); + inline FsLongitudeSpan(double DecimalDegrees); + inline FsLongitudeSpan(std::int32_t Degrees, double DecimalMinutes); + inline FsLongitudeSpan(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds); + inline static FsLongitudeSpan FromFeet(double Feet, + const FsLatitude &AtLatitude); + inline static FsLongitudeSpan + FromNauticalMiles(double NauticalMiles, + const FsLatitude &AtLatitude); + inline static FsLongitudeSpan FromMetres(double Metres, + const FsLatitude &AtLatitude); + inline static FsLongitudeSpan + BetweenTwoLongitudes(const FsLongitude &Lon1, + const FsLongitude &Lon2); + + inline double DecimalDegrees() const; + inline double DecimalMinutes() const; + inline double DecimalSeconds() const; + + inline std::int32_t Degrees() const; + inline std::int32_t Minutes() const; + inline std::int32_t Seconds() const; + + inline double TotalMinutes() const; + inline double TotalSeconds() const; + + inline double ToFeet(const FsLatitude &AtLatitude) const; + inline double ToNauticalMiles(const FsLatitude &AtLatitude) const; + inline double ToMetres(const FsLatitude &AtLatitude) const; + + inline const std::string to_string(char DetailLevel) const; + inline const std::string to_string(); + }; + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/FSUIPC/FsLongitudeSpanImpl.h b/file/include/FSUIPC/FsLongitudeSpanImpl.h new file mode 100644 index 0000000..f13c4d7 --- /dev/null +++ b/file/include/FSUIPC/FsLongitudeSpanImpl.h @@ -0,0 +1,133 @@ + +#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDESPANIMPL_H +#define GERMANAIRLINESVA_FILE_FSUIPC_FSLONGITUDESPANIMPL_H + +#include "FsLongitudeSpan.h" + +namespace germanairlinesva +{ +namespace file +{ + namespace FSUIPC + { + inline FsLongitudeSpan::FsLongitudeSpan() = default; + inline FsLongitudeSpan::FsLongitudeSpan(double DecimalDegrees) + { + this->span = DecimalDegrees; + } + inline FsLongitudeSpan::FsLongitudeSpan(std::int32_t Degrees, + double DecimalMinutes) + : FsLongitudeSpan(Degrees + DecimalMinutes / 60.0) + { + } + inline FsLongitudeSpan::FsLongitudeSpan(std::int32_t Degrees, + std::int32_t Minutes, + double DecimalSeconds) + : FsLongitudeSpan(Degrees + Minutes / 60.0 + DecimalSeconds / 3600.0) + { + } + + inline FsLongitudeSpan + FsLongitudeSpan::FromFeet(double Feet, const FsLatitude &AtLatitude) + { + double num = + cos(M_PI * AtLatitude.DecimalDegrees() / 180.0) * 131479672.3 / 360.0; + return FsLongitudeSpan(Feet / num); + } + inline FsLongitudeSpan + FsLongitudeSpan::FromNauticalMiles(double NauticalMiles, + const FsLatitude &AtLatitude) + { + return FsLongitudeSpan::FromFeet(NauticalMiles * 6076.1155, AtLatitude); + } + inline FsLongitudeSpan + FsLongitudeSpan::FromMetres(double Metres, const FsLatitude &AtLatitude) + { + return FsLongitudeSpan::FromFeet(Metres * 3.2808, AtLatitude); + } + inline FsLongitudeSpan + FsLongitudeSpan::BetweenTwoLongitudes(const FsLongitude &Lon1, + const FsLongitude &Lon2) + { + return fmod(Lon2.UDegrees() - Lon1.UDegrees(), 360.0) < + fmod(Lon1.UDegrees() - Lon2.UDegrees(), 360.0) + ? FsLongitudeSpan( + fmod(Lon2.UDegrees() - Lon1.UDegrees(), 360.0)) + : FsLongitudeSpan( + fmod(Lon1.UDegrees() - Lon2.UDegrees(), 360.0)); + } + + inline double FsLongitudeSpan::DecimalDegrees() const { return this->span; } + inline double FsLongitudeSpan::DecimalMinutes() const + { + return (this->span - trunc(this->span)) * 60.0; + } + inline double FsLongitudeSpan::DecimalSeconds() const + { + double decimalMinutes = this->DecimalMinutes(); + return (decimalMinutes - trunc(decimalMinutes)) * 60.0; + } + + inline std::int32_t FsLongitudeSpan::Degrees() const + { + return trunc(this->span); + } + inline std::int32_t FsLongitudeSpan::Minutes() const + { + return trunc(this->DecimalMinutes()); + } + inline std::int32_t FsLongitudeSpan::Seconds() const + { + return trunc(this->DecimalSeconds()); + } + + inline double FsLongitudeSpan::TotalMinutes() const + { + return this->span * 60.0; + } + inline double FsLongitudeSpan::TotalSeconds() const + { + return this->span * 3600.0; + } + + inline double FsLongitudeSpan::ToFeet(const FsLatitude &AtLatitude) const + { + return cos(M_PI * AtLatitude.DecimalDegrees() / 180.0) * 131479672.3 / + 360.0 * this->span; + } + inline double + FsLongitudeSpan::ToNauticalMiles(const FsLatitude &AtLatitude) const + { + return this->ToFeet(AtLatitude) / 6076.1155; + } + inline double FsLongitudeSpan::ToMetres(const FsLatitude &AtLatitude) const + { + return this->ToFeet(AtLatitude) / 3.2808; + } + + inline const std::string FsLongitudeSpan::to_string(char DetailLevel) const + { + std::ostringstream str; + switch (DetailLevel) { + case 'm': + str << this->Degrees() << "* " << this->DecimalMinutes() << "'"; + break; + case 's': + str << this->Degrees() << "* " << this->Minutes() << "' " + << this->DecimalSeconds() << "\""; + break; + default: + str << this->span << "*"; + break; + } + return str.str(); + } + inline const std::string FsLongitudeSpan::to_string() + { + return this->to_string('m'); + } + } // namespace FSUIPC +} // namespace file +} // namespace germanairlinesva + +#endif \ No newline at end of file diff --git a/file/include/simdata/runway.h b/file/include/simdata/runway.h index 3c46e26..938ae1e 100644 --- a/file/include/simdata/runway.h +++ b/file/include/simdata/runway.h @@ -1,5 +1,5 @@ -#ifndef GERMANAIRLINESVA_FILE_RUNWAY_H -#define GERMANAIRLINESVA_FILE_RUNWAY_H +#ifndef GERMANAIRLINESVA_FILE_SIMDATA_RUNWAY_H +#define GERMANAIRLINESVA_FILE_SIMDATA_RUNWAY_H #include #include @@ -9,6 +9,7 @@ #include #include +#include "FSUIPC/FsGeoData.h" #include "geodata.hpp" #include "helpers.hpp" #include "util.hpp" @@ -21,9 +22,9 @@ namespace file { /* * Representation of one runway with supplementary information - * Heading in radians true - * Threshold center in lat/lon radians - * Width and length in meters + * Heading in degrees true + * Threshold center in lat/lon degrees + * Width and length in feet * * UINT8 | CHAR[] | POINT | UINT8 | UINT16 | DOUBLE * -------+------------+--------+-------+--------+------- @@ -38,32 +39,76 @@ namespace file std::uint16_t length; double trueHeading; + // QUAD TEST + FSUIPC::FsLatLonQuadrilateral quad; + public: // From X-Plane or MakeRwys - Runway(std::string designator, - double latitudeStart, - double longitudeStart, - double latitudeEnd, - double longitudeEnd, - double width); - // From database - Runway(std::string designator, - struct geodata::point center, - std::uint8_t width, - std::uint16_t length, - double trueHeading); + inline Runway(std::string designator, + double latitudeStart, + double longitudeStart, + double latitudeEnd, + double longitudeEnd, + double width) + { + this->designator = designator; + this->width = width * 33.280839895; - void toFile(std::ofstream &out) const; + + this->length = geodata::distanceEarthD(latitudeStart, + longitudeStart, + latitudeEnd, + longitudeEnd) * + 3.280839895; + this->trueHeading = geodata::bearingDD(latitudeStart, + longitudeStart, + latitudeEnd, + longitudeEnd); + this->center = {latitudeStart, longitudeStart}; + + FSUIPC::FsLatLonPoint threshold(latitudeStart, longitudeStart); + quad = FSUIPC::FsLatLonQuadrilateral::ForRunway(threshold, + this->trueHeading, + this->width, + this->length); + } + // From database + inline Runway(std::string designator, + struct geodata::point center, + std::uint8_t width, + std::uint16_t length, + double trueHeading) + { + this->designator = designator; + this->center = center; + this->width = width; + this->length = length; + this->trueHeading = trueHeading; + + FSUIPC::FsLatLonPoint threshold(center.latitude, center.longitude); + quad = FSUIPC::FsLatLonQuadrilateral::ForRunway(threshold, + trueHeading, + width, + length); + } + + inline void toFile(std::ofstream &out) const + { + writeString(out, this->designator); + writecenter)>(out, this->center); + writewidth)>(out, this->width); + writelength)>(out, this->length); + writetrueHeading)>(out, this->trueHeading); + } inline const std::string to_string() const { std::ostringstream str; str << "Runway " << this->designator << " with threshold center " - << geodata::toDegrees(this->center.latitude) << "N " - << geodata::toDegrees(this->center.longitude) << "E, Width " - << (int)this->width << "m, Length " << this->length - << "m, True Heading " << geodata::toDegrees(this->trueHeading) - << "°"; + << this->center.latitude << "N " << this->center.longitude + << "E, Width " << (int)this->width << "ft, Length " + << this->length << "ft, True Heading " << this->trueHeading + << "°, Quad " << quad.to_string(true, ' '); return str.str(); } diff --git a/file/runway.cpp b/file/runway.cpp deleted file mode 100644 index 6349094..0000000 --- a/file/runway.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "simdata/runway.h" - -namespace germanairlinesva -{ -namespace file -{ - namespace simdata - { - Runway::Runway(std::string designator, - double latitudeStart, - double longitudeStart, - double latitudeEnd, - double longitudeEnd, - double width) - { - this->designator = designator; - this->width = width; - this->length = geodata::distanceEarthD(latitudeStart, - longitudeStart, - latitudeEnd, - longitudeEnd); - this->trueHeading = geodata::bearingDR(latitudeStart, - longitudeStart, - latitudeEnd, - longitudeEnd); - this->center = {geodata::toRadians(latitudeStart), - geodata::toRadians(longitudeStart)}; - } - - Runway::Runway(std::string designator, - geodata::point center, - std::uint8_t width, - std::uint16_t length, - double trueHeading) - { - this->designator = designator; - this->center = center; - this->width = width; - this->length = length; - this->trueHeading = trueHeading; - } - - void Runway::toFile(std::ofstream &out) const - { - writeString(out, this->designator); - writecenter)>(out, this->center); - writewidth)>(out, this->width); - writelength)>(out, this->length); - writetrueHeading)>(out, this->trueHeading); - } - } // namespace simdata -} // namespace file -} // namespace germanairlinesva \ No newline at end of file