Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLImmediateQtViewer Class Reference

#include <G4OpenGLImmediateQtViewer.hh>

+ Inheritance diagram for G4OpenGLImmediateQtViewer:

Public Member Functions

 G4OpenGLImmediateQtViewer (G4OpenGLImmediateSceneHandler &scene, const G4String &name="")
 
 ~G4OpenGLImmediateQtViewer ()
 
void Initialise ()
 
void initializeGL ()
 
void DrawView ()
 
void resizeGL (int width, int height)
 
void paintGL ()
 
void updateQWidget ()
 
void ShowView ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
- Public Member Functions inherited from G4OpenGLQtViewer
 G4OpenGLQtViewer (G4OpenGLSceneHandler &scene)
 
virtual ~G4OpenGLQtViewer ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void updateSceneTreeWidget ()
 
void updateViewerPropertiesTableWidget ()
 
void updatePickInfosWidget (int, int)
 
QString setEncoderPath (QString path)
 
QString getEncoderPath ()
 
QString setTempFolderPath (QString path)
 
QString getTempFolderPath ()
 
QString setSaveFileName (QString path)
 
QString getSaveFileName ()
 
bool isRecording ()
 
bool isStopped ()
 
bool isPaused ()
 
bool isEncoding ()
 
bool isWaiting ()
 
bool isFailed ()
 
void setWaiting ()
 
bool isBadEncoder ()
 
bool isBadOutput ()
 
bool isBadTmp ()
 
bool isSuccess ()
 
void setBadTmp ()
 
void setBadOutput ()
 
void setBadEncoder ()
 
bool isReadyToEncode ()
 
void resetRecording ()
 
void encodeVideo ()
 
void stopVideo ()
 
void saveVideo ()
 
bool generateMpegEncoderParameters ()
 
void displayRecordingStatus ()
 
void DrawText (const G4Text &)
 
void ResetView ()
 
void addPVSceneTreeElement (const G4String &model, G4PhysicalVolumeModel *pPVModel, int currentPVPOIndex)
 
void addNonPVSceneTreeElement (const G4String &model, int currentPVPOIndex, const std::string &modelDescription, const G4Visible &visible)
 
bool isTouchableVisible (int POindex)
 
void clearTreeWidget ()
 
bool exportImage (std::string name="", int width=-1, int height=-1)
 
void G4MousePressEvent (QMouseEvent *event)
 
void G4wheelEvent (QWheelEvent *event)
 
void G4keyPressEvent (QKeyEvent *event)
 
void G4keyReleaseEvent (QKeyEvent *event)
 
void G4MouseDoubleClickEvent ()
 
void G4MouseReleaseEvent (QMouseEvent *evnt)
 
void G4MouseMoveEvent (QMouseEvent *event)
 
- Public Member Functions inherited from G4OpenGLViewer
void ClearView ()
 
void ClearViewWithoutFlush ()
 
bool setExportImageFormat (std::string format, bool quiet=false)
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
void RefreshView ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
SceneTreeSceneAccessSceneTreeScene ()
 
G4SceneTreeItemAccessSceneTree ()
 
void UpdateGUISceneTree ()
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
G4double GetKernelVisitElapsedTimeSeconds () const
 
void SetViewParameters (const G4ViewParameters &vp)
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
void SetNeedKernelVisit (G4bool need)
 
void NeedKernelVisit ()
 
void ProcessView ()
 
- Public Member Functions inherited from G4OpenGLImmediateViewer
 G4OpenGLImmediateViewer (G4OpenGLImmediateSceneHandler &scene)
 
void ProcessView ()
 

Protected Member Functions

void showEvent (QShowEvent *event)
 
void wheelEvent (QWheelEvent *event)
 
void mousePressEvent (QMouseEvent *event)
 
void mouseMoveEvent (QMouseEvent *event)
 
void mouseDoubleClickEvent (QMouseEvent *event)
 
void mouseReleaseEvent (QMouseEvent *event)
 
void contextMenuEvent (QContextMenuEvent *e)
 
void keyPressEvent (QKeyEvent *event)
 
void keyReleaseEvent (QKeyEvent *event)
 
void paintEvent (QPaintEvent *event)
 
- Protected Member Functions inherited from G4OpenGLQtViewer
void CreateGLQtContext ()
 
virtual void CreateMainWindow (G4QGLWidgetType *, const QString &)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void G4manageContextMenuEvent (QContextMenuEvent *e)
 
void rotateQtScene (float, float)
 
void rotateQtSceneToggle (float, float)
 
void moveScene (float, float, float, bool)
 
void FinishView ()
 
void updateKeyModifierState (const Qt::KeyboardModifiers &)
 
void displaySceneTreeComponent ()
 
G4Colour getColorForPoIndex (int poIndex)
 
const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
bool isCurrentWidget ()
 
void savePPMToTemp ()
 
- Protected Member Functions inherited from G4OpenGLViewer
 G4OpenGLViewer (G4OpenGLSceneHandler &scene)
 
virtual ~G4OpenGLViewer ()
 
void SetView ()
 
void ResetView ()
 
void ChangePointSize (G4double size)
 
void ChangeLineWidth (G4double width)
 
void HaloingFirstPass ()
 
void HaloingSecondPass ()
 
void HLRFirstPass ()
 
void HLRSecondPass ()
 
void HLRThirdPass ()
 
void InitializeGLView ()
 
void ResizeGLView ()
 
void ResizeWindow (unsigned int, unsigned int)
 
virtual G4String Pick (GLdouble x, GLdouble y)
 
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails (GLdouble x, GLdouble y)
 
virtual void CreateFontLists ()
 
void rotateScene (G4double dx, G4double dy)
 
void rotateSceneToggle (G4double dx, G4double dy)
 
void setExportSize (G4int, G4int)
 
bool setExportFilename (G4String name, G4bool inc=true)
 
std::string getRealPrintFilename ()
 
unsigned int getWinWidth () const
 
unsigned int getWinHeight () const
 
G4bool sizeHasChanged ()
 
GLdouble getSceneNearWidth ()
 
GLdouble getSceneFarWidth ()
 
GLdouble getSceneDepth ()
 
void addExportImageFormat (std::string format)
 
G4bool isGl2psWriting ()
 
G4bool isFramebufferReady ()
 
void g4GluPickMatrix (GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
 
void g4GluLookAt (GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)
 
void g4GlOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GlFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
- Protected Member Functions inherited from G4VViewer
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 

Additional Inherited Members

- Public Slots inherited from G4OpenGLQtViewer
void startPauseVideo ()
 
- Protected Slots inherited from G4OpenGLQtViewer
void updateToolbarAndMouseContextMenu ()
 
- Protected Attributes inherited from G4OpenGLQtViewer
G4UIQtfUiQt
 
QWidget * fGLWidget
 
int fRecordFrameNumber
 
bool fHasToRepaint
 
bool fUpdateGLLock
 
bool fQGLWidgetInitialiseCompleted
 
bool fPaintEventLock
 
bool fMouseOnSceneTree
 
- Protected Attributes inherited from G4OpenGLViewer
G4bool fPrintColour
 
G4bool fVectoredPs
 
G4OpenGLSceneHandlerfOpenGLSceneHandler
 
G4Colour background
 
G4bool transparency_enabled
 
G4bool antialiasing_enabled
 
G4bool haloing_enabled
 
G4gl2psfGL2PSAction
 
G4double fRot_sens
 
G4double fPan_sens
 
unsigned int fWinSize_x
 
unsigned int fWinSize_y
 
std::vector< std::string > fExportImageFormatVector
 
std::string fDefaultExportImageFormat
 
std::string fExportImageFormat
 
int fExportFilenameIndex
 
G4int fPrintSizeX
 
G4int fPrintSizeY
 
- Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4double fKernelVisitElapsedTimeSeconds = 999.
 
SceneTreeScene fSceneTreeScene
 
G4SceneTreeItem fSceneTree
 
G4bool fNeedKernelVisit
 

Detailed Description

Definition at line 42 of file G4OpenGLImmediateQtViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenGLImmediateQtViewer()

G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer ( G4OpenGLImmediateSceneHandler & scene,
const G4String & name = "" )

Definition at line 43 of file G4OpenGLImmediateQtViewer.cc.

45 :
46 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
47 G4OpenGLViewer (sceneHandler),
48 G4OpenGLQtViewer (sceneHandler),
49 G4OpenGLImmediateViewer (sceneHandler)
50{
52
53 setFocusPolicy(Qt::StrongFocus); // enable keybord events
54 fHasToRepaint = false;
55 fPaintEventLock = false;
56 fUpdateGLLock = false;
57
58 if (fViewId < 0) return; // In case error in base class instantiation.
59}
G4OpenGLImmediateViewer(G4OpenGLImmediateSceneHandler &scene)
G4OpenGLQtViewer(G4OpenGLSceneHandler &scene)
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
G4int fViewId
Definition G4VViewer.hh:254
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition G4VViewer.cc:49

◆ ~G4OpenGLImmediateQtViewer()

G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer ( )

Definition at line 61 of file G4OpenGLImmediateQtViewer.cc.

61 {
62 // makeCurrent(); // Not sure why this - commented out 12-Apr-2021 JA
63}

Member Function Documentation

◆ contextMenuEvent()

void G4OpenGLImmediateQtViewer::contextMenuEvent ( QContextMenuEvent * e)
protected

Definition at line 259 of file G4OpenGLImmediateQtViewer.cc.

260{
262}
void G4manageContextMenuEvent(QContextMenuEvent *e)

◆ DrawView()

void G4OpenGLImmediateQtViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 108 of file G4OpenGLImmediateQtViewer.cc.

108 {
109#ifdef G4MULTITHREADED
112 }
113#else
115#endif
116}
G4int G4GetThreadId()

◆ Initialise()

void G4OpenGLImmediateQtViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 65 of file G4OpenGLImmediateQtViewer.cc.

65 {
66 makeCurrent();
67
69 CreateMainWindow (this,QString(GetName()));
70
71 glDrawBuffer (GL_BACK);
72
73 // set the good tab active
74 if (G4QGLWidgetType::parentWidget()) {
75 auto *parentTab = dynamic_cast<QTabWidget*> (G4QGLWidgetType::parentWidget()->parent()) ;
76 if (parentTab) {
77 parentTab->setCurrentIndex(parentTab->count()-1);
78 }
79 }
80
82}
virtual void CreateMainWindow(G4QGLWidgetType *, const QString &)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
const G4String & GetName() const

◆ initializeGL()

void G4OpenGLImmediateQtViewer::initializeGL ( )

Definition at line 84 of file G4OpenGLImmediateQtViewer.cc.

84 {
85
87
88 // If a double buffer context has been forced upon us, ignore the
89 // back buffer for this OpenGLImmediate view.
90 // glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
91
92 if (fSceneHandler.GetScene() == 0) {
93 fHasToRepaint =false;
94 } else {
95 fHasToRepaint =true;
96 }
97
98 // Set the component visible
99
100 // and update it immediatly before wait for SessionStart() (batch mode)
101// QCoreApplication::sendPostedEvents () ;
102
103 // Set jpg as default export format for Qt viewer
105}
bool setExportImageFormat(std::string format, bool quiet=false)
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition G4VViewer.hh:253

◆ keyPressEvent()

void G4OpenGLImmediateQtViewer::keyPressEvent ( QKeyEvent * event)
protected

Definition at line 216 of file G4OpenGLImmediateQtViewer.cc.

217{
218 G4keyPressEvent(event);
219}
void G4keyPressEvent(QKeyEvent *event)

◆ keyReleaseEvent()

void G4OpenGLImmediateQtViewer::keyReleaseEvent ( QKeyEvent * event)
protected

Definition at line 221 of file G4OpenGLImmediateQtViewer.cc.

222{
223 G4keyReleaseEvent(event);
224}
void G4keyReleaseEvent(QKeyEvent *event)

◆ mouseDoubleClickEvent()

void G4OpenGLImmediateQtViewer::mouseDoubleClickEvent ( QMouseEvent * event)
protected

This function was build in order to make a zoom on double clic event. It was think to build a rubberband on the zoom area, but never work fine

Definition at line 243 of file G4OpenGLImmediateQtViewer.cc.

244{
246}

◆ mouseMoveEvent()

void G4OpenGLImmediateQtViewer::mouseMoveEvent ( QMouseEvent * event)
protected

Definition at line 253 of file G4OpenGLImmediateQtViewer.cc.

254{
255 G4MouseMoveEvent(event);
256}
void G4MouseMoveEvent(QMouseEvent *event)

◆ mousePressEvent()

void G4OpenGLImmediateQtViewer::mousePressEvent ( QMouseEvent * event)
protected

Definition at line 211 of file G4OpenGLImmediateQtViewer.cc.

212{
213 G4MousePressEvent(event);
214}
void G4MousePressEvent(QMouseEvent *event)

◆ mouseReleaseEvent()

void G4OpenGLImmediateQtViewer::mouseReleaseEvent ( QMouseEvent * event)
protected

Definition at line 248 of file G4OpenGLImmediateQtViewer.cc.

249{
250 G4MouseReleaseEvent(event);
251}
void G4MouseReleaseEvent(QMouseEvent *evnt)

◆ paintEvent()

void G4OpenGLImmediateQtViewer::paintEvent ( QPaintEvent * event)
protected

Definition at line 264 of file G4OpenGLImmediateQtViewer.cc.

264 {
266 return;
267 }
268 // Force a repaint next time if the FRAMEBUFFER is not READY
270 if ( fHasToRepaint) {
271#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
272 updateGL();
273#else
274 // Not sure this is correct....
275 paintGL();
276#endif
277 }
278}
G4bool isFramebufferReady()

◆ paintGL()

void G4OpenGLImmediateQtViewer::paintGL ( )

Definition at line 163 of file G4OpenGLImmediateQtViewer.cc.

164{
166
167 if (fPaintEventLock) {
168// return ;
169 }
171 fPaintEventLock = false;
172 return;
173 }
174 if ((getWinWidth() == 0) && (getWinHeight() == 0)) {
175 return;
176 }
177
178 // DO NOT RESIZE IF SIZE HAS NOT CHANGE
179 if ( !fHasToRepaint) {
180 // L. Garnier : Trap to get the size with mac OSX 10.6 and Qt 4.6(devel)
181 // Tested on Qt4.5 on mac, 4.4 on windows, 4.5 on unbuntu
182 int sw = 0;
183 int sh = 0;
184 if (!isMaximized() && !isFullScreen()) {
185 sw = normalGeometry().width();
186 sh = normalGeometry().height();
187 } else {
188 sw = frameGeometry().width();
189 sh = frameGeometry().height();
190 }
191 if ((getWinWidth() == (unsigned int)sw) &&(getWinHeight() == (unsigned int)sh)) {
192 return;
193
194 } else if ((sw == 0) && (sh == 0)) { // NOT A TOP LEVEL WIDGET
195 if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) {
196 return;
197 }
198 }
199 }
200
201 SetView();
202
203 ClearView (); //ok, put the background correct
204 ComputeView();
205
206 fHasToRepaint = false; // could be set to false by ComputeView
207
208 fPaintEventLock = false;
209}
void updateToolbarAndMouseContextMenu()
unsigned int getWinHeight() const
unsigned int getWinWidth() const

Referenced by paintEvent().

◆ resizeGL()

void G4OpenGLImmediateQtViewer::resizeGL ( int aWidth,
int aHeight )
  • Lors du resize de la fenetre, on doit non pas redessiner le detecteur, mais aussi les evenements

Definition at line 152 of file G4OpenGLImmediateQtViewer.cc.

155{
156 if ((aWidth > 0) && (aHeight > 0)) {
157 ResizeWindow(aWidth,aHeight);
159 }
160}
void ResizeWindow(unsigned int, unsigned int)
G4bool sizeHasChanged()

◆ showEvent()

void G4OpenGLImmediateQtViewer::showEvent ( QShowEvent * event)
protected

Definition at line 231 of file G4OpenGLImmediateQtViewer.cc.

232{
234 fHasToRepaint = true;
235 }
236}

◆ ShowView()

void G4OpenGLImmediateQtViewer::ShowView ( void )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Reimplemented from G4VViewer.

Definition at line 299 of file G4OpenGLImmediateQtViewer.cc.

303{
304 fHasToRepaint = true;
305 activateWindow();
306}

◆ updateQWidget()

void G4OpenGLImmediateQtViewer::updateQWidget ( )
virtual

Implements G4OpenGLQtViewer.

Definition at line 281 of file G4OpenGLImmediateQtViewer.cc.

281 {
282 if (fUpdateGLLock) {
283 return;
284 }
285
286 if (! isCurrentWidget()){
287 return;
288 }
289
290 fUpdateGLLock = true;
291 fHasToRepaint= true;
292 repaint();
295 fUpdateGLLock= false;
296}
void updateViewerPropertiesTableWidget()

Referenced by DrawView().

◆ wheelEvent()

void G4OpenGLImmediateQtViewer::wheelEvent ( QWheelEvent * event)
protected

Definition at line 226 of file G4OpenGLImmediateQtViewer.cc.

227{
228 G4wheelEvent(event);
229}
void G4wheelEvent(QWheelEvent *event)

The documentation for this class was generated from the following files: