diff --git a/TODO.md b/TODO.md index 8501880..6ba5199 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,4 @@ -- Reverse engineer FSUIPC .NET onRunway Check +- Reverse engineer FSUIPC .NET onRunway Check to use my solution +- Potentially revert to Header only File lib (NO LINKING) - Update OSXCross Docker image to SDK 11 - Implement ARM64 arch for Plugin diff --git a/file/gate.cpp b/file/gate.cpp index 6f43c92..4c3b04b 100644 --- a/file/gate.cpp +++ b/file/gate.cpp @@ -12,8 +12,7 @@ namespace file std::uint8_t radius) { this->designator = designator; - this->center = {geodata::toRadians(latitude), - geodata::toRadians(longitude)}; + this->center = {latitude, longitude}; this->radius = radius; } diff --git a/file/include/simdata/gate.h b/file/include/simdata/gate.h index 0dac08b..248a460 100644 --- a/file/include/simdata/gate.h +++ b/file/include/simdata/gate.h @@ -21,7 +21,7 @@ namespace file { /* * Representation of gate - * Center in lat/lon radians + * Center in lat/lon degrees * Radius in metres * * UINT8 | CHAR[] | POINT | UINT8 @@ -52,10 +52,9 @@ namespace file inline const std::string to_string() const { std::ostringstream str; - str << "Gate " << this->designator << " at " - << geodata::toDegrees(this->center.latitude) << "N " - << geodata::toDegrees(this->center.longitude) << "E, Radius " - << (int)this->radius; + str << "Gate " << this->designator << " at " << this->center.latitude + << "N " << this->center.longitude << "E, Radius " + << (int)this->radius << "m"; return str.str(); } diff --git a/file/include/simdata/runway.h b/file/include/simdata/runway.h index 3c46e26..6cb1609 100644 --- a/file/include/simdata/runway.h +++ b/file/include/simdata/runway.h @@ -21,19 +21,19 @@ 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 metres * - * UINT8 | CHAR[] | POINT | UINT8 | UINT16 | DOUBLE + * UINT8 | CHAR[] | BOX | UINT8 | UINT16 | DOUBLE * -------+------------+--------+-------+--------+------- - * STRLEN | DESIGNATOR | CENTER | WIDTH | LENGTH | TRUHDG + * STRLEN | DESIGNATOR | BOUNDS | WIDTH | LENGTH | TRUHDG */ class Runway { private: std::string designator; - struct geodata::point center; + struct geodata::box bounds; std::uint8_t width; std::uint16_t length; double trueHeading; @@ -48,7 +48,7 @@ namespace file double width); // From database Runway(std::string designator, - struct geodata::point center, + struct geodata::box bounds, std::uint8_t width, std::uint16_t length, double trueHeading); @@ -58,12 +58,17 @@ namespace file 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) - << "°"; + str << "Runway " << this->designator << " with bounds " + << this->bounds.topLeft.latitude << "N " + << this->bounds.topLeft.longitude << "E, " + << this->bounds.topRight.latitude << "N " + << this->bounds.topRight.longitude << "E, " + << this->bounds.bottomRight.latitude << "N " + << this->bounds.bottomRight.longitude << "E, " + << this->bounds.bottomLeft.latitude << "N " + << this->bounds.bottomLeft.longitude << "E, " + << "Width " << (int)this->width << "m, Length " << this->length + << "m, True Heading " << this->trueHeading << "°"; return str.str(); } diff --git a/file/runway.cpp b/file/runway.cpp index 6349094..82a5e6e 100644 --- a/file/runway.cpp +++ b/file/runway.cpp @@ -19,22 +19,24 @@ namespace file longitudeStart, latitudeEnd, longitudeEnd); - this->trueHeading = geodata::bearingDR(latitudeStart, + this->trueHeading = geodata::bearingDD(latitudeStart, longitudeStart, latitudeEnd, longitudeEnd); - this->center = {geodata::toRadians(latitudeStart), - geodata::toRadians(longitudeStart)}; + this->bounds = geodata::calculateBoxDD({latitudeStart, longitudeStart}, + {latitudeEnd, longitudeEnd}, + this->trueHeading, + this->width); } Runway::Runway(std::string designator, - geodata::point center, + struct geodata::box bounds, std::uint8_t width, std::uint16_t length, double trueHeading) { this->designator = designator; - this->center = center; + this->bounds = bounds; this->width = width; this->length = length; this->trueHeading = trueHeading; @@ -43,7 +45,7 @@ namespace file void Runway::toFile(std::ofstream &out) const { writeString(out, this->designator); - writecenter)>(out, this->center); + writebounds)>(out, this->bounds); writewidth)>(out, this->width); writelength)>(out, this->length); writetrueHeading)>(out, this->trueHeading); diff --git a/file/simDatabase.cpp b/file/simDatabase.cpp index c2feb91..4012cbb 100644 --- a/file/simDatabase.cpp +++ b/file/simDatabase.cpp @@ -68,13 +68,13 @@ namespace file for (int j = 0; j < numRunways; j++) { std::string designator = readString(in); // Center - struct geodata::point center = read(in); + struct geodata::box bounds = read(in); std::uint8_t width = read(in); std::uint16_t length = read(in); double trueHeading = read(in); this->airports[icao].second.emplace_back(designator, - center, + bounds, width, length, trueHeading);