1 // presets.hxx -- Wrap environment presets
3 // Written by Torsten Dreyer, January 2011
5 // Copyright (C) 2010 Torsten Dreyer Torsten(at)t3r(dot)de
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef __ENVIRONMENT_PRESETS_HXX
23 #define __ENVIRONMENT_PRESETS_HXX
25 #include <simgear/structure/Singleton.hxx>
26 #include <simgear/props/props.hxx>
28 namespace Environment {
31 * @brief A wrapper for presets of environment properties
32 * mainly set from the command line with --wind=270@10,
33 * visibility=1600 etc.
39 PresetBase( const char * overrideNodePath );
40 virtual void disablePreset() { setOverride(false); }
42 void setOverride( bool value );
44 std::string _overrideNodePath;
45 SGPropertyNode_ptr _overrideNode;
48 class Ceiling : public PresetBase {
51 void preset( double elevation, double thickness );
53 SGPropertyNode_ptr _elevationNode;
54 SGPropertyNode_ptr _thicknessNode;
57 typedef simgear::Singleton<Ceiling> CeilingSingleton;
59 class Turbulence : public PresetBase {
62 void preset( double magnitude_norm );
64 SGPropertyNode_ptr _magnitudeNode;
67 typedef simgear::Singleton<Turbulence> TurbulenceSingleton;
69 class Wind : public PresetBase {
72 void preset( double min_hdg, double max_hdg, double speed, double gust );
74 SGPropertyNode_ptr _fromNorthNode;
75 SGPropertyNode_ptr _fromEastNode;
78 typedef simgear::Singleton<Wind> WindSingleton;
80 class Visibility : public PresetBase {
83 void preset( double visibility_m );
85 SGPropertyNode_ptr _visibilityNode;
88 typedef simgear::Singleton<Visibility> VisibilitySingleton;
90 } // namespace Presets
92 } // namespace Environment
94 #endif //__ENVIRONMENT_PRESETS_HXX