Geant4 11.3.0
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 ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
virtual G4bool ReadyToDraw ()
 
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
virtual 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 *)
 
virtual void DoneWithMasterThread ()
 
virtual void MovingToVisSubThread ()
 
virtual void SwitchToVisSubThread ()
 
virtual void DoneWithVisSubThread ()
 
virtual void MovingToMasterThread ()
 
virtual void SwitchToMasterThread ()
 
void InsertModelInSceneTree (G4VModel *)
 
const G4SceneTreeItemGetSceneTree ()
 
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 ()
 
virtual void SetView ()
 
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)
 
bool IsGettingPickInfos () const
 
- 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 ()
 
- Public Attributes inherited from G4VViewer
const G4int fMaxNTouchables = 10000
 
G4bool fCurtailDescent = false
 
- 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.
 
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{
51#if QT_VERSION < 0x060000
53
54 setFocusPolicy(Qt::StrongFocus); // enable keybord events
55 fHasToRepaint = false;
56 fPaintEventLock = false;
57 fUpdateGLLock = false;
58
59 if (fViewId < 0) return; // In case error in base class instantiation.
60#else
61 setFocusPolicy(Qt::StrongFocus); // enable keybord events
62#endif
63}
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 65 of file G4OpenGLImmediateQtViewer.cc.

65{}

Member Function Documentation

◆ contextMenuEvent()

void G4OpenGLImmediateQtViewer::contextMenuEvent ( QContextMenuEvent * e)
protected

Definition at line 297 of file G4OpenGLImmediateQtViewer.cc.

298{
300}
void G4manageContextMenuEvent(QContextMenuEvent *e)

◆ DrawView()

void G4OpenGLImmediateQtViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 118 of file G4OpenGLImmediateQtViewer.cc.

118 {
119#if QT_VERSION < 0x060000
120#else
121 if(IsGettingPickInfos()) {
122 paintGL();
123 return;
124 }
125#endif
128 }
129}
bool IsGettingPickInfos() const
G4bool IsMasterThread()

◆ Initialise()

void G4OpenGLImmediateQtViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 67 of file G4OpenGLImmediateQtViewer.cc.

67 {
68#if QT_VERSION < 0x060000
69
71 CreateMainWindow (this,QString(GetName()));
72
73 makeCurrent();
74 glDrawBuffer (GL_BACK);
75
76 // set the good tab active
77 if (G4QGLWidgetType::parentWidget()) {
78 auto *parentTab = dynamic_cast<QTabWidget*> (G4QGLWidgetType::parentWidget()->parent()) ;
79 if (parentTab) {
80 parentTab->setCurrentIndex(parentTab->count()-1);
81 }
82 }
83
85#else
86 CreateMainWindow (this,QString(GetName()));
87 // Set jpg as default export format for Qt viewer
89#endif
90}
virtual void CreateMainWindow(G4QGLWidgetType *, const QString &)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool setExportImageFormat(std::string format, bool quiet=false)
const G4String & GetName() const

◆ initializeGL()

void G4OpenGLImmediateQtViewer::initializeGL ( )

Definition at line 93 of file G4OpenGLImmediateQtViewer.cc.

93 {
94
96
97 // If a double buffer context has been forced upon us, ignore the
98 // back buffer for this OpenGLImmediate view.
99 // glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
100
101 if (fSceneHandler.GetScene() == 0) {
102 fHasToRepaint =false;
103 } else {
104 fHasToRepaint =true;
105 }
106
107 // Set the component visible
108
109 // and update it immediatly before wait for SessionStart() (batch mode)
110// QCoreApplication::sendPostedEvents () ;
111
112 // Set jpg as default export format for Qt viewer
114}
G4VSceneHandler & fSceneHandler
Definition G4VViewer.hh:253

◆ keyPressEvent()

void G4OpenGLImmediateQtViewer::keyPressEvent ( QKeyEvent * event)
protected

Definition at line 253 of file G4OpenGLImmediateQtViewer.cc.

254{
255 G4keyPressEvent(event);
256}
void G4keyPressEvent(QKeyEvent *event)

◆ keyReleaseEvent()

void G4OpenGLImmediateQtViewer::keyReleaseEvent ( QKeyEvent * event)
protected

Definition at line 258 of file G4OpenGLImmediateQtViewer.cc.

259{
260 G4keyReleaseEvent(event);
261}
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 281 of file G4OpenGLImmediateQtViewer.cc.

282{
284}

◆ mouseMoveEvent()

void G4OpenGLImmediateQtViewer::mouseMoveEvent ( QMouseEvent * event)
protected

Definition at line 291 of file G4OpenGLImmediateQtViewer.cc.

292{
293 G4MouseMoveEvent(event);
294}
void G4MouseMoveEvent(QMouseEvent *event)

◆ mousePressEvent()

void G4OpenGLImmediateQtViewer::mousePressEvent ( QMouseEvent * event)
protected

Definition at line 248 of file G4OpenGLImmediateQtViewer.cc.

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

◆ mouseReleaseEvent()

void G4OpenGLImmediateQtViewer::mouseReleaseEvent ( QMouseEvent * event)
protected

Definition at line 286 of file G4OpenGLImmediateQtViewer.cc.

287{
288 G4MouseReleaseEvent(event);
289}
void G4MouseReleaseEvent(QMouseEvent *evnt)

◆ paintEvent()

void G4OpenGLImmediateQtViewer::paintEvent ( QPaintEvent * event)
protected

Definition at line 303 of file G4OpenGLImmediateQtViewer.cc.

303 {
305 return;
306 }
307 // Force a repaint next time if the FRAMEBUFFER is not READY
309 if ( fHasToRepaint) {
310#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
311 updateGL();
312#else
313 // Not sure this is correct....
314 paintGL();
315#endif
316 }
317}
G4bool isFramebufferReady()

◆ paintGL()

void G4OpenGLImmediateQtViewer::paintGL ( )

Definition at line 184 of file G4OpenGLImmediateQtViewer.cc.

185{
186#if QT_VERSION < 0x060000
188#else
189 //G.Barrand: don't do any change in the GUI here, just "paint" this widget!
190#endif
191
192#if QT_VERSION < 0x060000
193 if (fPaintEventLock) {
194// return ;
195 }
197 fPaintEventLock = false;
198 return;
199 }
200 if ((getWinWidth() == 0) && (getWinHeight() == 0)) {
201 return;
202 }
203
204 // DO NOT RESIZE IF SIZE HAS NOT CHANGE
205 if ( !fHasToRepaint) {
206 // L. Garnier : Trap to get the size with mac OSX 10.6 and Qt 4.6(devel)
207 // Tested on Qt4.5 on mac, 4.4 on windows, 4.5 on unbuntu
208 int sw = 0;
209 int sh = 0;
210 if (!isMaximized() && !isFullScreen()) {
211 sw = normalGeometry().width();
212 sh = normalGeometry().height();
213 } else {
214 sw = frameGeometry().width();
215 sh = frameGeometry().height();
216 }
217 if ((getWinWidth() == (unsigned int)sw) &&(getWinHeight() == (unsigned int)sh)) {
218 return;
219
220 } else if ((sw == 0) && (sh == 0)) { // NOT A TOP LEVEL WIDGET
221 if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) {
222 return;
223 }
224 }
225 }
226#else
227 if ((getWinWidth() == 0) && (getWinHeight() == 0)) return; //G.Barrand: needed?
228#endif
229
230#if QT_VERSION < 0x060000
231#else
233 glDrawBuffer (GL_BACK);
234#endif
235
236 SetView();
237
238 ClearView (); //ok, put the background correct
239 ComputeView();
240
241#if QT_VERSION < 0x060000
242 fHasToRepaint = false; // could be set to false by ComputeView
243
244 fPaintEventLock = false;
245#endif
246}
void updateToolbarAndMouseContextMenu()
virtual void SetView()
unsigned int getWinHeight() const
unsigned int getWinWidth() const
virtual void ClearView()

Referenced by DrawView(), and 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 169 of file G4OpenGLImmediateQtViewer.cc.

172{
173 if ((aWidth > 0) && (aHeight > 0)) {
174#if QT_VERSION < 0x060000
175 ResizeWindow(aWidth,aHeight);
177#else
178 ResizeWindow(devicePixelRatio()*aWidth,devicePixelRatio()*aHeight);
179#endif
180 }
181}
void ResizeWindow(unsigned int, unsigned int)
G4bool sizeHasChanged()

◆ showEvent()

void G4OpenGLImmediateQtViewer::showEvent ( QShowEvent * event)
protected

Definition at line 269 of file G4OpenGLImmediateQtViewer.cc.

270{
272 fHasToRepaint = true;
273 }
274}

◆ ShowView()

void G4OpenGLImmediateQtViewer::ShowView ( void )
virtual

Reimplemented from G4VViewer.

Definition at line 345 of file G4OpenGLImmediateQtViewer.cc.

346{
347#if QT_VERSION < 0x060000
348 fHasToRepaint = true;
349 activateWindow();
350#else
351 activateWindow();
352 ((QApplication*)G4Qt::getInstance ())->processEvents();
353#endif
354}
static G4Qt * getInstance()
Definition G4Qt.cc:51

◆ updateQWidget()

void G4OpenGLImmediateQtViewer::updateQWidget ( )
virtual

Implements G4OpenGLQtViewer.

Definition at line 321 of file G4OpenGLImmediateQtViewer.cc.

321 {
322#if QT_VERSION < 0x060000
323 if (fUpdateGLLock) {
324 return;
325 }
326
327 if (! isCurrentWidget()){
328 return;
329 }
330
331 fUpdateGLLock = true;
332 fHasToRepaint= true;
333 repaint();
336 fUpdateGLLock= false;
337#else
338 //if (!isCurrentWidget()) return; //G.Barrand: Qt must know if it has to activate paintGL() if the widget is not visible.
339 //G.Barrand: don't do any change in the GUI here, just ask to "paint" this widget!
340 update();
341#endif
342}
void updateViewerPropertiesTableWidget()

Referenced by DrawView().

◆ wheelEvent()

void G4OpenGLImmediateQtViewer::wheelEvent ( QWheelEvent * event)
protected

Definition at line 263 of file G4OpenGLImmediateQtViewer.cc.

264{
265 G4wheelEvent(event);
266}
void G4wheelEvent(QWheelEvent *event)

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