]> git.mxchange.org Git - flightgear.git/blob - src/Main/viewmgr.hxx
2955ac845c9af2ab42375775ad859ec8d3fd141e
[flightgear.git] / src / Main / viewmgr.hxx
1 // viewmgr.hxx -- class for managing all the views in the flightgear world.
2 //
3 // Written by Curtis Olson, started October 2000.
4 //
5 // Copyright (C) 2000  Curtis L. Olson  - http://www.flightgear.org/~curt
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 // $Id$
22
23
24 #ifndef _VIEWMGR_HXX
25 #define _VIEWMGR_HXX
26
27 #include <vector>
28
29 #include <simgear/compiler.h>
30 #include <simgear/structure/subsystem_mgr.hxx>
31 #include <simgear/math/SGMath.hxx>
32
33 // forward decls
34 class FGViewer;
35 typedef SGSharedPtr<FGViewer> FGViewerPtr;
36
37 // Define a structure containing view information
38 class FGViewMgr : public SGSubsystem
39 {
40
41 public:
42
43     // Constructor
44     FGViewMgr( void );
45
46     // Destructor
47     ~FGViewMgr( void );
48
49     virtual void init ();
50     virtual void bind ();
51     virtual void unbind ();
52     virtual void update (double dt);
53     virtual void reinit ();
54
55     // getters
56     inline int size() const { return views.size(); }
57     inline int get_current() const { return current; }
58     
59     FGViewer *get_current_view();
60     const FGViewer *get_current_view() const;
61     
62     FGViewer *get_view( int i ); 
63     const FGViewer *get_view( int i ) const;
64       
65     FGViewer *next_view();
66     FGViewer *prev_view();
67       
68     // setters
69     void clear();
70     inline void set_view( const int v ) { current = v; }
71     void add_view( FGViewer * v );
72     
73     // copies current offset settings to current-view path...
74     void copyToCurrent ();
75
76 private:
77
78     double axis_long;
79     double axis_lat;
80
81     void do_axes ();
82
83     //  callbacks in manager to access viewer methods
84     double getViewHeadingOffset_deg () const;
85     void setViewHeadingOffset_deg (double offset);
86     double getViewGoalHeadingOffset_deg () const;
87     void setViewGoalHeadingOffset_deg (double offset);
88     double getViewPitchOffset_deg () const;
89     void setViewPitchOffset_deg (double tilt);
90     double getGoalViewPitchOffset_deg () const;
91     void setGoalViewRollOffset_deg (double tilt);
92     double getViewRollOffset_deg () const;
93     void setViewRollOffset_deg (double tilt);
94     double getGoalViewRollOffset_deg () const;
95     void setGoalViewPitchOffset_deg (double tilt);
96     double getViewXOffset_m () const;
97     void setViewXOffset_m (double x);
98     double getViewYOffset_m () const;
99     void setViewYOffset_m (double y);
100     double getViewZOffset_m () const;
101     void setViewZOffset_m (double z);
102     double getViewTargetXOffset_m () const;
103     void setViewTargetXOffset_m (double x);
104     double getViewTargetYOffset_m () const;
105     void setViewTargetYOffset_m (double y);
106     double getViewTargetZOffset_m () const;
107     void setViewTargetZOffset_m (double z);
108     double getFOV_deg () const;
109     void setFOV_deg (double fov);
110     double getARM_deg () const; // Aspect Ratio Multiplier
111     void setARM_deg (double fov);
112     double getNear_m () const;
113     void setNear_m (double near_m);
114     void setViewAxisLong (double axis);
115     void setViewAxisLat (double axis);
116     int getView () const;
117     void setView (int newview);
118
119     SGPropertyNode_ptr view_number;
120     vector<SGPropertyNode_ptr> config_list;
121     typedef std::vector<FGViewerPtr> viewer_list;
122     viewer_list views;
123     SGVec3d abs_viewer_position;
124
125     int current;
126
127 };
128
129
130 #endif // _VIEWMGR_HXX