]> git.mxchange.org Git - flightgear.git/blob - src/Environment/metarproperties.hxx
Reset: fix OSG stats handling
[flightgear.git] / src / Environment / metarproperties.hxx
1 // metarproperties.hxx -- Parse a METAR and write properties
2 //
3 // Written by David Megginson, started May 2002.
4 // Rewritten by Torsten Dreyer, August 2010
5 //
6 // Copyright (C) 2002  David Megginson - david@megginson.com
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 //
22
23 #ifndef __METARPROPERTIES_HXX
24 #define __METARPROPERTIES_HXX
25
26 #include <Airports/airport.hxx>
27 #include <simgear/props/props.hxx>
28 #include <simgear/props/tiedpropertylist.hxx>
29
30 class FGMetar;
31
32 namespace Environment {
33
34 class MagneticVariation;
35
36 class MetarProperties : public SGReferenced
37 {
38 public:
39     MetarProperties( SGPropertyNode_ptr rootNode );
40     virtual ~MetarProperties();
41
42     SGPropertyNode_ptr get_root_node() const { return _rootNode; }
43     virtual bool isValid() const { return _metarValidNode->getBoolValue(); }
44     virtual const std::string & getStationId() const { return _station_id; }
45     virtual void setStationId( const std::string & value );
46     virtual void setMetar(SGSharedPtr<FGMetar> m);
47
48 private:
49     const char * get_metar() const;
50     void set_metar( const char * metar );
51     
52     const char * get_station_id() const { return _station_id.c_str(); }
53     void set_station_id( const char * value );
54     const char * get_decoded() const { return _decoded.c_str(); }
55     double get_magnetic_variation_deg() const;
56     double get_magnetic_dip_deg() const;
57     double get_wind_from_north_fps() const { return _wind_from_north_fps; }
58     double get_wind_from_east_fps() const { return _wind_from_east_fps; }
59     double get_base_wind_dir() const { return _base_wind_dir; }
60     double get_wind_speed() const { return _wind_speed; }
61     void set_wind_from_north_fps( double value );
62     void set_wind_from_east_fps( double value );
63     void set_base_wind_dir( double value );
64     void set_wind_speed( double value );
65
66     SGSharedPtr<FGMetar> _metar;
67     SGPropertyNode_ptr _rootNode;
68     SGPropertyNode_ptr _metarValidNode;
69     
70     std::string _station_id;
71     double _station_elevation;
72     double _station_latitude;
73     double _station_longitude;
74     double _min_visibility;
75     double _max_visibility;
76     int _base_wind_dir;
77     int _base_wind_range_from;
78     int _base_wind_range_to;
79     double _wind_speed;
80     double _wind_from_north_fps;
81     double _wind_from_east_fps;
82     double _gusts;
83     double _temperature;
84     double _dewpoint;
85     double _humidity;
86     double _pressure;
87     double _sea_level_temperature;
88     double _sea_level_dewpoint;
89     double _sea_level_pressure;
90     double _rain;
91     double _hail;
92     double _snow;
93     bool _snow_cover;
94     std::string _decoded;
95     int _day;
96     int _hour;
97     int _minute;
98     bool _cavok;
99 protected:
100     simgear::TiedPropertyList _tiedProperties;
101     MagneticVariation * _magneticVariation;
102 };
103
104 inline void MetarProperties::set_station_id( const char * value )
105
106     _station_id = value; 
107 }
108
109 } // namespace
110 #endif // __METARPROPERTIES_HXX