]> git.mxchange.org Git - flightgear.git/blob - src/Environment/metarproperties.hxx
Merge branch 'next' into durk-atc
[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 <simgear/props/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     double get_wind_from_north_fps() const { return _wind_from_north_fps; }
55     double get_wind_from_east_fps() const { return _wind_from_east_fps; }
56     double get_base_wind_dir() const { return _base_wind_dir; }
57     double get_wind_speed() const { return _wind_speed; }
58     void set_wind_from_north_fps( double value );
59     void set_wind_from_east_fps( double value );
60     void set_base_wind_dir( double value );
61     void set_wind_speed( double value );
62
63     SGPropertyNode_ptr _rootNode;
64     SGPropertyNode_ptr _metarValidNode;
65     std::string _metar;
66     std::string _station_id;
67     double _station_elevation;
68     double _station_latitude;
69     double _station_longitude;
70     double _min_visibility;
71     double _max_visibility;
72     int _base_wind_dir;
73     int _base_wind_range_from;
74     int _base_wind_range_to;
75     double _wind_speed;
76     double _wind_from_north_fps;
77     double _wind_from_east_fps;
78     double _gusts;
79     double _temperature;
80     double _dewpoint;
81     double _humidity;
82     double _pressure;
83     double _sea_level_temperature;
84     double _sea_level_dewpoint;
85     double _sea_level_pressure;
86     double _rain;
87     double _hail;
88     double _snow;
89     bool _snow_cover;
90     std::string _decoded;
91 protected:
92     simgear::TiedPropertyList _tiedProperties;
93     MagneticVariation * _magneticVariation;
94 };
95
96 inline void MetarProperties::set_station_id( const char * value )
97
98     _station_id = value; 
99 }
100
101 } // namespace
102 #endif // __METARPROPERTIES_HXX