Geant4 11.1.1
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 void updateQWidget ()=0
 
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 ()
 
virtual bool exportImage (std::string name="", int width=-1, int height=-1)
 
bool setExportImageFormat (std::string format, bool quiet=false)
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void Initialise ()
 
virtual void ResetView ()
 
virtual void SetView ()=0
 
virtual void ClearView ()=0
 
virtual void DrawView ()=0
 
void RefreshView ()
 
virtual void ShowView ()
 
virtual void FinishView ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
G4double GetKernelVisitElapsedTimeSeconds () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () 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 (QGLWidget *, 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 ()
 
virtual void DrawText (const G4Text &)
 
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
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.
 
G4bool fNeedKernelVisit
 

Detailed Description

Definition at line 44 of file G4OpenGLImmediateQtViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenGLImmediateQtViewer()

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

Definition at line 47 of file G4OpenGLImmediateQtViewer.cc.

49 :
50 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
51 G4OpenGLViewer (sceneHandler),
52 G4OpenGLQtViewer (sceneHandler),
53 G4OpenGLImmediateViewer (sceneHandler)
54{
56
57 setFocusPolicy(Qt::StrongFocus); // enable keybord events
58 fHasToRepaint = false;
59 fPaintEventLock = false;
60
61 // Create a new drawer
62 // register the QtDrawer to the OpenGLViewer
63#ifdef G4OPENGL_VERSION_2
64 setVboDrawer(new G4OpenGLVboDrawer(this,"OGL-VBO"));
65#endif
66
67 fUpdateGLLock = false;
68
69 if (fViewId < 0) return; // In case error in base class instantiation.
70}
G4int fViewId
Definition: G4VViewer.hh:217

◆ ~G4OpenGLImmediateQtViewer()

G4OpenGLImmediateQtViewer::~G4OpenGLImmediateQtViewer ( )

Definition at line 72 of file G4OpenGLImmediateQtViewer.cc.

72 {
73 // makeCurrent(); // Not sure why this - commented out 12-Apr-2021 JA
74}

Member Function Documentation

◆ contextMenuEvent()

void G4OpenGLImmediateQtViewer::contextMenuEvent ( QContextMenuEvent *  e)
protected

Definition at line 305 of file G4OpenGLImmediateQtViewer.cc.

306{
308}
void G4manageContextMenuEvent(QContextMenuEvent *e)

◆ DrawView()

void G4OpenGLImmediateQtViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 154 of file G4OpenGLImmediateQtViewer.cc.

154 {
155#ifdef G4MULTITHREADED
158 }
159#else
161#endif
162}
G4int G4GetThreadId()
Definition: G4Threading.cc:122

◆ Initialise()

void G4OpenGLImmediateQtViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 76 of file G4OpenGLImmediateQtViewer.cc.

76 {
77 makeCurrent();
78
80 CreateMainWindow (this,QString(GetName()));
81
82 glDrawBuffer (GL_BACK);
83
84 // set the good tab active
85 if (QGLWidget::parentWidget()) {
86 QTabWidget *parentTab = dynamic_cast<QTabWidget*> (QGLWidget::parentWidget()->parent()) ;
87 if (parentTab) {
88 parentTab->setCurrentIndex(parentTab->count()-1);
89 }
90 }
91
93}
virtual void CreateMainWindow(QGLWidget *, const QString &)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
const G4String & GetName() const

◆ initializeGL()

void G4OpenGLImmediateQtViewer::initializeGL ( )

Definition at line 95 of file G4OpenGLImmediateQtViewer.cc.

95 {
96
97#ifndef G4OPENGL_VERSION_2
99#else
100 QGLShaderProgram *aQGLShaderProgram = new QGLShaderProgram (context());
101 fShaderProgram = aQGLShaderProgram->programId ();
102
103 aQGLShaderProgram->addShaderFromSourceCode(QGLShader::Vertex,
104 fVboDrawer->getVertexShaderSrc());
105
106 aQGLShaderProgram->addShaderFromSourceCode(QGLShader::Fragment,
107 fVboDrawer->getFragmentShaderSrc());
108
109 aQGLShaderProgram->link();
110 aQGLShaderProgram->bind();
111
112 fVertexPositionAttribute = glGetAttribLocation(fShaderProgram, "aVertexPosition");
113 fcMatrixUniform = glGetUniformLocation(fShaderProgram, "uCMatrix");
114 fpMatrixUniform = glGetUniformLocation(fShaderProgram, "uPMatrix");
115 ftMatrixUniform = glGetUniformLocation(fShaderProgram, "uTMatrix");
116 fmvMatrixUniform = glGetUniformLocation(fShaderProgram, "uMVMatrix");
117
118 // Load identity at beginning
119 float identity[16] = {
120 1.0f, 0, 0, 0,
121 0, 1.0f, 0, 0,
122 0, 0, 1.0f, 0,
123 0, 0, 0, 1.0f
124 };
125 glUniformMatrix4fv (fcMatrixUniform, 1, 0, identity);
126 glUniformMatrix4fv (fpMatrixUniform, 1, 0, identity);
127 glUniformMatrix4fv (ftMatrixUniform, 1, 0, identity);
128 glUniformMatrix4fv(fmvMatrixUniform, 1, 0, identity);
129
130 glUseProgram(fShaderProgram);
131
132#endif
133
134 // If a double buffer context has been forced upon us, ignore the
135 // back buffer for this OpenGLImmediate view.
136 // glDrawBuffer (GL_FRONT); // FIXME : Ne marche pas avec cette ligne, mais affiche le run correctement...
137
138 if (fSceneHandler.GetScene() == 0) {
139 fHasToRepaint =false;
140 } else {
141 fHasToRepaint =true;
142 }
143
144 // Set the component visible
145
146 // and update it immediatly before wait for SessionStart() (batch mode)
147// QCoreApplication::sendPostedEvents () ;
148
149 // Set jpg as default export format for Qt viewer
151}
bool setExportImageFormat(std::string format, bool quiet=false)
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:216

◆ keyPressEvent()

void G4OpenGLImmediateQtViewer::keyPressEvent ( QKeyEvent *  event)
protected

Definition at line 262 of file G4OpenGLImmediateQtViewer.cc.

263{
264 G4keyPressEvent(event);
265}
void G4keyPressEvent(QKeyEvent *event)

◆ keyReleaseEvent()

void G4OpenGLImmediateQtViewer::keyReleaseEvent ( QKeyEvent *  event)
protected

Definition at line 267 of file G4OpenGLImmediateQtViewer.cc.

268{
269 G4keyReleaseEvent(event);
270}
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 289 of file G4OpenGLImmediateQtViewer.cc.

290{
292}

◆ mouseMoveEvent()

void G4OpenGLImmediateQtViewer::mouseMoveEvent ( QMouseEvent *  event)
protected

Definition at line 299 of file G4OpenGLImmediateQtViewer.cc.

300{
301 G4MouseMoveEvent(event);
302}
void G4MouseMoveEvent(QMouseEvent *event)

◆ mousePressEvent()

void G4OpenGLImmediateQtViewer::mousePressEvent ( QMouseEvent *  event)
protected

Definition at line 257 of file G4OpenGLImmediateQtViewer.cc.

258{
259 G4MousePressEvent(event);
260}
void G4MousePressEvent(QMouseEvent *event)

◆ mouseReleaseEvent()

void G4OpenGLImmediateQtViewer::mouseReleaseEvent ( QMouseEvent *  event)
protected

Definition at line 294 of file G4OpenGLImmediateQtViewer.cc.

295{
296 G4MouseReleaseEvent(event);
297}
void G4MouseReleaseEvent(QMouseEvent *evnt)

◆ paintEvent()

void G4OpenGLImmediateQtViewer::paintEvent ( QPaintEvent *  event)
protected

Definition at line 310 of file G4OpenGLImmediateQtViewer.cc.

310 {
312 return;
313 }
314 // Force a repaint next time if the FRAMEBUFFER is not READY
316 if ( fHasToRepaint) {
317 updateGL();
318 }
319}
G4bool isFramebufferReady()

◆ paintGL()

void G4OpenGLImmediateQtViewer::paintGL ( )

Definition at line 209 of file G4OpenGLImmediateQtViewer.cc.

210{
212
213 if (fPaintEventLock) {
214// return ;
215 }
217 fPaintEventLock = false;
218 return;
219 }
220 if ((getWinWidth() == 0) && (getWinHeight() == 0)) {
221 return;
222 }
223
224 // DO NOT RESIZE IF SIZE HAS NOT CHANGE
225 if ( !fHasToRepaint) {
226 // L. Garnier : Trap to get the size with mac OSX 10.6 and Qt 4.6(devel)
227 // Tested on Qt4.5 on mac, 4.4 on windows, 4.5 on unbuntu
228 int sw = 0;
229 int sh = 0;
230 if (!isMaximized() && !isFullScreen()) {
231 sw = normalGeometry().width();
232 sh = normalGeometry().height();
233 } else {
234 sw = frameGeometry().width();
235 sh = frameGeometry().height();
236 }
237 if ((getWinWidth() == (unsigned int)sw) &&(getWinHeight() == (unsigned int)sh)) {
238 return;
239
240 } else if ((sw == 0) && (sh == 0)) { // NOT A TOP LEVEL WIDGET
241 if (((getWinWidth() == (unsigned int)width())) &&(getWinHeight() == (unsigned int) height())) {
242 return;
243 }
244 }
245 }
246
247 SetView();
248
249 ClearView (); //ok, put the background correct
250 ComputeView();
251
252 fHasToRepaint = false; // could be set to false by ComputeView
253
254 fPaintEventLock = false;
255}
void updateToolbarAndMouseContextMenu()
unsigned int getWinHeight() const
unsigned int getWinWidth() const

◆ 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 198 of file G4OpenGLImmediateQtViewer.cc.

201{
202 if ((aWidth > 0) && (aHeight > 0)) {
203 ResizeWindow(aWidth,aHeight);
205 }
206}
void ResizeWindow(unsigned int, unsigned int)
G4bool sizeHasChanged()

◆ showEvent()

void G4OpenGLImmediateQtViewer::showEvent ( QShowEvent *  event)
protected

Definition at line 277 of file G4OpenGLImmediateQtViewer.cc.

278{
280 fHasToRepaint = true;
281 }
282}

◆ ShowView()

void G4OpenGLImmediateQtViewer::ShowView ( void  )
virtual

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

Reimplemented from G4VViewer.

Definition at line 340 of file G4OpenGLImmediateQtViewer.cc.

344{
345 fHasToRepaint = true;
346 activateWindow();
347}

◆ updateQWidget()

void G4OpenGLImmediateQtViewer::updateQWidget ( )
virtual

Implements G4OpenGLQtViewer.

Definition at line 322 of file G4OpenGLImmediateQtViewer.cc.

322 {
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}
void updateViewerPropertiesTableWidget()

Referenced by DrawView().

◆ wheelEvent()

void G4OpenGLImmediateQtViewer::wheelEvent ( QWheelEvent *  event)
protected

Definition at line 272 of file G4OpenGLImmediateQtViewer.cc.

273{
274 G4wheelEvent(event);
275}
void G4wheelEvent(QWheelEvent *event)

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