source: trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh@ 798

Last change on this file since 798 was 798, checked in by garnier, 18 years ago

r834@wl-72126: garnier | 2008-05-14 18:44:52 +0200
SPINNING ok

  • Property svn:mime-type set to text/cpp
File size: 6.8 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//
[754]27// $Id: G4OpenGLQtViewer.hh,v 1.9 2008/03/11 16:05:56 lgarnier Exp $
[593]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;
[750]59class QProcess;
[797]60class QTime;
[593]61
[530]62class G4OpenGLSceneHandler;
[731]63class G4OpenGLQtMovieDialog;
[530]64
[561]65class G4OpenGLQtViewer: public QObject, virtual public G4OpenGLViewer {
[530]66
[561]67 Q_OBJECT
68
[530]69public:
70 G4OpenGLQtViewer (G4OpenGLSceneHandler& scene);
71 virtual ~G4OpenGLQtViewer ();
72 void SetView ();
73 void ShowView ();
[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();
[745]84 bool isReadyToEncode();
[750]85 void resetRecording();
86 void encodeVideo();
[747]87 bool generateMpegEncoderParameters();
[752]88 void displayRecordingStatus();
[561]89
[530]90protected:
91 void CreateGLQtContext ();
[561]92 virtual void CreateMainWindow (QGLWidget*);
93 void manageContextMenuEvent(QContextMenuEvent *e);
[720]94#if QT_VERSION < 0x040000
[797]95 void G4MousePressEvent(QPoint);
[720]96#else
[797]97 void G4MousePressEvent(QPoint);
[720]98#endif
[797]99 void G4MouseReleaseEvent();
[673]100 void G4MouseDoubleClickEvent(QPoint p);
[600]101#if QT_VERSION < 0x040000
[797]102 void G4MouseMoveEvent(int, int, Qt::ButtonState);
[600]103#else
[797]104 void G4MouseMoveEvent(int, int, Qt::MouseButtons);
[600]105#endif
[696]106 void G4keyPressEvent (QKeyEvent * event);
[798]107 void rotateQtScene(float, float);
108 void rotateQtCamera(float, float);
109 void moveScene(float, float, float,bool);
[561]110
[600]111
[530]112protected:
113 G4int WinSize_x;
114 G4int WinSize_y;
[536]115 QGLWidget* fWindow;
[541]116 QDialog* GLWindow;
[720]117 bool hasPendingEvents();
[739]118 void savePPMToTemp();
[723]119 int fRecordFrameNumber;
[561]120
[530]121private:
[745]122 enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
[751]123 enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS};
[745]124
[561]125 void createPopupMenu();
126 void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1);
[585]127 void rescaleImage(int, int);
[588]128 bool generateEPS(QString,int,QImage);
[652]129 bool generateVectorEPS (QString,int,int,QImage);
[588]130 bool generatePS_PDF(QString,int,QImage);
[731]131 void showMovieParametersDialog();
[735]132 void initMovieParameters();
[741]133 QString createTempFolder();
134 QString removeTempFolder();
[744]135 void startPauseVideo();
136 void stopVideo();
137 void setRecordingStatus(RECORDING_STEP);
138 void setRecordingInfos(QString);
[754]139 QString getProcessErrorMsg();
[586]140
[744]141
[600]142#if QT_VERSION < 0x040000
143 QPopupMenu *fContextMenu;
144#else
[561]145 QMenu *fContextMenu;
[600]146#endif
[744]147
[713]148 mouseActions fMouseAction; // 1: rotate 2:move 3:pick 4:shortcuts
[798]149 QPoint fLastPos1;
150 QPoint fLastPos2;
151 QPoint fLastPos3;
[713]152 /** delta of scene rotation. This delta is put in degree */
153 G4double fDeltaRotation;
[702]154 /** delta of scene translation. This delta is put in % of the scene view */
[712]155 G4double fDeltaSceneTranslation;
156 /** delta of depth move. This delta is put in % of the scene view */
157 G4double fDeltaDepth;
158 /** delta of zoom move. This delta is put in % of the scene view */
159 G4double fDeltaZoom;
[721]160 /** delta of auto move/rotation. This delta is put in % of the move/rotation param */
161 G4double fDeltaMove;
[702]162 /** To ensure key event are keep one by one */
[721]163 bool fHoldKeyEvent;
[728]164 /** To ensure move event are keep one by one */
165 bool fHoldMoveEvent;
166 /** To ensure rotate event are keep one by one */
167 bool fHoldRotateEvent;
[720]168 bool fAutoMove;
[730]169 QString fEncoderPath;
[732]170 QString fTempFolderPath;
[738]171 QString fMovieTempFolderPath;
[733]172 QString fSaveFileName;
[740]173 QString fParameterFileName;
[717]174 QAction *fRotateAction;
175 QAction *fMoveAction;
176 QAction *fPickAction;
177 QAction *fFullScreenOn;
178 QAction *fFullScreenOff;
[561]179 QAction *fDrawingWireframe;
180 QAction *fDrawingLineRemoval;
181 QAction *fDrawingSurfaceRemoval;
182 QAction *fDrawingLineSurfaceRemoval;
[732]183 G4OpenGLQtMovieDialog* fMovieParametersDialog;
[744]184 RECORDING_STEP fRecordingStep;
[749]185 QProcess *fProcess;
[797]186 QTime *fLastEventTime;
187 int fSpinningDelay;
[798]188 int fLaunchSpinDelay;
[561]189
190private slots :
[678]191 void actionMouseRotate();
[713]192 void actionMouseMove();
[681]193 void actionMousePick();
[561]194 void actionDrawingWireframe();
195 void actionDrawingLineRemoval();
196 void actionDrawingSurfaceRemoval();
197 void actionDrawingLineSurfaceRemoval();
[731]198 void actionSaveImage();
199 void actionMovieParameters();
[565]200
[721]201 void showShortcuts();
[561]202 void toggleDrawingAction(int);
[678]203 void toggleMouseAction(mouseActions);
[561]204 void toggleRepresentation(bool);
[702]205 void toggleProjection(bool);
[561]206 void toggleBackground(bool);
207 void toggleTransparency(bool);
208 void toggleAntialiasing(bool);
209 void toggleHaloing(bool);
210 void toggleAux(bool);
[717]211 void toggleFullScreen(bool);
[754]212 void processEncodeFinished();
213 void processLookForFinished();
214 void processEncodeStdout();
[656]215 // Only use for Qt>4.0
[711]216 // void dialogClosed();
[530]217};
218
219#endif
220
221#endif
Note: See TracBrowser for help on using the repository browser.