33#ifdef G4VIS_BUILD_OPENGLWT_DRIVER
35#ifndef G4OPENGLWTVIEWER_HH
36#define G4OPENGLWTVIEWER_HH
46class G4OpenGLSceneHandler;
51class WContextMenuEvent;
60class G4OpenGLSceneHandler;
61class G4OpenGLWtMovieDialog;
63class G4OpenGLWtViewer:
public Wt::WObject,
virtual public G4OpenGLViewer {
66 G4OpenGLWtViewer (G4OpenGLSceneHandler& scene);
67 virtual ~G4OpenGLWtViewer ();
69 virtual void updateWWidget()=0;
71 Wt::WString setEncoderPath(Wt::WString path);
72 Wt::WString getEncoderPath();
73 Wt::WString setTempFolderPath(Wt::WString path);
74 Wt::WString getTempFolderPath();
75 Wt::WString setSaveFileName(Wt::WString path);
76 Wt::WString getSaveFileName();
91 bool isReadyToEncode();
92 void resetRecording();
96 bool generateMpegEncoderParameters();
97 void displayRecordingStatus();
99 void drawText(
const char * ,
int x,
int y,
int z,
int size);
102 void CreateGLWtContext ();
103 virtual void CreateMainWindow (Wt::WGLWidget*,Wt::WString);
105 void G4manageContextMenuEvent(Wt::WContextMenuEvent *e);
107 void G4MousePressEvent(Wt::WMouseEvent *event);
108 void G4MouseReleaseEvent();
109 void G4MouseDoubleClickEvent();
110 void G4MouseMoveEvent(Wt::WMouseEvent *event);
112 void G4wheelEvent (Wt::WWheelEvent * event);
114 void G4keyPressEvent (Wt::WKeyEvent * event);
115 void rotateWtScene(
float,
float);
116 void rotateWtCamera(
float,
float);
117 void rotateWtSceneInViewDirection(
float,
float);
118 void rotateWtCameraInViewDirection(
float,
float);
119 void moveScene(
float,
float,
float,
bool);
122 void updateKeyModifierState(Wt::KeyboardModifiers);
126 Wt::WGLWidget* fWindow;
127 Wt::WWidget* fGLWindow;
128 bool hasPendingEvents();
130 void savePPMToTemp();
132 int fRecordFrameNumber;
139 enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
140 enum RECORDING_STEP {WAIT,
START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,
ENCODING,FAILED,SUCCESS,BAD_ENCODER,BAD_OUTPUT,BAD_TMP,SAVE};
143 void createPopupMenu();
144 void createRadioAction(Wt::WAction *,Wt::WAction *,
const std::string&,
unsigned int a=1);
146 void rescaleImage(
int,
int);
148 bool printPDF(
const std::string,
int,WImage);
149 void showMovieParametersDialog();
150 void initMovieParameters();
151 Wt::WString createTempFolder();
152 Wt::WString removeTempFolder();
153 void setRecordingStatus(RECORDING_STEP);
154 void setRecordingInfos(Wt::WString);
155 Wt::WString getProcessErrorMsg();
160 mouseActions fMouseAction;
161 Wt::WPoint fLastPos1;
162 Wt::WPoint fLastPos2;
163 Wt::WPoint fLastPos3;
179 bool fHoldRotateEvent;
181 Wt::WString fEncoderPath;
182 Wt::WString fTempFolderPath;
183 Wt::WString fMovieTempFolderPath;
184 Wt::WString fSaveFileName;
185 Wt::WString fParameterFileName;
187 WAction *fRotateAction;
188 WAction *fMoveAction;
189 WAction *fPickAction;
190 WAction *fFullScreenOn;
191 WAction *fFullScreenOff;
192 WAction *fDrawingWireframe;
193 WAction *fDrawingLineRemoval;
194 WAction *fDrawingSurfaceRemoval;
195 WAction *fDrawingLineSurfaceRemoval;
197 G4OpenGLWtMovieDialog* fMovieParametersDialog;
198 RECORDING_STEP fRecordingStep;
200 Wt::WTime *fLastEventTime;
202 int fNbMaxFramesPerSec;
203 float fNbMaxAnglePerSec;
204 int fLaunchSpinDelay;
210 bool fControlKeyPress;
214 void rotateTheta(
int);
222 void startPauseVideo();
226 void actionMouseRotate();
227 void actionMouseMove();
228 void actionMousePick();
229 void actionDrawingWireframe();
230 void actionDrawingLineRemoval();
231 void actionDrawingSurfaceRemoval();
232 void actionDrawingLineSurfaceRemoval();
233 void actionSaveImage();
234 void actionChangeBackgroundColor();
235 void actionChangeTextColor();
236 void actionChangeDefaultColor();
237 void actionMovieParameters();
240 void showShortcuts();
242 void toggleDrawingAction(
int);
243 void toggleMouseAction(mouseActions);
244 void toggleRepresentation(
bool);
245 void toggleProjection(
bool);
246 void toggleTransparency(
bool);
247 void toggleAntialiasing(
bool);
248 void toggleHaloing(
bool);
249 void toggleAux(
bool);
250 void toggleFullScreen(
bool);
252 void processEncodeFinished();
253 void processLookForFinished();
254 void processEncodeStdout();