33#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
40#include <qapplication.h>
42G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
43(G4OpenGLStoredSceneHandler& sceneHandler,
45 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
46 G4OpenGLViewer (sceneHandler),
47 G4OpenGLQtViewer (sceneHandler),
48 G4OpenGLStoredViewer (sceneHandler),
52 setFocusPolicy(Qt::StrongFocus);
53 fHasToRepaint =
false;
54 fIsRepainting =
false;
56 resize(fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
58 if (fViewId < 0)
return;
61G4OpenGLStoredQtViewer::~G4OpenGLStoredQtViewer() {
68void G4OpenGLStoredQtViewer::Initialise() {
70 printf(
"G4OpenGLStoredQtViewer::Initialise 1\n");
72 fReadyToPaint =
false;
73 CreateMainWindow (
this,QString(GetName()));
75 glDrawBuffer (GL_BACK);
80void G4OpenGLStoredQtViewer::initializeGL () {
85 printf(
"G4OpenGLStoredQtViewer::InitialiseGL () 1 %d\n",
this);
88 if (fSceneHandler.GetScene() == 0) {
98 QCoreApplication::sendPostedEvents () ;
100#ifdef G4DEBUG_VIS_OGL
101 printf(
"G4OpenGLStoredQtViewer::InitialiseGL END\n");
115 (lastVP.
IsCulling () != fVP.IsCulling ()) ||
119 (lastVP.
IsSection () != fVP.IsSection ()) ||
123 (lastVP.
IsCutaway () != fVP.IsCutaway ()) ||
126 (lastVP.
IsExplode () != fVP.IsExplode ()) ||
129 fVP.GetDefaultVisAttributes()->
GetColour()) ||
131 fVP.GetDefaultTextVisAttributes()->
GetColour()) ||
133 (lastVP.
IsPicking () != fVP.IsPicking ())
171G4bool G4OpenGLStoredQtViewer::POSelected(
size_t POListIndex)
173 return isTouchableVisible(POListIndex);
176G4bool G4OpenGLStoredQtViewer::TOSelected(
size_t)
181void G4OpenGLStoredQtViewer::DrawView () {
185void G4OpenGLStoredQtViewer::ComputeView () {
187#ifdef G4DEBUG_VIS_OGL
188 printf(
"G4OpenGLStoredQtViewer::ComputeView %d %d VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n",getWinWidth(), getWinHeight());
199 if (!fNeedKernelVisit) {
200 KernelVisitDecision ();
202 G4bool kernelVisitWasNeeded = fNeedKernelVisit;
208#ifdef G4DEBUG_VIS_OGL
209 printf(
"G4OpenGLStoredQtViewer::ComputeView DANS LE IF\n");
216 HaloingSecondPass ();
225 if (!kernelVisitWasNeeded) {
226#ifdef G4DEBUG_VIS_OGL
227 printf(
"************************** G4OpenGLStoredQtViewer::ComputeView Don't need kernel Visit \n");
232#ifdef G4DEBUG_VIS_OGL
233 printf(
"************************** G4OpenGLStoredQtViewer::ComputeView need kernel Visit \n");
237 if (fVP.IsCutaway() &&
242#ifdef G4DEBUG_VIS_OGL
243 printf(
"*************************** CASE 4 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
256#ifdef G4DEBUG_VIS_OGL
257 printf(
"G4OpenGLStoredQtViewer::ComputeView %d %d ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n",getWinWidth(), getWinHeight());
259 fHasToRepaint =
true;
266void G4OpenGLStoredQtViewer::resizeGL(
271 if ((aWidth > 0) && (aHeight > 0)) {
272 ResizeWindow(aWidth,aHeight);
273 fHasToRepaint = sizeHasChanged();
283void G4OpenGLStoredQtViewer::paintGL()
285 updateToolbarAndMouseContextMenu();
287#ifdef G4DEBUG_VIS_OGL
288 printf(
"G4OpenGLStoredQtViewer::paintGL \n");
293 fIsRepainting =
true;
294#ifdef G4DEBUG_VIS_OGL
295 printf(
"G4OpenGLStoredQtViewer::paintGL ready:%d fHasTo:%d??\n",fReadyToPaint,fHasToRepaint);
297 if (!fReadyToPaint) {
304 if ( !fHasToRepaint) {
309 if (!isMaximized() && !isFullScreen()) {
310 sw = normalGeometry().width();
311 sh = normalGeometry().height();
313 sw = frameGeometry().width();
314 sh = frameGeometry().height();
316 if ((getWinWidth() == (
unsigned int)sw) &&(getWinHeight() == (
unsigned int)sh)) {
320#ifdef G4DEBUG_VIS_OGL
321 printf(
"G4OpenGLStoredQtViewer::paintGL VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV ready %d\n",fReadyToPaint);
329 fHasToRepaint =
false;
332 displaySceneTreeComponent();
333#ifdef G4DEBUG_VIS_OGL
334 printf(
"G4OpenGLStoredQtViewer::paintGL ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ready %d\n",fReadyToPaint);
336 fIsRepainting =
false;
339void G4OpenGLStoredQtViewer::paintEvent(QPaintEvent *) {
340 if ( fHasToRepaint) {
345void G4OpenGLStoredQtViewer::mousePressEvent(QMouseEvent *event)
347 G4MousePressEvent(event);
350void G4OpenGLStoredQtViewer::keyPressEvent (QKeyEvent * event)
352 G4keyPressEvent(event);
355void G4OpenGLStoredQtViewer::wheelEvent (QWheelEvent * event)
360void G4OpenGLStoredQtViewer::showEvent (QShowEvent *)
362 fHasToRepaint =
true;
369void G4OpenGLStoredQtViewer::mouseDoubleClickEvent(QMouseEvent *)
371 G4MouseDoubleClickEvent();
374void G4OpenGLStoredQtViewer::mouseReleaseEvent(QMouseEvent *)
376 G4MouseReleaseEvent();
379void G4OpenGLStoredQtViewer::mouseMoveEvent(QMouseEvent *event)
381 G4MouseMoveEvent(event);
385void G4OpenGLStoredQtViewer::contextMenuEvent(QContextMenuEvent *e)
387 G4manageContextMenuEvent(e);
390void G4OpenGLStoredQtViewer::updateQWidget() {
393 fHasToRepaint=
false;
396void G4OpenGLStoredQtViewer::ShowView (
412void G4OpenGLStoredQtViewer::DisplayTimePOColourModification (
415 c = getColorForPoIndex(poIndex);
static G4bool GetColour(const G4String &key, G4Colour &result)
G4int GetNoOfSides() const
G4double GetExplodeFactor() const
const G4Colour & GetBackgroundColour() const
const G4VisAttributes * GetDefaultTextVisAttributes() const
G4bool IsCullingInvisible() const
RepStyle GetRepStyle() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
G4bool IsCullingCovered() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
const G4Colour & GetColour() const