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

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

r832@wl-72126: garnier | 2008-05-13 18:30:21 +0200
mise a jour du SPINNING

  • 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);
[797]107 void rotateScene(int, int);
108 void moveScene(int, int, int,bool);
[561]109
[600]110
[530]111protected:
112 G4int WinSize_x;
113 G4int WinSize_y;
[536]114 QGLWidget* fWindow;
[541]115 QDialog* GLWindow;
[720]116 bool hasPendingEvents();
[739]117 void savePPMToTemp();
[723]118 int fRecordFrameNumber;
[561]119
[530]120private:
[745]121 enum mouseActions {STYLE1,STYLE2,STYLE3,STYLE4};
[751]122 enum RECORDING_STEP {WAIT,START,PAUSE,CONTINUE,STOP,READY_TO_ENCODE,ENCODING,FAILED,SUCCESS};
[745]123
[561]124 void createPopupMenu();
125 void createRadioAction(QAction *,QAction *, const std::string&,unsigned int a=1);
[585]126 void rescaleImage(int, int);
[588]127 bool generateEPS(QString,int,QImage);
[652]128 bool generateVectorEPS (QString,int,int,QImage);
[588]129 bool generatePS_PDF(QString,int,QImage);
[731]130 void showMovieParametersDialog();
[735]131 void initMovieParameters();
[741]132 QString createTempFolder();
133 QString removeTempFolder();
[744]134 void startPauseVideo();
135 void stopVideo();
136 void setRecordingStatus(RECORDING_STEP);
137 void setRecordingInfos(QString);
[754]138 QString getProcessErrorMsg();
[586]139
[744]140
[600]141#if QT_VERSION < 0x040000
142 QPopupMenu *fContextMenu;
143#else
[561]144 QMenu *fContextMenu;
[600]145#endif
[744]146
[713]147 mouseActions fMouseAction; // 1: rotate 2:move 3:pick 4:shortcuts
[696]148 QPoint fLastPos;
[721]149 /** delta X of move event */
150 G4double fDeltaPosX;
151 /** delta Y of move event */
152 G4double fDeltaPosY;
[713]153 /** delta of scene rotation. This delta is put in degree */
154 G4double fDeltaRotation;
[702]155 /** delta of scene translation. This delta is put in % of the scene view */
[712]156 G4double fDeltaSceneTranslation;
157 /** delta of depth move. This delta is put in % of the scene view */
158 G4double fDeltaDepth;
159 /** delta of zoom move. This delta is put in % of the scene view */
160 G4double fDeltaZoom;
[721]161 /** delta of auto move/rotation. This delta is put in % of the move/rotation param */
162 G4double fDeltaMove;
[702]163 /** To ensure key event are keep one by one */
[721]164 bool fHoldKeyEvent;
[728]165 /** To ensure move event are keep one by one */
166 bool fHoldMoveEvent;
167 /** To ensure rotate event are keep one by one */
168 bool fHoldRotateEvent;
[720]169 bool fAutoMove;
[730]170 QString fEncoderPath;
[732]171 QString fTempFolderPath;
[738]172 QString fMovieTempFolderPath;
[733]173 QString fSaveFileName;
[740]174 QString fParameterFileName;
[717]175 QAction *fRotateAction;
176 QAction *fMoveAction;
177 QAction *fPickAction;
178 QAction *fFullScreenOn;
179 QAction *fFullScreenOff;
[561]180 QAction *fDrawingWireframe;
181 QAction *fDrawingLineRemoval;
182 QAction *fDrawingSurfaceRemoval;
183 QAction *fDrawingLineSurfaceRemoval;
[732]184 G4OpenGLQtMovieDialog* fMovieParametersDialog;
[744]185 RECORDING_STEP fRecordingStep;
[749]186 QProcess *fProcess;
[797]187 QTime *fLastEventTime;
188 int fSpinningDelay;
[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.