| 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 - [email protected] |
| 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 | const char * get_description() const { return _description.c_str(); } |
| 57 | double get_magnetic_variation_deg() const; |
| 58 | double get_magnetic_dip_deg() const; |
| 59 | double get_wind_from_north_fps() const { return _wind_from_north_fps; } |
| 60 | double get_wind_from_east_fps() const { return _wind_from_east_fps; } |
| 61 | double get_base_wind_dir() const { return _base_wind_dir; } |
| 62 | double get_wind_speed() const { return _wind_speed; } |
| 63 | void set_wind_from_north_fps( double value ); |
| 64 | void set_wind_from_east_fps( double value ); |
| 65 | void set_base_wind_dir( double value ); |
| 66 | void set_wind_speed( double value ); |
| 67 | |
| 68 | SGSharedPtr<FGMetar> _metar; |
| 69 | SGPropertyNode_ptr _rootNode; |
| 70 | SGPropertyNode_ptr _metarValidNode; |
| 71 | |
| 72 | std::string _metarData; |
| 73 | |
| 74 | std::string _station_id; |
| 75 | double _station_elevation; |
| 76 | double _station_latitude; |
| 77 | double _station_longitude; |
| 78 | double _min_visibility; |
| 79 | double _max_visibility; |
| 80 | int _base_wind_dir; |
| 81 | int _base_wind_range_from; |
| 82 | int _base_wind_range_to; |
| 83 | double _wind_speed; |
| 84 | double _wind_from_north_fps; |
| 85 | double _wind_from_east_fps; |
| 86 | double _gusts; |
| 87 | double _temperature; |
| 88 | double _dewpoint; |
| 89 | double _humidity; |
| 90 | double _pressure; |
| 91 | double _sea_level_temperature; |
| 92 | double _sea_level_dewpoint; |
| 93 | double _sea_level_pressure; |
| 94 | double _rain; |
| 95 | double _hail; |
| 96 | double _snow; |
| 97 | bool _snow_cover; |
| 98 | std::string _decoded; |
| 99 | int _day; |
| 100 | int _hour; |
| 101 | int _minute; |
| 102 | bool _cavok; |
| 103 | std::string _description; |
| 104 | protected: |
| 105 | simgear::TiedPropertyList _tiedProperties; |
| 106 | MagneticVariation * _magneticVariation; |
| 107 | }; |
| 108 | |
| 109 | inline void MetarProperties::set_station_id( const char * value ) |
| 110 | { |
| 111 | _station_id = value; |
| 112 | } |
| 113 | |
| 114 | } // namespace |
| 115 | #endif // __METARPROPERTIES_HXX |