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

Last change on this file since 899 was 897, checked in by garnier, 17 years ago

suppres des debug et modif des WinSize

  • Property svn:mime-type set to text/cpp
File size: 7.3 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//
[877]27// $Id: G4OpenGLQtViewer.hh,v 1.13 2008/11/06 13:43:44 lgarnier Exp $
[866]28// GEANT4 tag $Name: $
[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 ();
[561]74 virtual void updateQWidget()=0;
[673]75 void setupViewport(int, int);
[733]76 QString setEncoderPath(QString path);
[730]77 QString getEncoderPath();
[733]78 QString setTempFolderPath(QString path);
[732]79 QString getTempFolderPath();
[733]80 QString setSaveFileName(QString path);
81 QString getSaveFileName();
[745]82 bool isRecording();
[748]83 bool isStopped();
[857]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();
[745]96 bool isReadyToEncode();
[750]97 void resetRecording();
98 void encodeVideo();
[857]99 void stopVideo();
100 void saveVideo();
[747]101 bool generateMpegEncoderParameters();
[752]102 void displayRecordingStatus();
[561]103
[530]104protected:
105 void CreateGLQtContext ();
[866]106 virtual void CreateMainWindow (QGLWidget*,QString);
[873]107 void G4resizeGL(int, int);
108 void G4manageContextMenuEvent(QContextMenuEvent *e);
109 void G4MousePressEvent(QMouseEvent *event);
[797]110 void G4MouseReleaseEvent();
[873]111 void G4MouseDoubleClickEvent();
112 void G4MouseMoveEvent(QMouseEvent *event);
[804]113 void G4wheelEvent (QWheelEvent * event);
[696]114 void G4keyPressEvent (QKeyEvent * event);
[798]115 void rotateQtScene(float, float);
116 void rotateQtCamera(float, float);
117 void moveScene(float, float, float,bool);
[873]118 void FinishView();
[561]119
[600]120
[530]121protected:
[536]122 QGLWidget* fWindow;
[541]123 QDialog* GLWindow;
[720]124 bool hasPendingEvents();
[739]125 void savePPMToTemp();
[723]126 int fRecordFrameNumber;
[800]127 float fRotationAngleX;
128 float fRotationAngleY;
129 float fRotationAngleZ;
[801]130 float fDeltaRotationAngleX;
131 float fDeltaRotationAngleY;
132 float fDeltaRotationAngleZ;
[561]133
[873]134 bool hasToRepaint;
135 bool readyToPaint;
136 bool zoomAction;
137 QPoint beginZoom;
138 QPoint endZoom;
139
[530]140private:
[745]141 enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
[857]142 enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS,BAD_ENCODER,BAD_OUTPUT,BAD_TMP,SAVE};
[745]143
[561]144 void createPopupMenu();
145 void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1);
[585]146 void rescaleImage(int, int);
[588]147 bool generateEPS(QString,int,QImage);
[652]148 bool generateVectorEPS (QString,int,int,QImage);
[588]149 bool generatePS_PDF(QString,int,QImage);
[731]150 void showMovieParametersDialog();
[735]151 void initMovieParameters();
[741]152 QString createTempFolder();
153 QString removeTempFolder();
[744]154 void setRecordingStatus(RECORDING_STEP);
155 void setRecordingInfos(QString);
[754]156 QString getProcessErrorMsg();
[586]157
[744]158
[600]159#if QT_VERSION < 0x040000
160 QPopupMenu *fContextMenu;
161#else
[561]162 QMenu *fContextMenu;
[600]163#endif
[744]164
[713]165 mouseActions fMouseAction; // 1: rotate 2:move 3:pick 4:shortcuts
[798]166 QPoint fLastPos1;
167 QPoint fLastPos2;
168 QPoint fLastPos3;
[713]169 /** delta of scene rotation. This delta is put in degree */
170 G4double fDeltaRotation;
[702]171 /** delta of scene translation. This delta is put in % of the scene view */
[712]172 G4double fDeltaSceneTranslation;
173 /** delta of depth move. This delta is put in % of the scene view */
174 G4double fDeltaDepth;
175 /** delta of zoom move. This delta is put in % of the scene view */
176 G4double fDeltaZoom;
[721]177 /** delta of auto move/rotation. This delta is put in % of the move/rotation param */
178 G4double fDeltaMove;
[702]179 /** To ensure key event are keep one by one */
[721]180 bool fHoldKeyEvent;
[728]181 /** To ensure move event are keep one by one */
182 bool fHoldMoveEvent;
183 /** To ensure rotate event are keep one by one */
184 bool fHoldRotateEvent;
[720]185 bool fAutoMove;
[730]186 QString fEncoderPath;
[732]187 QString fTempFolderPath;
[738]188 QString fMovieTempFolderPath;
[733]189 QString fSaveFileName;
[740]190 QString fParameterFileName;
[717]191 QAction *fRotateAction;
192 QAction *fMoveAction;
193 QAction *fPickAction;
194 QAction *fFullScreenOn;
195 QAction *fFullScreenOff;
[561]196 QAction *fDrawingWireframe;
197 QAction *fDrawingLineRemoval;
198 QAction *fDrawingSurfaceRemoval;
199 QAction *fDrawingLineSurfaceRemoval;
[732]200 G4OpenGLQtMovieDialog* fMovieParametersDialog;
[744]201 RECORDING_STEP fRecordingStep;
[749]202 QProcess *fProcess;
[797]203 QTime *fLastEventTime;
204 int fSpinningDelay;
[798]205 int fLaunchSpinDelay;
[561]206
[843]207signals:
208 void rotateTheta(int);
209 void rotatePhi(int);
210 void moveX(int);
211 void moveY(int);
212 void moveZ(int);
213
[857]214public slots :
215 void startPauseVideo();
216
[561]217private slots :
[678]218 void actionMouseRotate();
[713]219 void actionMouseMove();
[681]220 void actionMousePick();
[561]221 void actionDrawingWireframe();
222 void actionDrawingLineRemoval();
223 void actionDrawingSurfaceRemoval();
224 void actionDrawingLineSurfaceRemoval();
[731]225 void actionSaveImage();
226 void actionMovieParameters();
[565]227
[721]228 void showShortcuts();
[561]229 void toggleDrawingAction(int);
[678]230 void toggleMouseAction(mouseActions);
[561]231 void toggleRepresentation(bool);
[702]232 void toggleProjection(bool);
[561]233 void toggleBackground(bool);
234 void toggleTransparency(bool);
235 void toggleAntialiasing(bool);
236 void toggleHaloing(bool);
237 void toggleAux(bool);
[717]238 void toggleFullScreen(bool);
[754]239 void processEncodeFinished();
240 void processLookForFinished();
241 void processEncodeStdout();
[656]242 // Only use for Qt>4.0
[711]243 // void dialogClosed();
[530]244};
245
246#endif
247
248#endif
Note: See TracBrowser for help on using the repository browser.