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