Revert Radians sinec FSUIPC uses Degrees
This commit is contained in:
parent
115e4d9265
commit
488fcb87cc
3
TODO.md
3
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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
write<decltype(this->center)>(out, this->center);
|
||||
write<decltype(this->bounds)>(out, this->bounds);
|
||||
write<decltype(this->width)>(out, this->width);
|
||||
write<decltype(this->length)>(out, this->length);
|
||||
write<decltype(this->trueHeading)>(out, this->trueHeading);
|
||||
|
||||
@ -68,13 +68,13 @@ namespace file
|
||||
for (int j = 0; j < numRunways; j++) {
|
||||
std::string designator = readString(in);
|
||||
// Center
|
||||
struct geodata::point center = read<struct geodata::point>(in);
|
||||
struct geodata::box bounds = read<struct geodata::box>(in);
|
||||
std::uint8_t width = read<std::uint8_t>(in);
|
||||
std::uint16_t length = read<std::uint16_t>(in);
|
||||
double trueHeading = read<double>(in);
|
||||
|
||||
this->airports[icao].second.emplace_back(designator,
|
||||
center,
|
||||
bounds,
|
||||
width,
|
||||
length,
|
||||
trueHeading);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user