Migrate to radians instead of degrees to lessen conversion errors
This commit is contained in:
@@ -21,11 +21,9 @@ namespace file
|
||||
{
|
||||
/*
|
||||
* Representation of gate
|
||||
* Heading in degrees (0...360)
|
||||
* Center in lat/lon radians
|
||||
* Radius in metres
|
||||
*
|
||||
* Designator must be null terminated
|
||||
*
|
||||
* UINT8 | CHAR[] | POINT | UINT8
|
||||
* -------+------------+--------+-------
|
||||
* STRLEN | DESIGNATOR | CENTER | RADIUS
|
||||
@@ -38,6 +36,12 @@ namespace file
|
||||
std::uint8_t radius;
|
||||
|
||||
public:
|
||||
// From X-Plane or MakeRwys
|
||||
Gate(std::string designator,
|
||||
double latitude,
|
||||
double longitude,
|
||||
std::uint8_t radius);
|
||||
// From Database
|
||||
Gate(std::string designator,
|
||||
struct geodata::point center,
|
||||
std::uint8_t radius);
|
||||
@@ -48,8 +52,9 @@ namespace file
|
||||
inline const std::string to_string() const
|
||||
{
|
||||
std::ostringstream str;
|
||||
str << "Gate " << this->designator << " at " << this->center.latitude
|
||||
<< "N " << this->center.longitude << "E, Radius "
|
||||
str << "Gate " << this->designator << " at "
|
||||
<< geodata::toDegrees(this->center.latitude) << "N "
|
||||
<< geodata::toDegrees(this->center.longitude) << "E, Radius "
|
||||
<< (int)this->radius;
|
||||
return str.str();
|
||||
}
|
||||
|
||||
@@ -21,24 +21,22 @@ namespace file
|
||||
{
|
||||
/*
|
||||
* Representation of one runway with supplementary information
|
||||
* Heading in degrees (0...360) true
|
||||
* Heading in radians true
|
||||
* Threshold center in lat/lon radians
|
||||
* Width and length in meters
|
||||
*
|
||||
* Designator must be null terminated
|
||||
*
|
||||
* UINT8 | CHAR[] | BOX | UINT8 | UINT16 | UINT16
|
||||
* UINT8 | CHAR[] | POINT | UINT8 | UINT16 | DOUBLE
|
||||
* -------+------------+--------+-------+--------+-------
|
||||
* STRLEN | DESIGNATOR | BOUNDS | WIDTH | LENGTH | TRUHDG
|
||||
* STRLEN | DESIGNATOR | CENTER | WIDTH | LENGTH | TRUHDG
|
||||
*/
|
||||
class Runway
|
||||
{
|
||||
private:
|
||||
std::string designator;
|
||||
struct geodata::box bounds;
|
||||
struct geodata::point center;
|
||||
std::uint8_t width;
|
||||
std::uint16_t length;
|
||||
std::uint16_t trueHeading;
|
||||
std::vector<std::uint8_t> file;
|
||||
double trueHeading;
|
||||
|
||||
public:
|
||||
// From X-Plane or MakeRwys
|
||||
@@ -50,27 +48,22 @@ namespace file
|
||||
double width);
|
||||
// From database
|
||||
Runway(std::string designator,
|
||||
struct geodata::box bounds,
|
||||
struct geodata::point center,
|
||||
std::uint8_t width,
|
||||
std::uint16_t length,
|
||||
std::uint16_t trueHeading);
|
||||
double trueHeading);
|
||||
|
||||
void toFile(std::ofstream &out) const;
|
||||
|
||||
inline const std::string to_string() const
|
||||
{
|
||||
std::ostringstream str;
|
||||
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 << "°";
|
||||
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)
|
||||
<< "°";
|
||||
return str.str();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user