#ifndef GERMANAIRLINESVA_FILE_GATE_H #define GERMANAIRLINESVA_FILE_GATE_H #include #include #include #include #include #include #include #include #include "geodata.hpp" #include "helpers.hpp" namespace germanairlinesva { namespace file { namespace simdata { /* * Representation of gate * Heading in degrees (0...360) * Radius in metres * * Designator must be null terminated * * UINT8 | CHAR[] | POINT | UINT8 * -------+------------+--------+------- * STRLEN | DESIGNATOR | CENTER | RADIUS */ class Gate { private: std::string designator; struct germanairlinesva::geodata::point center; std::uint8_t radius; public: Gate(std::string designator, struct germanairlinesva::geodata::point center, std::uint8_t radius); void toFile(std::ofstream &out) const; bool contains(germanairlinesva::geodata::point coordinates) const; inline const std::string to_string() const { std::ostringstream str; str << "Gate " << this->designator << " at " << this->center.latitude << "N " << this->center.longitude << "E, Radius " << (int)this->radius; return str.str(); } friend inline std::ostream &operator<<(std::ostream &os, const Gate &gate) { return os << gate.to_string(); } }; } // namespace simdata } // namespace file } // namespace germanairlinesva #endif