Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
biasGLviewerWx.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef __BIASWXGLviewer_hh__
27 #define __BIASWXGLviewer_hh__
28 #include <bias_config.h>
29 #include <Gui/biasgl.h>
30 
31 #include <Base/Image/Image.hh>
32 #include <Base/Image/ImageIO.hh>
33 #include <Gui/ParamGUI.hh>
34 #include <GLviewer/Controller/DistanceMeasureControl.hh>
35 #include <GLviewer/Controller/ScreenShotListener.hh>
36 #include <GLviewer/Scenes/ScenePointLight.hh>
37 #ifdef BIAS_HAVE_OPENSCENEGRAPH
38 #include <GLviewer/ThreeDOutOpenSceneGraph.hh>
39 #include <GLviewer/Scenes/SceneOpenSceneGraph.hh>
40 #include <GLviewer/Scenes/ScenePlainOpenSceneGraph.hh>
41 #endif
42 #ifdef BIAS_HAVE_GLUT
43 #include <GLviewer/Scenes/SceneGlutPrimitives.hh>
44 #endif
45 #include <GLviewer/ContextWX.hh>
46 #include <GLviewer/GLProjectionParametersPerspective.hh>
47 #include <Geometry/ProjectionParametersPerspective.hh>
48 
49 #include <Base/Debug/TimeMeasure.hh>
50 
51 #include <wx/wx.h>
52 #include <wx/aboutdlg.h>
53 #include <wx/toolbar.h>
54 #include <wx/splitter.h>
55 
56 /**
57  @file
58  @ingroup g_tools
59  @brief Tool for displaying 3D models using WxWidgets
60  executable: biasOpenGLviewerWx, see biasGLviewerWx.hh biasGLviewerWx.cpp
61  @author ischiller
62 */
63 ///////////////////////////////////////////////////////////////////////////
64 
65 enum BIASOpenGLViewerFrameIDs{
66 
67  // standard ids
68  ID_LOADMODEL=wxID_HIGHEST+1223,
69  ID_DELETEMODELS,
70  ID_SAVE_PARAMETER,
71  ID_SHOW_PARAMETER,
72  ID_SCREENSHOT,
73  ID_FULLSCREEN,
74  ID_SOLID,
75  ID_LINES,
76  ID_POINTS,
77  ID_TIMER,
78  ID_CHECK_MEASURE
79 };
80 
81 
82 ///////////////////////////////////////////////////////////////////////////////
83 /// Class BIASOpenGLViewerFrame
84 ///////////////////////////////////////////////////////////////////////////////
86 {
87  DECLARE_EVENT_TABLE()
88 
89 private:
90  // Virtual event handlers, overide them in your derived class
91  virtual void OnFullscreen( wxCommandEvent& event );
92  virtual void OnViewSolid( wxCommandEvent& event );
93  virtual void OnViewLines( wxCommandEvent& event );
94  virtual void OnViewPoints( wxCommandEvent& event );
95  virtual void OnAddModel(wxCommandEvent& event);
96  virtual void OnQuit( wxCloseEvent& event );
97  virtual void OnExit( wxCommandEvent& event );
98  virtual void OnSaveParameters(wxCommandEvent& event);
99  virtual void OnShowParameters(wxCommandEvent& event);
100  virtual void OnTimer(wxTimerEvent& event);
101  virtual void OnDeleteModels(wxCommandEvent& event);
102  virtual void OnAbout(wxCommandEvent& event);
103  virtual void OnMeasure(wxCommandEvent& event);
104  virtual void OnScreenshot(wxCommandEvent& event);
105 
106 protected:
107  std::string* animationFile_;
108  double* fixedFPS_;
109  bool* useFlyMode_;
110  bool* useRotMode_;
111 
112  // View Params
113  double* zNear_;
114  double* zFar_;
115  double* fov_;
118 #ifdef BIAS_HAVE_GLUT
119  bool* teapot_;
120  bool* cube_;
123 #endif
124  // Camera Params
125  std::string* projectionFile_;
130 
131  // Misc Params
132  int* winwidth_;
134  std::string* screenShotName_;
137  bool* help_;
138 
139 
140  protected:
141  wxToolBar* toolBar_;
142 
143  wxButton* loadModelButton_;
144  wxButton* fullscreenButton_;
146  wxButton* screenshotButton_;
147  wxCheckBox *measureCheckbox_;
148 
149  wxMenuBar* menubar_;
150  wxMenu* fileMenu_;
151  wxMenu* viewMenu_;
152  wxMenu* helpMenu_;
153 
154  wxSplitterWindow* splitterWindow_;
155 
156  wxFrame* paramFrame_;
157  wxBoxSizer* panelSizer_;
158 
160 
161  wxTimer timer_;
162  wxMenuItem* menuItemFullscreen_;
165 
166 
167  void ToggleFullscreen_();
168  void InitParameters_();
169 
170  void LoadDefaultModel_();
171  void RemoveAllModels_();
172 
173 #ifdef BIAS_HAVE_OPENSCENEGRAPH
175 #endif
176 
177 #ifdef BIAS_HAVE_GLUT
179 #endif
182 
186 
187  public:
188  BIASOpenGLViewerFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("MixIn3D"),
189  const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 1024,768) ,
190  long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL|wxSYSTEM_MENU );
192  int InitModels();
194  void SetParameterFile(int argc, char** argv, std::string& paramFile );
195  void ParameterChanged(const std::string &paramname, const void *data);
196 };
197 
198 #endif //__MixIn3D__
The main Parameter Gui interface, derived from BIAS::Param and extends this class.
Definition: ParamGUI.hh:88
wxMenuItem * menuItemShowParameter_
class for distance measurements in 3d model, derives from TrackballControl and SceneBase ...
BIAS::ScreenShotListener screenShotControl_
BIAS::Vector< double > * backGroundColor_
GLPPB encapsulates the opengl rendering interface for the projectionparameter classes.
Class BIASOpenGLViewerFrame.
Scene that renders a background image behind all other scenes.
Definition: SceneBGImage.hh:42
std::string * screenShotName_
BIAS::GLProjectionParametersBase * virtualCamera_
wxMenuItem * menuItemSolid_
wxSplitterWindow * splitterWindow_
wxMenuItem * menuItemFullscreen_
BIAS::SceneBGImage bgImageScene_
wxButton * deleteModelsButton_
std::string * projectionFile_
This class provides an interface to be called if parameter changes occured.
Definition: Param.hh:74
Class for rendering the Glut primitives like teapot, cube, tetrahedron and icosahedron. Mainly used to test rendering without SceneGraph library.
Context implementation for wxWidgets.
Definition: ContextWX.hh:31
wxCheckBox * measureCheckbox_
BIAS::ContextWX * contextWX_
void SetParameterFile(int argc, char **argv, std::string &paramFile)
BIAS::DistanceMeasureControl Control_
int ResetSceneCenter(BIAS::Vector3< double > *C=NULL, BIAS::Quaternion< double > *Q=NULL)
Implements slim openscenegraph scene without extras.
BIAS::SceneGlutPrimitives sceneGlut_
void ParameterChanged(const std::string &paramname, const void *data)
BIASOpenGLViewerFrame(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxT("MixIn3D"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(1024, 768), long style=wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL|wxSYSTEM_MENU)
wxMenuItem * menuItemLines_
If KEY_F5 is activated screenshot is stored to given basename + screenshot count. ...
std::string * animationFile_
BIAS::ScenePointLight lightScene_
wxMenuItem * menuItemPoints_