]> git.mxchange.org Git - flightgear.git/blob - src/Environment/metarproperties.hxx
Fix stray back-button in Qt launcher
[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     virtual void invalidate();
48
49 private:
50     const char * get_metar() const;
51     void set_metar( const char * metar );
52     
53     const char * get_station_id() const { return _station_id.c_str(); }
54     void set_station_id( const char * value );
55     const char * get_decoded() const { return _decoded.c_str(); }
56     double get_magnetic_variation_deg() const;
57     double get_magnetic_dip_deg() const;
58     double get_wind_from_north_fps() const { return _wind_from_north_fps; }
59     double get_wind_from_east_fps() const { return _wind_from_east_fps; }
60     double get_base_wind_dir() const { return _base_wind_dir; }
61     double get_wind_speed() const { return _wind_speed; }
62     void set_wind_from_north_fps( double value );
63     void set_wind_from_east_fps( double value );
64     void set_base_wind_dir( double value );
65     void set_wind_speed( double value );
66
67     SGSharedPtr<FGMetar> _metar;
68     SGPropertyNode_ptr _rootNode;
69     SGPropertyNode_ptr _metarValidNode;
70     
71     std::string _station_id;
72     double _station_elevation;
73     double _station_latitude;
74     double _station_longitude;
75     double _min_visibility;
76     double _max_visibility;
77     int _base_wind_dir;
78     int _base_wind_range_from;
79     int _base_wind_range_to;
80     double _wind_speed;
81     double _wind_from_north_fps;
82     double _wind_from_east_fps;
83     double _gusts;
84     double _temperature;
85     double _dewpoint;
86     double _humidity;
87     double _pressure;
88     double _sea_level_temperature;
89     double _sea_level_dewpoint;
90     double _sea_level_pressure;
91     double _rain;
92     double _hail;
93     double _snow;
94     bool _snow_cover;
95     std::string _decoded;
96     int _day;
97     int _hour;
98     int _minute;
99     bool _cavok;
100 protected:
101     simgear::TiedPropertyList _tiedProperties;
102     MagneticVariation * _magneticVariation;
103 };
104
105 inline void MetarProperties::set_station_id( const char * value )
106
107     _station_id = value; 
108 }
109
110 } // namespace
111 #endif // __METARPROPERTIES_HXX