37#include <qcoreapplication.h>
41#include <qopenglcontext.h>
42#include <qpushbutton.h>
44#include <qtreewidget.h>
47#include <vtkCylinderSource.h>
48#include <vtkGenericOpenGLRenderWindow.h>
49#include <vtkNamedColors.h>
51#include <vtkPolyDataMapper.h>
52#include <vtkProperty.h>
53#include <vtkRenderer.h>
54#include <vtkVersion.h>
84 renderer->SetUseHiddenLineRemoval(0);
91 this->interactor()->SetInteractorStyle(style);
99 vtkWidget->setAttribute(Qt::WA_AcceptTouchEvents,
false);
100 fGLWidget = vtkWidget;
104#ifdef G4MULTITHREADED
109 G4bool visSubThreadEstablished =
false;
110 G4bool qObjectsSwitched =
false;
111 QVTKOpenGLNativeWidget* qVtkW =
nullptr;
119 qVtkW =
dynamic_cast<QVTKOpenGLNativeWidget*
>(fGLWidget);
120 if (qVtkW ==
nullptr)
return;
123 qVtkW->doneCurrent();
126 fQVtkContextMainThread = QThread::currentThread();
133 if (qVtkW ==
nullptr)
return;
142 if(qVtkW->context()) qVtkW->context()->moveToThread(fQVtkContextVisSubThread);
146 qObjectsSwitched =
true;
155 if (qVtkW ==
nullptr)
return;
157 fQVtkContextVisSubThread = QThread::currentThread();
162 visSubThreadEstablished =
true;
173 qVtkW->makeCurrent();
180 if (qVtkW ==
nullptr)
return;
183 qVtkW->doneCurrent();
186 if(qVtkW->context()) qVtkW->context()->moveToThread(fQVtkContextMainThread);
193 if (qVtkW ==
nullptr)
return;
195 qVtkW->makeCurrent();
197 visSubThreadEstablished =
false;
198 qObjectsSwitched =
false;
210 auto qGLW =
dynamic_cast<QVTKOpenGLNativeWidget*
>(fGLWidget);
211 qGLW->interactor()->Initialize();
212 qGLW->interactor()->Start();
221 int ,
int ,
const QString& ,
222 Qt::CheckState , QTreeWidgetItem* ,
225 QTreeWidgetItem* newItem =
nullptr;
240 QString modelShortName;
241 return modelShortName;
257 auto qGLW =
dynamic_cast<QVTKOpenGLNativeWidget*
>(fGLWidget);
258 qGLW->interactor()->Initialize();
263 auto qGLW =
dynamic_cast<QVTKOpenGLNativeWidget*
>(fGLWidget);
264 widget->SetInteractor(qGLW->interactor());
G4TemplateAutoLock< G4Mutex > G4AutoLock
#define G4CONDITION_INITIALIZER
#define G4MUTEX_INITIALIZER
#define G4CONDITIONWAITLAMBDA(cond, mutex, lambda)
#define G4CONDITIONBROADCAST(cond)
static G4Qt * getInstance()
G4bool AddTabWidget(QWidget *, QString)
G4UIsession * GetG4UIWindow() const
static G4UImanager * GetUIpointer()
const G4String & GetName() const
virtual void DoneWithMasterThread()
G4VSceneHandler & fSceneHandler
virtual void SwitchToMasterThread()
virtual void SwitchToVisSubThread()
virtual void MovingToVisSubThread()
virtual void DoneWithVisSubThread()
void addNonPVSceneTreeElement(const G4String &model, G4Visible &visible, int currentPOIndex)
void createSceneTreeWidget()
~G4VtkQtViewer() override
virtual void CreateMainWindow(QVTKOpenGLNativeWidget *, const QString &)
bool parseAndInsertInSceneTree(QTreeWidgetItem *parentItem, G4PhysicalVolumeModel *pPVModel, unsigned int fullPathIndex, const QString &parentRoot, unsigned int currentIndexInTreeSceneHandler, int currentPVPOIndex)
QString getModelShortName(const G4String &model)
void Initialise() override
G4VtkQtViewer(G4VSceneHandler &, const G4String &name)
std::vector< PVNodeID > PVPath
void SetWidgetInteractor(vtkAbstractWidget *widget) override
void EnableClipperWidget() override
void createSceneTreeComponent()
void addPVSceneTreeElement(const G4String &model, G4PhysicalVolumeModel *pPVModel, int currentPOIndex)
void FinishView() override
QTreeWidgetItem * createTreeWidgetItem(const PVPath &fullPath, const QString &name, int copyNb, int POIndex, const QString &logicalName, Qt::CheckState state, QTreeWidgetItem *parentTreeNode, const G4Colour &color)
vtkNew< vtkGeant4Callback > geant4Callback
virtual void EnableClipperWidget()
G4VtkViewer(G4VSceneHandler &, const G4String &name)
vtkNew< vtkRenderer > renderer
vtkRenderWindow * _renderWindow