Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CameraViewController.hh
1 #ifndef __CameraViewController_h__
2 #define __CameraViewController_h__
3 
4 // ----------------------------------------------------------
5 // @author Jan Woetzel 09/2003
6 #include <bias_config.h>
7 #ifndef BIAS_HAVE_OPENGL
8 # error Please recompile BIAS with USE_OPENGL to use this lib.
9 #endif // BIAS_HAVE_OPENGL
10 
11 //#ifndef BIAS_HAVE_GLUT
12 //# error Please recompile BIAS with USE_GLUT to use this lib.
13 //#endif // BIAS_HAVE_GLUT
14 
15 #ifndef BIAS_HAVE_WXWIDGETS
16 # error Please recompile BIAS with USE_WXWIDGETS to use this lib.
17 #endif // BIAS_HAVE_WXWIDGETS
18 
19 
20 // must be first
21 #include <Gui/biasgl.h>
22 
23 // STD
24 #include <iostream>
25 
26 // BIAS
27 #include <Base/Debug/Error.hh>
28 #include <Base/Debug/DebugSimple.hh>
29 #include <Base/Math/Vector2.hh>
30 #include <Base/Math/Vector3.hh>
31 #include <Geometry/PMatrix.hh>
32 
33 #include <Gui/CameraViewExternals.hh>
34 #include <Gui/CameraViewInternals.hh>
35 
36 #include <wx/wx.h>
37 
38 
39 namespace BIAS {
40 
42  modeAxis1=1<<0
43  ,modeAxis2=1<<1
44  ,modeAxis3=1<<2
45  //Mouse_Left
46  //,Mouse_Right
47  //ExamineTrackballmode
48  //InspectionMoveCAbsolute=0
49  //,InspectionMoveViewAtAbsolute
50  //,InspectionModeRelative
51  //,FlyMode
52  //,PMatrixMode
53  };
54 
55 
56  /** \brief base for (interactively) manipulating a (virtual) camera view.
57  Typically used by OpenGL as a glulookat Update.
58  Navigator would be a good name, too.
59  \author Jan Woetzel */
61  public:
62  virtual ~CameraViewController(); ///< destructor
63 
64  // ctors
66 
67  /// any constructor should call this function
68  /// to initialize all data members (e.g. pointers to NULL)
69  virtual void InitMembers();
70 
71  virtual void DisplayGL();
72  virtual void DisplayGLInternal();
73  virtual void DisplayGLExternal();
74 
75  /** map update of one axis (mouse wheel, delta, key...)
76  maps delta (e.g. mouse dragging motion or wheel) to pose update
77  depending on current mode JW */
78  //virtual void Update(const unsigned int axisNo
79  // ,const double & delta
80  // ,const bool useCurrentMode=true
81  // ,const int alternativeMode = -1
82  // );
83 
84  //virtual void DisplayViewAt(const float & size=1.0f);
85 
86  //virtual void Set(BIAS::PMatrix & P,
87  // const unsigned int w,
88  // const unsigned int h,
89  // const float & zNear,
90  // const float & zFar );
91 
92  //void SetAspect();
93 
94  std::ostream & Print(std::ostream & os=std::cout );
95 
96  /** interaction area size */
97  void SetSize(const BIAS::Vector2<double> & sz){
98  this->size = sz; // dim
99  };
100 
101  ///** toplevel entry for all motion controllers */
102  //void Motion(const BIAS::Vector2<double> & pos,
103  // const bool & isStart=false);
104 
105  /** mouse start position, usually on leftclick */
106  void SetStartPos(const BIAS::Vector2<double> & pos);
107 
108 
110  BIASASSERT(p_externals!=NULL);
111  return *p_externals;
112  }
114  BIASASSERT(p_externals!=NULL);
115  return *p_externals;
116  }
117 
119  BIASASSERT(p_internals!=NULL);
120  return *p_internals;
121  }
123  BIASASSERT(p_internals!=NULL);
124  return *p_internals;
125  }
126 
127  //
128  // different controller implementations:
129  //
130 
131  /// simple translation
132  void MotionTranslation(const BIAS::Vector2<double> & pos);
134 
136 
138 
139  void MoveToCenter(const double & fraction);
140 
141  // deltaN is normalized 2D coord
142  void MoveOrbit(const BIAS::Vector2<double> & deltaN);
143  void MoveCoplanar(const BIAS::Vector2<double> & deltaN);
144 
145  protected:
148 
149  // Navigationmode mode_;
150 
151  BIAS::Vector2<double> size; // of interaction area, usually viewport
152 
153  BIAS::Vector2<double> startpos; // origin on click/start of motion
154  CameraViewExternals startposExt; // internal on click/start of motion
156 
157  }; // CameraViewController
158 } // namespace BIAS
159 #endif // __CameraViewController_h__
void MotionTranslationCoplanar(const BIAS::Vector2< double > &pos)
void MoveOrbit(const BIAS::Vector2< double > &deltaN)
BIAS::CameraViewExternals * p_externals
std::ostream & Print(std::ostream &os=std::cout)
map update of one axis (mouse wheel, delta, key...) maps delta (e.g.
BIAS::Vector2< double > startpos
BIAS::CameraViewInternals * p_internals
base for (interactively) manipulating a (virtual) camera view.
virtual ~CameraViewController()
destructor
virtual void InitMembers()
any constructor should call this function to initialize all data members (e.g.
void MoveToCenter(const double &fraction)
void SetStartPos(const BIAS::Vector2< double > &pos)
toplevel entry for all motion controllers
CameraViewExternals GetExternals() const
CameraViewInternals GetInternals() const
void SetSize(const BIAS::Vector2< double > &sz)
interaction area size
CameraViewInternals & GetInternals()
void MotionTranslationForward(const BIAS::Vector2< double > &pos)
describes internal params of an (OpenGL) camera view
void MotionTranslation(const BIAS::Vector2< double > &pos)
simple translation
BIAS::Vector2< double > size
void MotionTrackballRotation(const BIAS::Vector2< double > &pos)
void MoveCoplanar(const BIAS::Vector2< double > &deltaN)
CameraViewExternals & GetExternals()
describes external params of a camera view Used e.g.