source: trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh@ 858

Last change on this file since 858 was 857, checked in by garnier, 17 years ago

movie parameters imrovments

  • Property svn:mime-type set to text/cpp
File size: 7.4 KB
RevLine 
[530]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//
[846]27// $Id: G4OpenGLQtViewer.hh,v 1.10 2008/06/20 13:55:06 lgarnier Exp $
[850]28// GEANT4 tag $Name: HEAD $
[530]29//
30//
31// G4OpenGLQtViewer : Class to provide WindowsNT specific
32// functionality for OpenGL in GEANT4
33
34#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
35
36#ifndef G4OPENGLQTVIEWER_HH
37#define G4OPENGLQTVIEWER_HH
38
39#include "globals.hh"
40
41#include "G4VViewer.hh"
42#include "G4OpenGLSceneHandler.hh"
43
[595]44#include <qobject.h>
45#include <qpoint.h>
[536]46
[593]47class QGLWidget;
48class QDialog;
49class QContextMenuEvent;
[600]50#if QT_VERSION < 0x040000
51class QPopupMenu;
52#else
[593]53class QMenu;
[600]54#endif
[593]55class QImage;
56class QAction;
[696]57class QMouseEvent;
58class QKeyEvent;
[804]59class QWheelEvent;
[750]60class QProcess;
[797]61class QTime;
[593]62
[530]63class G4OpenGLSceneHandler;
[731]64class G4OpenGLQtMovieDialog;
[530]65
[561]66class G4OpenGLQtViewer: public QObject, virtual public G4OpenGLViewer {
[530]67
[561]68 Q_OBJECT
69
[530]70public:
71 G4OpenGLQtViewer (G4OpenGLSceneHandler& scene);
72 virtual ~G4OpenGLQtViewer ();
73 void SetView ();
74 void ShowView ();
[561]75 virtual void updateQWidget()=0;
[673]76 void setupViewport(int, int);
[733]77 QString setEncoderPath(QString path);
[730]78 QString getEncoderPath();
[733]79 QString setTempFolderPath(QString path);
[732]80 QString getTempFolderPath();
[733]81 QString setSaveFileName(QString path);
82 QString getSaveFileName();
[745]83 bool isRecording();
[748]84 bool isStopped();
[857]85 bool isPaused();
86 bool isEncoding();
87 bool isWaiting();
88 bool isFailed();
89 void setWaiting();
90 bool isBadEncoder();
91 bool isBadOutput();
92 bool isBadTmp();
93 bool isSuccess();
94 void setBadTmp();
95 void setBadOutput();
96 void setBadEncoder();
[745]97 bool isReadyToEncode();
[750]98 void resetRecording();
99 void encodeVideo();
[857]100 void stopVideo();
101 void saveVideo();
[747]102 bool generateMpegEncoderParameters();
[752]103 void displayRecordingStatus();
[561]104
[530]105protected:
106 void CreateGLQtContext ();
[561]107 virtual void CreateMainWindow (QGLWidget*);
108 void manageContextMenuEvent(QContextMenuEvent *e);
[720]109#if QT_VERSION < 0x040000
[797]110 void G4MousePressEvent(QPoint);
[720]111#else
[797]112 void G4MousePressEvent(QPoint);
[720]113#endif
[797]114 void G4MouseReleaseEvent();
[673]115 void G4MouseDoubleClickEvent(QPoint p);
[600]116#if QT_VERSION < 0x040000
[797]117 void G4MouseMoveEvent(int, int, Qt::ButtonState);
[600]118#else
[797]119 void G4MouseMoveEvent(int, int, Qt::MouseButtons);
[600]120#endif
[804]121 void G4wheelEvent (QWheelEvent * event);
[696]122 void G4keyPressEvent (QKeyEvent * event);
[798]123 void rotateQtScene(float, float);
124 void rotateQtCamera(float, float);
125 void moveScene(float, float, float,bool);
[561]126
[600]127
[530]128protected:
129 G4int WinSize_x;
130 G4int WinSize_y;
[536]131 QGLWidget* fWindow;
[541]132 QDialog* GLWindow;
[720]133 bool hasPendingEvents();
[739]134 void savePPMToTemp();
[723]135 int fRecordFrameNumber;
[800]136 float fRotationAngleX;
137 float fRotationAngleY;
138 float fRotationAngleZ;
[801]139 float fDeltaRotationAngleX;
140 float fDeltaRotationAngleY;
141 float fDeltaRotationAngleZ;
[561]142
[530]143private:
[745]144 enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
[857]145 enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS,BAD_ENCODER,BAD_OUTPUT,BAD_TMP,SAVE};
[745]146
[561]147 void createPopupMenu();
148 void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1);
[585]149 void rescaleImage(int, int);
[588]150 bool generateEPS(QString,int,QImage);
[652]151 bool generateVectorEPS (QString,int,int,QImage);
[588]152 bool generatePS_PDF(QString,int,QImage);
[731]153 void showMovieParametersDialog();
[735]154 void initMovieParameters();
[741]155 QString createTempFolder();
156 QString removeTempFolder();
[744]157 void setRecordingStatus(RECORDING_STEP);
158 void setRecordingInfos(QString);
[754]159 QString getProcessErrorMsg();
[586]160
[744]161
[600]162#if QT_VERSION < 0x040000
163 QPopupMenu *fContextMenu;
164#else
[561]165 QMenu *fContextMenu;
[600]166#endif
[744]167
[713]168 mouseActions fMouseAction; // 1: rotate 2:move 3:pick 4:shortcuts
[798]169 QPoint fLastPos1;
170 QPoint fLastPos2;
171 QPoint fLastPos3;
[713]172 /** delta of scene rotation. This delta is put in degree */
173 G4double fDeltaRotation;
[702]174 /** delta of scene translation. This delta is put in % of the scene view */
[712]175 G4double fDeltaSceneTranslation;
176 /** delta of depth move. This delta is put in % of the scene view */
177 G4double fDeltaDepth;
178 /** delta of zoom move. This delta is put in % of the scene view */
179 G4double fDeltaZoom;
[721]180 /** delta of auto move/rotation. This delta is put in % of the move/rotation param */
181 G4double fDeltaMove;
[702]182 /** To ensure key event are keep one by one */
[721]183 bool fHoldKeyEvent;
[728]184 /** To ensure move event are keep one by one */
185 bool fHoldMoveEvent;
186 /** To ensure rotate event are keep one by one */
187 bool fHoldRotateEvent;
[720]188 bool fAutoMove;
[730]189 QString fEncoderPath;
[732]190 QString fTempFolderPath;
[738]191 QString fMovieTempFolderPath;
[733]192 QString fSaveFileName;
[740]193 QString fParameterFileName;
[717]194 QAction *fRotateAction;
195 QAction *fMoveAction;
196 QAction *fPickAction;
197 QAction *fFullScreenOn;
198 QAction *fFullScreenOff;
[561]199 QAction *fDrawingWireframe;
200 QAction *fDrawingLineRemoval;
201 QAction *fDrawingSurfaceRemoval;
202 QAction *fDrawingLineSurfaceRemoval;
[732]203 G4OpenGLQtMovieDialog* fMovieParametersDialog;
[744]204 RECORDING_STEP fRecordingStep;
[749]205 QProcess *fProcess;
[797]206 QTime *fLastEventTime;
207 int fSpinningDelay;
[798]208 int fLaunchSpinDelay;
[561]209
[843]210signals:
211 void rotateTheta(int);
212 void rotatePhi(int);
213 void moveX(int);
214 void moveY(int);
215 void moveZ(int);
216
[857]217public slots :
218 void startPauseVideo();
219
[561]220private slots :
[678]221 void actionMouseRotate();
[713]222 void actionMouseMove();
[681]223 void actionMousePick();
[561]224 void actionDrawingWireframe();
225 void actionDrawingLineRemoval();
226 void actionDrawingSurfaceRemoval();
227 void actionDrawingLineSurfaceRemoval();
[731]228 void actionSaveImage();
229 void actionMovieParameters();
[565]230
[721]231 void showShortcuts();
[561]232 void toggleDrawingAction(int);
[678]233 void toggleMouseAction(mouseActions);
[561]234 void toggleRepresentation(bool);
[702]235 void toggleProjection(bool);
[561]236 void toggleBackground(bool);
237 void toggleTransparency(bool);
238 void toggleAntialiasing(bool);
239 void toggleHaloing(bool);
240 void toggleAux(bool);
[717]241 void toggleFullScreen(bool);
[754]242 void processEncodeFinished();
243 void processLookForFinished();
244 void processEncodeStdout();
[656]245 // Only use for Qt>4.0
[711]246 // void dialogClosed();
[530]247};
248
249#endif
250
251#endif
Note: See TracBrowser for help on using the repository browser.