]> git.mxchange.org Git - flightgear.git/blob - src/Environment/metarproperties.hxx
Merge branch 'next' of http://git.gitorious.org/fg/flightgear into next
[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/simple.hxx>
27 #include <simgear/props/props.hxx>
28 #include "tiedpropertylist.hxx"
29
30 namespace Environment {
31
32 class MagneticVariation;
33
34 class MetarProperties : public SGReferenced
35 {
36 public:
37     MetarProperties( SGPropertyNode_ptr rootNode );
38     virtual ~MetarProperties();
39
40     SGPropertyNode_ptr get_root_node() const { return _rootNode; }
41     virtual bool isValid() const { return _metarValidNode->getBoolValue(); }
42     virtual const std::string & getStationId() const { return _station_id; }
43     virtual void setStationId( const std::string & value );
44     virtual void setMetar( const std::string & value ) { set_metar( value.c_str() ); }
45
46 private:
47     const char * get_metar() const { return _metar.c_str(); }
48     void set_metar( const char * metar );
49     const char * get_station_id() const { return _station_id.c_str(); }
50     void set_station_id( const char * value );
51     const char * get_decoded() const { return _decoded.c_str(); }
52     double get_magnetic_variation_deg() const;
53     double get_magnetic_dip_deg() const;
54
55     SGPropertyNode_ptr _rootNode;
56     SGPropertyNode_ptr _metarValidNode;
57     std::string _metar;
58     std::string _station_id;
59     double _station_elevation;
60     double _station_latitude;
61     double _station_longitude;
62     double _min_visibility;
63     double _max_visibility;
64     int _base_wind_dir;
65     int _base_wind_range_from;
66     int _base_wind_range_to;
67     double _wind_speed;
68     double _wind_from_north_fps;
69     double _wind_from_east_fps;
70     double _gusts;
71     double _temperature;
72     double _dewpoint;
73     double _humidity;
74     double _pressure;
75     double _sea_level_temperature;
76     double _sea_level_dewpoint;
77     double _sea_level_pressure;
78     double _rain;
79     double _hail;
80     double _snow;
81     bool _snow_cover;
82     std::string _decoded;
83 protected:
84     TiedPropertyList _tiedProperties;
85     MagneticVariation * _magneticVariation;
86 };
87
88 inline void MetarProperties::set_station_id( const char * value )
89
90     _station_id = value; 
91 }
92
93 } // namespace
94 #endif // __METARPROPERTIES_HXX