]> git.mxchange.org Git - simgear.git/blobdiff - simgear/environment/metar.hxx
Metar: symbolic cloudnames and phenomena exposure
[simgear.git] / simgear / environment / metar.hxx
index a446152d6d44f23bca427cfb5e48ada440c78241..18837284c579a6bde81570fbdbe40527cc875c3c 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 
 #include <simgear/constants.h>
 
-SG_USING_STD(vector);
-SG_USING_STD(map);
-SG_USING_STD(string);
+using std::vector;
+using std::map;
+using std::string;
 
 const double SGMetarNaN = -1E20;
 #define NaN SGMetarNaN
 
 struct Token {
-       char    *id;
-       char    *text;
+       const char *id;
+       const char *text;
 };
 
 
@@ -130,25 +130,30 @@ protected:
 class SGMetarCloud {
        friend class SGMetar;
 public:
-       SGMetarCloud() :
-               _coverage(-1),
-               _altitude(NaN),
-               _type(0),
-               _type_long(0) {}
+    enum Coverage {
+        COVERAGE_NIL = -1,
+        COVERAGE_CLEAR = 0,
+        COVERAGE_FEW = 1,
+        COVERAGE_SCATTERED = 2,
+        COVERAGE_BROKEN = 3,
+        COVERAGE_OVERCAST = 4
+    };
 
-       void set(double alt, int cov = -1);
+       SGMetarCloud() : _coverage(COVERAGE_NIL), _altitude(NaN), _type(0), _type_long(0) {}
 
-       inline int      getCoverage()           const { return _coverage; }
-       inline double   getAltitude_m()         const { return _altitude; }
-       inline double   getAltitude_ft()        const { return _altitude == NaN ? NaN : _altitude * SG_METER_TO_FEET; }
-       inline char     *getTypeString()        const { return _type; }
-       inline char     *getTypeLongString()    const { return _type_long; }
+       void set(double alt, Coverage cov = COVERAGE_NIL );
+
+       inline Coverage getCoverage() const { return _coverage; }
+       inline double getAltitude_m() const { return _altitude; }
+       inline double getAltitude_ft() const { return _altitude == NaN ? NaN : _altitude * SG_METER_TO_FEET; }
+       inline const char *getTypeString() const { return _type; }
+       inline const char *getTypeLongString() const { return _type_long; }
 
 protected:
-       int     _coverage;              // quarters: 0 -> clear ... 4 -> overcast
-       double  _altitude;              // 1000 m
-       char    *_type;                 // CU
-       char    *_type_long;            // cumulus
+       Coverage _coverage;          // quarters: 0 -> clear ... 4 -> overcast
+       double _altitude;       // 1000 m
+       const char *_type;      // CU
+       const char *_type_long; // cumulus
 };
 
 
@@ -165,6 +170,21 @@ public:
                RTD
        };
 
+    enum Intensity {
+        NIL = 0,
+        LIGHT = 1,
+        MODERATE = 2,
+        HEAVY = 3
+    };
+
+    struct Weather {
+        Weather() { intensity = NIL; vincinity = false; }
+        Intensity intensity;
+        bool      vincinity;
+        vector<string> descriptions;
+        vector<string> phenomena;
+    };
+
        inline const char *getData()            const { return _data; }
        inline const char *getUnusedData()      const { return _m; }
        inline const bool getProxy()            const { return _x_proxy; }
@@ -212,6 +232,7 @@ public:
        inline const vector<SGMetarCloud>& getClouds()  const   { return _clouds; }
        inline const map<string, SGMetarRunway>& getRunways()   const   { return _runways; }
        inline const vector<string>& getWeather()               const   { return _weather; }
+    inline const vector<struct Weather> getWeather2()      const   { return _weather2; }
 
 protected:
        string  _url;
@@ -238,6 +259,7 @@ protected:
        int     _hail;
        int     _snow;
        bool    _cavok;
+    vector<struct Weather> _weather2;
 
        SGMetarVisibility               _min_visibility;
        SGMetarVisibility               _max_visibility;