Updraft
1.0
Open source glider flight visualisation tool.
|
00001 #ifndef UPDRAFT_SRC_LIBRARIES_OPENAIRSPACE_GEOMETRY_H_ 00002 #define UPDRAFT_SRC_LIBRARIES_OPENAIRSPACE_GEOMETRY_H_ 00003 00004 #include "openairspace_global.h" 00005 00006 namespace OpenAirspace { 00007 00009 struct OPENAIRSPACE_EXPORT Coordinate { 00010 // TODO(Kuba) use Utils::Location 00011 bool valid; 00012 qreal lat; 00013 qreal lon; 00014 }; 00015 00016 typedef Coordinate Position; 00017 00019 class OPENAIRSPACE_EXPORT Geometry { 00020 public : 00026 enum GType { DAtype, DBtype, DCtype, DPtype }; 00027 virtual const Position& Centre() const = 0; 00028 virtual const GType GetGType() const = 0; 00029 virtual ~Geometry() {} 00030 }; 00031 00033 class OPENAIRSPACE_EXPORT Polygon : public Geometry { 00034 public: 00036 Polygon(); 00037 00041 Polygon(const Position& C_, const double& z_); 00042 00044 inline const Position& Centre() const { return *this->centre; } 00045 00047 inline const GType GetGType() const { return DPtype; } 00048 00050 ~Polygon(); 00051 00052 private: 00054 Position* centre; 00055 00057 double zoom; 00058 00060 bool valid; 00061 }; 00062 00064 class OPENAIRSPACE_EXPORT ArcI : public Geometry { 00065 public: 00067 ArcI(); 00068 00076 ArcI(const Position& C_, const double& R_, const bool CW_, 00077 const double& S_, const double& E_, const double& Z_); 00078 00080 inline const Position& Centre() const { return *this->centre; } 00081 00083 inline const double& Start() const { return this->start; } 00084 00086 inline const double& End() const { return this->end; } 00087 00089 inline const bool CW() const { return this->cw; } 00090 00092 inline const double R() const { return this->r; } 00093 00095 inline const GType GetGType() const { return DAtype; } 00096 00098 ~ArcI(); 00099 00100 private: 00102 Position* centre; 00103 00105 double r; 00106 00108 bool cw; 00109 00111 double start; 00112 00114 double end; 00115 00117 double zoom; 00118 00120 bool valid; 00121 }; 00122 00124 class OPENAIRSPACE_EXPORT ArcII : public Geometry { 00125 public: 00127 ArcII(); 00128 00135 ArcII(const Position& C_, const Position& S_, const Position E_, 00136 const bool CW_, const double& Z_); 00137 00139 inline const Position& Centre() const { return *this->centre; } 00140 00142 inline const Position& Start() const { return *this->start; } 00143 00145 inline const Position& End() const { return *this->end; } 00146 00148 inline const bool CW() const { return this->cw; } 00149 00151 inline const GType GetGType() const { return DBtype; } 00152 00154 ~ArcII(); 00155 00156 private: 00158 Position* centre; 00159 00161 Position* start; 00162 00164 Position* end; 00165 00167 bool cw; 00168 00170 double zoom; 00171 00173 bool valid; 00174 }; 00175 00177 class OPENAIRSPACE_EXPORT Circle : public Geometry { 00178 public: 00180 Circle(); 00181 00186 Circle(const Position& C_, const double R_, const double& Z_); 00187 00189 inline const Position& Centre() const { return *this->centre; } 00190 00192 inline const double& R() const { return this->r; } 00193 00195 inline const GType GetGType() const { return DCtype; } 00196 00198 ~Circle(); 00199 00200 private: 00202 Position* centre; 00203 00205 double r; 00206 00208 double zoom; 00209 00211 bool valid; 00212 }; 00213 } // OpenAirspace 00214 #endif // UPDRAFT_SRC_LIBRARIES_OPENAIRSPACE_GEOMETRY_H_