~ubuntu-branches/ubuntu/precise/flightgear/precise

« back to all changes in this revision

Viewing changes to src/Environment/presets.hxx

  • Committer: Package Import Robot
  • Author(s): Ove Kaaven
  • Date: 2011-09-03 22:16:12 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20110903221612-2cjy0z7ztj5nkln5
Tags: 2.4.0-1
* New upstream release. Closes: #638588.
* Build-Depend on OpenSceneGraph 3.0, and the Subversion library.
* Recommend fgfs-scenery-base.
* Enable parallel builds (shorter compile times on multicore CPUs).
* Removed hack that tried to build without optimizations if
  building with optimizations fails.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
28
namespace Environment {
 
29
 
 
30
/**
 
31
 * @brief A wrapper for presets of environment properties
 
32
 * mainly set from the command line with --wind=270@10, 
 
33
 * visibility=1600 etc.
 
34
 */
 
35
namespace Presets {
 
36
 
 
37
class PresetBase {
 
38
public:
 
39
    PresetBase( const char * overrideNodePath );
 
40
    virtual void disablePreset() { setOverride(false); }
 
41
protected:
 
42
    void setOverride( bool value );
 
43
private:
 
44
    std::string _overrideNodePath;
 
45
    SGPropertyNode_ptr _overrideNode;
 
46
};
 
47
 
 
48
class Ceiling : public PresetBase {
 
49
public:
 
50
    Ceiling();
 
51
    void preset( double elevation, double thickness );
 
52
private:
 
53
    SGPropertyNode_ptr _elevationNode;
 
54
    SGPropertyNode_ptr _thicknessNode;
 
55
};
 
56
 
 
57
typedef simgear::Singleton<Ceiling> CeilingSingleton;
 
58
 
 
59
class Turbulence : public PresetBase {
 
60
public:
 
61
    Turbulence();
 
62
    void preset( double magnitude_norm );
 
63
private:
 
64
    SGPropertyNode_ptr _magnitudeNode;
 
65
};
 
66
 
 
67
typedef simgear::Singleton<Turbulence> TurbulenceSingleton;
 
68
 
 
69
class Wind : public PresetBase {
 
70
public:
 
71
    Wind();
 
72
    void preset( double min_hdg, double max_hdg, double speed, double gust );
 
73
private:
 
74
    SGPropertyNode_ptr _fromNorthNode;
 
75
    SGPropertyNode_ptr _fromEastNode;
 
76
};
 
77
 
 
78
typedef simgear::Singleton<Wind> WindSingleton;
 
79
 
 
80
class Visibility : public PresetBase {
 
81
public:
 
82
    Visibility();
 
83
    void preset( double visibility_m );
 
84
private:
 
85
    SGPropertyNode_ptr _visibilityNode;
 
86
};
 
87
 
 
88
typedef simgear::Singleton<Visibility> VisibilitySingleton;
 
89
 
 
90
} // namespace Presets
 
91
 
 
92
} // namespace Environment
 
93
 
 
94
#endif //__ENVIRONMENT_PRESETS_HXX