1 // metarproperties.hxx -- Parse a METAR and write properties
3 // Written by David Megginson, started May 2002.
4 // Rewritten by Torsten Dreyer, August 2010
6 // Copyright (C) 2002 David Megginson - david@megginson.com
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.
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.
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.
23 #ifndef __METARPROPERTIES_HXX
24 #define __METARPROPERTIES_HXX
26 #include <Airports/simple.hxx>
27 #include <simgear/props/props.hxx>
28 #include <simgear/props/tiedpropertylist.hxx>
30 namespace Environment {
32 class MagneticVariation;
34 class MetarProperties : public SGReferenced
37 MetarProperties( SGPropertyNode_ptr rootNode );
38 virtual ~MetarProperties();
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() ); }
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 );
63 SGPropertyNode_ptr _rootNode;
64 SGPropertyNode_ptr _metarValidNode;
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;
73 int _base_wind_range_from;
74 int _base_wind_range_to;
76 double _wind_from_north_fps;
77 double _wind_from_east_fps;
83 double _sea_level_temperature;
84 double _sea_level_dewpoint;
85 double _sea_level_pressure;
92 simgear::TiedPropertyList _tiedProperties;
93 MagneticVariation * _magneticVariation;
96 inline void MetarProperties::set_station_id( const char * value )
102 #endif // __METARPROPERTIES_HXX