ViSP  2.10.0
vpViewer.h
1 /****************************************************************************
2  *
3  * $Id: vpViewer.h 4574 2014-01-09 08:48:51Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Simulator based on Coin3d.
36  *
37  * Authors:
38  * Eric Marchand
39  *
40  *****************************************************************************/
41 
42 
43 #ifndef vpViewer_HH
44 #define vpViewer_HH
45 
57 #include <visp/vpConfig.h>
58 
59 #ifdef VISP_HAVE_COIN_AND_GUI
60 
61 #if defined(VISP_HAVE_SOWIN)
62 
63  #include <Inventor/Win/SoWin.h>
64  #include <Inventor/Win/viewers/SoWinExaminerViewer.h>
65 
66 #elif defined(VISP_HAVE_SOQT)
67 
68  #include <Inventor/Qt/SoQt.h>
69  #include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
70 
71 #elif defined(VISP_HAVE_SOXT)
72 
73  #include <Inventor/Xt/SoXt.h>
74  #include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
75 
76 #endif
77 
78 // Coin stuff
79 
80 #include <Inventor/nodes/SoBaseColor.h>
81 #include <Inventor/nodes/SoCone.h>
82 #include <Inventor/nodes/SoCube.h>
83 #include <Inventor/nodes/SoImage.h>
84 #include <Inventor/nodes/SoLightModel.h>
85 #include <Inventor/nodes/SoPerspectiveCamera.h>
86 #include <Inventor/nodes/SoRotationXYZ.h>
87 #include <Inventor/nodes/SoSeparator.h>
88 #include <Inventor/nodes/SoTranslation.h>
89 #include <Inventor/sensors/SoTimerSensor.h>
90 
91 #if defined(VISP_HAVE_SOWIN)
92 #include <GL/gl.h>
93 #elif defined(VISP_HAVE_SOQT)
94 #include <qgl.h>
95 #elif defined(VISP_HAVE_SOXT)
96 #include <GL/gl.h>
97 #endif
98 
99 // visp
100 #include <visp/vpDebug.h>
101 #include <visp/vpHomogeneousMatrix.h>
102 #include <visp/vpCameraParameters.h>
103 
117 class vpSimulator;
118 
119 #if defined(VISP_HAVE_SOWIN)
120 class VISP_EXPORT vpViewer : public SoWinExaminerViewer
121 #elif defined(VISP_HAVE_SOQT)
122 class VISP_EXPORT vpViewer : public SoQtExaminerViewer
123 #elif defined(VISP_HAVE_SOXT)
124 class VISP_EXPORT vpViewer : public SoXtExaminerViewer
125 #endif
126 {
127 
128  friend class vpSimulator ;
129 
130 public:
131  typedef enum{
134  } vpViewerType ;
135 #if defined(VISP_HAVE_SOWIN)
136  vpViewer(HWND parent, vpSimulator *simu,vpViewerType viewerType);
137 #elif defined(VISP_HAVE_SOQT)
138  vpViewer(QWidget * parent, vpSimulator *simu,vpViewerType viewerType);
139 #elif defined(VISP_HAVE_SOXT)
140  vpViewer(Widget parent, vpSimulator *simu,vpViewerType viewerType);
141 #endif
142 
143  virtual ~vpViewer();
144  void resize(int x, int y, bool fixed = false) ;
145  virtual void actualRedraw(void);
146 
147 private:
148 
149  vpViewerType viewerType;
150  vpSimulator *simu ;
151  SbBool processSoEvent(const SoEvent * const event) ;
152 #if defined(VISP_HAVE_SOWIN)
153  static HWND init(const char * appname) {return SoWin::init(appname);};
154  static void mainLoop() {SoWin::mainLoop();};
155  static void exitMainLoop() {SoWin::exitMainLoop();};
156 #elif defined(VISP_HAVE_SOQT)
157  static QWidget * init(const char * appname) {return SoQt::init(appname);};
158  static void mainLoop() { SoQt::mainLoop();};
159  static void exitMainLoop() {SoQt::exitMainLoop();};
160 #elif defined(VISP_HAVE_SOXT)
161  static Widget init(const char * appname) {return SoXt::init(appname);};
162  static void mainLoop() { SoXt::mainLoop();};
163  static void exitMainLoop() {SoXt::exitMainLoop();};
164 #endif
165 };
166 
167 #endif //VISP_HAVE_COIN_AND_GUI
168 
169 #endif
virtual ~vpViewer()
Definition: vpViewer.cpp:79
void resize(int x, int y, bool fixed=false)
Definition: vpViewer.cpp:148
Implementation of a simulator based on Coin3d (www.coin3d.org).
Definition: vpSimulator.h:102
void init()
perform some initialization
virtual void mainLoop()
activate the mainloop
vpViewerType
Definition: vpViewer.h:131
Viewer used by the simulator.
Definition: vpViewer.h:120
virtual void actualRedraw(void)
Definition: vpViewer.cpp:85
vpViewer * externalView
view from an external camera
Definition: vpSimulator.h:145
vpViewer(HWND parent, vpSimulator *simu, vpViewerType viewerType)
Definition: vpViewer.cpp:59