#ifndef GERMANAIRLINESVA_FILE_RUNWAY_H #define GERMANAIRLINESVA_FILE_RUNWAY_H #include #include #include #include #include #include #include #include "geodata.hpp" #include "helpers.hpp" #include "util.hpp" namespace germanairlinesva { namespace file { namespace simdata { /* * Representation of one runway with supplementary information * Heading in radians true * Threshold center in lat/lon radians * Width and length in meters * * UINT8 | CHAR[] | POINT | UINT8 | UINT16 | DOUBLE * -------+------------+--------+-------+--------+------- * STRLEN | DESIGNATOR | CENTER | WIDTH | LENGTH | TRUHDG */ class Runway { private: std::string designator; struct geodata::point center; std::uint8_t width; std::uint16_t length; double trueHeading; 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); void toFile(std::ofstream &out) const; 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) << "°"; return str.str(); } friend inline std::ostream &operator<<(std::ostream &os, const Runway &runway) { return os << runway.to_string(); } }; } // namespace simdata } // namespace file } // namespace germanairlinesva #endif