Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenGLWtViewer.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4OpenGLWtViewer.hh 75567 2013-11-04 11:35:11Z gcosmo $
28 //
29 //
30 // G4OpenGLWtViewer : Class to provide WindowsNT specific
31 // functionality for OpenGL in GEANT4
32 
33 #ifdef G4VIS_BUILD_OPENGLWT_DRIVER
34 
35 #ifndef G4OPENGLWTVIEWER_HH
36 #define G4OPENGLWTVIEWER_HH
37 
38 #include "globals.hh"
39 
40 #include "G4OpenGLViewer.hh"
41 
42 #include <Wt/WObject>
43 #include <Wt/WPoint>
44 #include <Wt/WTime>
45 #include <Wt/WContainerWidget>
46 #include <Wt/WMatrix4x4>
47 
48 class G4OpenGLSceneHandler;
49 class G4UImanager;
50 
51 class WDialog;
52 #ifdef _A_FINIR_FIXME
53 class WContextMenuEvent;
54 #endif
55 class WMenu;
56 class WImage;
57 #ifdef _A_FINIR_FIXME
58 class WWheelEvent;
59 #endif
60 class WProcess;
61 class G4UIWt;
62 
63 class G4OpenGLSceneHandler;
64 class G4OpenGLWtMovieDialog;
65 
66 class G4OpenGLWtViewer: virtual public G4OpenGLViewer {
67 
68 public:
69  G4OpenGLWtViewer (G4OpenGLSceneHandler& scene);
70  virtual ~G4OpenGLWtViewer ();
71  virtual void updateWWidget()=0;
72 
73  Wt::WMatrix4x4 mMatrix;
74 
75 #ifdef _A_FINIR_FIXME
76  Wt::WString setEncoderPath(Wt::WString path);
77  Wt::WString getEncoderPath();
78  Wt::WString setTempFolderPath(Wt::WString path);
79  Wt::WString getTempFolderPath();
80  Wt::WString setSaveFileName(Wt::WString path);
81  Wt::WString getSaveFileName();
82  bool isRecording();
83  bool isStopped();
84  bool isPaused();
85  bool isEncoding();
86  bool isWaiting();
87  bool isFailed();
88  void setWaiting();
89  bool isBadEncoder();
90  bool isBadOutput();
91  bool isBadTmp();
92  bool isSuccess();
93  void setBadTmp();
94  void setBadOutput();
95  void setBadEncoder();
96  bool isReadyToEncode();
97  void resetRecording();
98  void encodeVideo();
99  void stopVideo();
100  void saveVideo();
101  bool generateMpegEncoderParameters();
102  void displayRecordingStatus();
103 #endif
104  void drawText(const char * ,int x,int y,int z, int size);
105 protected:
106  void CreateGLWtContext ();
107  virtual void CreateMainWindow (Wt::WGLWidget*,Wt::WString);
108 #ifdef _A_FINIR_FIXME
109  void G4manageContextMenuEvent(Wt::WContextMenuEvent *e);
110 #endif
111  void G4MousePressEvent(Wt::WMouseEvent *event);
112  void G4MouseReleaseEvent();
113  void G4MouseDoubleClickEvent();
114  void G4MouseMoveEvent(Wt::WMouseEvent *event);
115 // void G4wheelEvent (Wt::WWheelEvent * event);
116  void G4keyPressEvent (Wt::WKeyEvent * event);
117  void rotateWtScene(float, float);
118  void rotateWtSceneToggle(float, float);
119  void moveScene(float, float, float,bool);
120 #ifdef _A_FINIR_FIXME
121  void updateKeyModifierState(Wt::KeyboardModifiers);
122 #endif
123 
124  inline Wt::WGLWidget* getGLWindow() {
125  return fWindow;
126  }
127 
128 
129 protected:
130  Wt::WGLWidget* fWindow;
131  Wt::WWidget* fGLWindow;
132  bool hasPendingEvents();
133  void resizeGL(int width, int height);
134 
135 #ifdef _A_FINIR_FIXME
136  void savePPMToTemp();
137 #endif
138  int fRecordFrameNumber;
139 
140  bool fHasToRepaint;
141  bool fReadyToPaint;
142  bool fIsRepainting;
143 
144 private:
145  enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
146  enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS,BAD_ENCODER,BAD_OUTPUT,BAD_TMP,SAVE};
147 
148 #ifdef _A_FINIR_FIXME
149  void createPopupMenu();
150  void createRadioAction(Wt::WAction *,Wt::WAction *, const std::string&,unsigned int a=1);
151 #endif
152  void rescaleImage(int, int);
153 #ifdef _A_FINIR_FIXME
154  bool printPDF(const std::string,int,WImage);
155  void showMovieParametersDialog();
156  void initMovieParameters();
157  Wt::WString createTempFolder();
158  Wt::WString removeTempFolder();
159  void setRecordingStatus(RECORDING_STEP);
160  void setRecordingInfos(Wt::WString);
161  Wt::WString getProcessErrorMsg();
162 
163  WMenu *fContextMenu;
164 #endif
165 
166  mouseActions fMouseAction; // 1: rotate 2:move 3:pick 4:shortcuts
167  Wt::WPoint fLastPos1;
168  Wt::WPoint fLastPos2;
169  Wt::WPoint fLastPos3;
171  G4double fDeltaRotation;
173  G4double fDeltaSceneTranslation;
175  G4double fDeltaDepth;
177  G4double fDeltaZoom;
179  G4double fDeltaMove;
181  bool fHoldKeyEvent;
183  bool fHoldMoveEvent;
185  bool fHoldRotateEvent;
186  bool fAutoMove;
187  Wt::WString fEncoderPath;
188  Wt::WString fTempFolderPath;
189  Wt::WString fMovieTempFolderPath;
190  Wt::WString fSaveFileName;
191  Wt::WString fParameterFileName;
192 #ifdef _A_FINIR_FIXME
193  WAction *fRotateAction;
194  WAction *fMoveAction;
195  WAction *fPickAction;
196  WAction *fFullScreenOn;
197  WAction *fFullScreenOff;
198  WAction *fDrawingWireframe;
199  WAction *fDrawingLineRemoval;
200  WAction *fDrawingSurfaceRemoval;
201  WAction *fDrawingLineSurfaceRemoval;
202 #endif
203  G4OpenGLWtMovieDialog* fMovieParametersDialog;
204  RECORDING_STEP fRecordingStep;
205  WProcess *fProcess;
206  Wt::WTime *fLastEventTime;
207  int fSpinningDelay;
208  int fNbMaxFramesPerSec;
209  float fNbMaxAnglePerSec;
210  int fLaunchSpinDelay;
211  Wt::WTabWidget* fUISceneTreeComponentsTBWidget;
212 
213  G4double fXRot;
214  G4double fYRot;
215  bool fNoKeyPress;
216  bool fAltKeyPress;
217  bool fControlKeyPress;
218  bool fShiftKeyPress;
219  bool fBatchMode;
220  G4UIWt* fUiWt;
221 
222 #ifdef _A_FINIR_FIXME
223  void rotateTheta(int);
224  void rotatePhi(int);
225  void moveX(int);
226  void moveY(int);
227  void moveZ(int);
228 #endif
229 
230 public :
231  void startPauseVideo();
232 
233 private :
234 #ifdef _A_FINIR_FIXME
235  void actionMouseRotate();
236  void actionMouseMove();
237  void actionMousePick();
238  void actionDrawingWireframe();
239  void actionDrawingLineRemoval();
240  void actionDrawingSurfaceRemoval();
241  void actionDrawingLineSurfaceRemoval();
242  void actionSaveImage();
243  void actionChangeBackgroundColor();
244  void actionChangeTextColor();
245  void actionChangeDefaultColor();
246  void actionMovieParameters();
247 #endif
248 
249  void showShortcuts();
250 #ifdef _A_FINIR_FIXME
251  void toggleDrawingAction(int);
252  void toggleMouseAction(mouseActions);
253  void toggleRepresentation(bool);
254  void toggleProjection(bool);
255  void toggleTransparency(bool);
256  void toggleAntialiasing(bool);
257  void toggleHaloing(bool);
258  void toggleAux(bool);
259  void toggleFullScreen(bool);
260 #endif
261  void processEncodeFinished();
262  void processLookForFinished();
263  void processEncodeStdout();
264  // Only use for Wt>4.0
265  // void dialogClosed();
266 
267 
268 };
269 
270 #endif
271 
272 #endif
struct encoding ENCODING
Definition: xmltok.h:126
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
#define width
tuple x
Definition: test.py:50
tuple z
Definition: test.py:28
double G4double
Definition: G4Types.hh:76