FlightGear next
presets.hxx
Go to the documentation of this file.
1// presets.hxx -- Wrap environment presets
2//
3// Written by Torsten Dreyer, January 2011
4//
5// Copyright (C) 2010 Torsten Dreyer Torsten(at)t3r(dot)de
6//
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.
11//
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.
16//
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.
20//
21
22#ifndef __ENVIRONMENT_PRESETS_HXX
23#define __ENVIRONMENT_PRESETS_HXX
24
25#include <simgear/structure/Singleton.hxx>
26#include <simgear/props/props.hxx>
27
28namespace Environment {
29
35namespace Presets {
36
38public:
39 PresetBase( const char * overrideNodePath );
40 virtual void disablePreset() { setOverride(false); }
41protected:
42 void setOverride( bool value );
43private:
44 std::string _overrideNodePath;
45 SGPropertyNode_ptr _overrideNode;
46};
47
48class Ceiling : public PresetBase {
49public:
50 Ceiling();
51 void preset( double elevation, double thickness );
52private:
53 SGPropertyNode_ptr _elevationNode;
54 SGPropertyNode_ptr _thicknessNode;
55};
56
57typedef simgear::Singleton<Ceiling> CeilingSingleton;
58
59class Turbulence : public PresetBase {
60public:
61 Turbulence();
62 void preset( double magnitude_norm );
63private:
64 SGPropertyNode_ptr _magnitudeNode;
65};
66
67typedef simgear::Singleton<Turbulence> TurbulenceSingleton;
68
69class Wind : public PresetBase {
70public:
71 Wind();
72 void preset( double min_hdg, double max_hdg, double speed, double gust );
73private:
74 SGPropertyNode_ptr _fromNorthNode;
75 SGPropertyNode_ptr _fromEastNode;
76};
77
78typedef simgear::Singleton<Wind> WindSingleton;
79
80class Visibility : public PresetBase {
81public:
82 Visibility();
83 void preset( double visibility_m );
84private:
85 SGPropertyNode_ptr _visibilityNode;
86};
87
88typedef simgear::Singleton<Visibility> VisibilitySingleton;
89
90} // namespace Presets
91
92} // namespace Environment
93
94#endif //__ENVIRONMENT_PRESETS_HXX
void preset(double elevation, double thickness)
Definition presets.cxx:118
PresetBase(const char *overrideNodePath)
Definition presets.cxx:35
void preset(double magnitude_norm)
Definition presets.cxx:102
void preset(double visibility_m)
Definition presets.cxx:86
void preset(double min_hdg, double max_hdg, double speed, double gust)
Definition presets.cxx:59
A wrapper for presets of environment properties mainly set from the command line with –wind=270@10,...
Definition presets.cxx:33
simgear::Singleton< Visibility > VisibilitySingleton
Definition presets.hxx:88
simgear::Singleton< Turbulence > TurbulenceSingleton
Definition presets.hxx:67
simgear::Singleton< Ceiling > CeilingSingleton
Definition presets.hxx:57
simgear::Singleton< Wind > WindSingleton
Definition presets.hxx:78