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

Last change on this file since 1128 was 1127, checked in by garnier, 16 years ago

pb quand on ne met pas la vis QT corrige

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