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

#include <G4VtkQtViewer.hh>

+ Inheritance diagram for G4VtkQtViewer:

Public Types

using PVNodeID = G4PhysicalVolumeModel::G4PhysicalVolumeNodeID
 
using PVPath = std::vector<PVNodeID>
 

Public Member Functions

 G4VtkQtViewer (G4VSceneHandler &, const G4String &name)
 
 ~G4VtkQtViewer () override
 
void Initialise () override
 
virtual void CreateMainWindow (QVTKOpenGLNativeWidget *, const QString &)
 
void FinishView () override
 
void createSceneTreeWidget ()
 
void createSceneTreeComponent ()
 
QTreeWidgetItem * createTreeWidgetItem (const PVPath &fullPath, const QString &name, int copyNb, int POIndex, const QString &logicalName, Qt::CheckState state, QTreeWidgetItem *parentTreeNode, const G4Colour &color)
 
void addNonPVSceneTreeElement (const G4String &model, G4Visible &visible, int currentPOIndex)
 
void addPVSceneTreeElement (const G4String &model, G4PhysicalVolumeModel *pPVModel, int currentPOIndex)
 
QString getModelShortName (const G4String &model)
 
bool parseAndInsertInSceneTree (QTreeWidgetItem *parentItem, G4PhysicalVolumeModel *pPVModel, unsigned int fullPathIndex, const QString &parentRoot, unsigned int currentIndexInTreeSceneHandler, int currentPVPOIndex)
 
void EnableClipperWidget () override
 
void SetWidgetInteractor (vtkAbstractWidget *widget) override
 
- Public Member Functions inherited from G4VtkViewer
 G4VtkViewer (G4VSceneHandler &, const G4String &name)
 
void Initialise () override
 
 ~G4VtkViewer () override
 
void SetView () override
 
void ClearView () override
 
void DrawView () override
 
void ShowView () override
 
void FinishView () override
 
void ExportScreenShot (G4String, G4String)
 
void ExportOBJScene (G4String)
 
void ExportVRMLScene (G4String)
 
void ExportVTPScene (G4String)
 
void ExportGLTFScene (G4String)
 
void ExportJSONRenderWindowScene (G4String)
 
void ExportVTPCutter (G4String fileName)
 
void ExportFormatStore (G4String fileName, G4String store)
 
void DrawShadows ()
 
void EnableShadows ()
 
void DisableShadows ()
 
void AddViewHUD ()
 
void EnableHUD ()
 
void DisableHUD ()
 
virtual void AddClipperPlaneWidget (const G4Plane3D &plane)
 
void EnableClipper (const G4Plane3D &plane, G4bool widget)
 
void DisableClipper ()
 
virtual void DisableClipperWidget ()
 
virtual void AddCutterPlaneWidget (const G4Plane3D &plane)
 
void EnableCutter (const G4Plane3D &plane, G4bool bWidget)
 
void DisableCutter (G4String name)
 
virtual void EnableCutterWidget ()
 
virtual void DisableCutterWidget ()
 
virtual void AddCameraOrientationWidget ()
 
virtual void EnableCameraOrientationWidget ()
 
virtual void DisableCameraOrientationWidget ()
 
void AddImageOverlay (const G4String &fileName, const G4double alpha, const G4double imageBottomLeft[2], const G4double worldBottomLeft[2], const G4double imageTopRight[2], const G4double worldTopRight[2], const G4double rot[3], const G4double trans[3])
 
void AddGeometryOverlay (const G4String &fileName, const G4double colour[3], const G4double alpha, const G4String &representation, const G4double scale[3], const G4double rotation[3], const G4double translation[3])
 
void Render ()
 
void StartInteractor ()
 
void Print ()
 
void SetPolyhedronPipeline (const G4String &t)
 
void ExportView ()
 
void SetGeant4View ()
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void ResetView ()
 
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
 
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 ()
 

Additional Inherited Members

- Public Attributes inherited from G4VtkViewer
vtkNew< vtkTextActor > infoTextActor
 
vtkNew< vtkInfoCallbackinfoCallback
 
vtkNew< vtkGeant4Callbackgeant4Callback
 
vtkSmartPointer< vtkLight > light
 
vtkNew< vtkCamera > camera
 
vtkNew< vtkRenderer > renderer
 
vtkRenderWindow * _renderWindow
 
vtkRenderWindowInteractor * renderWindowInteractor
 
- 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 &)
 
- Protected Attributes inherited from G4VtkViewer
G4bool firstSetView = true
 
G4bool firstFinishView = true
 
G4double cameraDistance
 
vtkNew< vtkImplicitPlaneRepresentation > cutterPlaneRepresentation
 
vtkNew< vtkImplicitPlaneWidget2 > cutterPlaneWidget
 
vtkNew< vtkImplicitPlaneRepresentation > clipperPlaneRepresentation
 
vtkNew< vtkImplicitPlaneWidget2 > clipperPlaneWidget
 
vtkNew< vtkCameraOrientationWidget > camOrientWidget
 
bool bCutter = false
 
bool bClipper = false
 
bool bHud = false
 
bool bOrientation = false
 
- 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 50 of file G4VtkQtViewer.hh.

Member Typedef Documentation

◆ PVNodeID

◆ PVPath

using G4VtkQtViewer::PVPath = std::vector<PVNodeID>

Definition at line 54 of file G4VtkQtViewer.hh.

Constructor & Destructor Documentation

◆ G4VtkQtViewer()

G4VtkQtViewer::G4VtkQtViewer ( G4VSceneHandler & sceneHandler,
const G4String & name )

Definition at line 69 of file G4VtkQtViewer.cc.

70 : G4VtkViewer(sceneHandler, name)
71{
72 lWaitForVisSubThreadQtOpenGLContextInitialized =
73 new G4AutoLock(mWaitForVisSubThreadQtOpenGLContextInitialized, std::defer_lock);
74 lWaitForVisSubThreadQtOpenGLContextMoved =
75 new G4AutoLock(mWaitForVisSubThreadQtOpenGLContextMoved, std::defer_lock);
76
78 //this->setFormat(QVTKOpenGLNativeWidget::defaultFormat());
79}
G4TemplateAutoLock< G4Mutex > G4AutoLock
static G4Qt * getInstance()
Definition G4Qt.cc:51
G4VtkViewer(G4VSceneHandler &, const G4String &name)

◆ ~G4VtkQtViewer()

G4VtkQtViewer::~G4VtkQtViewer ( )
override

Definition at line 81 of file G4VtkQtViewer.cc.

82{
83 delete lWaitForVisSubThreadQtOpenGLContextInitialized;
84 delete lWaitForVisSubThreadQtOpenGLContextMoved;
85}

Member Function Documentation

◆ addNonPVSceneTreeElement()

void G4VtkQtViewer::addNonPVSceneTreeElement ( const G4String & model,
G4Visible & visible,
int currentPOIndex )

Definition at line 246 of file G4VtkQtViewer.cc.

248{}

◆ addPVSceneTreeElement()

void G4VtkQtViewer::addPVSceneTreeElement ( const G4String & model,
G4PhysicalVolumeModel * pPVModel,
int currentPOIndex )

Definition at line 250 of file G4VtkQtViewer.cc.

253{}

◆ CreateMainWindow()

void G4VtkQtViewer::CreateMainWindow ( QVTKOpenGLNativeWidget * vtkWidget,
const QString & name )
virtual

Definition at line 112 of file G4VtkQtViewer.cc.

113{
115 fUiQt = static_cast<G4UIQt*>(UI->GetG4UIWindow());
116 fUiQt->AddTabWidget((QWidget*)vtkWidget, name);
117 vtkWidget->setAttribute(Qt::WA_AcceptTouchEvents, false);
118 fGLWidget = vtkWidget;
120}
G4bool AddTabWidget(QWidget *, QString)
Definition G4UIQt.cc:2283
G4UIsession * GetG4UIWindow() const
static G4UImanager * GetUIpointer()
void createSceneTreeWidget()

Referenced by Initialise().

◆ createSceneTreeComponent()

void G4VtkQtViewer::createSceneTreeComponent ( )

Definition at line 234 of file G4VtkQtViewer.cc.

234{}

◆ createSceneTreeWidget()

void G4VtkQtViewer::createSceneTreeWidget ( )

Definition at line 232 of file G4VtkQtViewer.cc.

232{}

Referenced by CreateMainWindow().

◆ createTreeWidgetItem()

QTreeWidgetItem * G4VtkQtViewer::createTreeWidgetItem ( const PVPath & fullPath,
const QString & name,
int copyNb,
int POIndex,
const QString & logicalName,
Qt::CheckState state,
QTreeWidgetItem * parentTreeNode,
const G4Colour & color )

Definition at line 237 of file G4VtkQtViewer.cc.

241{
242 QTreeWidgetItem* newItem = nullptr;
243 return newItem;
244}

◆ EnableClipperWidget()

void G4VtkQtViewer::EnableClipperWidget ( )
overridevirtual

Reimplemented from G4VtkViewer.

Definition at line 271 of file G4VtkQtViewer.cc.

272{
274 auto qGLW = dynamic_cast<QVTKOpenGLNativeWidget*>(fGLWidget);
275 qGLW->interactor()->Initialize();
276}
virtual void EnableClipperWidget()

◆ FinishView()

void G4VtkQtViewer::FinishView ( void )
overridevirtual

Reimplemented from G4VViewer.

Definition at line 220 of file G4VtkQtViewer.cc.

221{
222 auto& fVtkSceneHandler = dynamic_cast<G4VtkSceneHandler&>(fSceneHandler);
223 fVtkSceneHandler.Modified();
224
225 _renderWindow->Render();
226
227 auto qGLW = dynamic_cast<QVTKOpenGLNativeWidget*>(fGLWidget);
228 qGLW->interactor()->Initialize();
229 qGLW->interactor()->Start();
230}
G4VSceneHandler & fSceneHandler
Definition G4VViewer.hh:253
vtkRenderWindow * _renderWindow

◆ getModelShortName()

QString G4VtkQtViewer::getModelShortName ( const G4String & model)

Definition at line 255 of file G4VtkQtViewer.cc.

256{
257 QString modelShortName;
258 return modelShortName;
259}

◆ Initialise()

void G4VtkQtViewer::Initialise ( )
overridevirtual

Reimplemented from G4VViewer.

Definition at line 87 of file G4VtkQtViewer.cc.

88{
89 CreateMainWindow(this, QString(GetName()));
90
91 // Specific GL render window and interactor for Qt
92 _renderWindow = vtkGenericOpenGLRenderWindow::New();
93
94 _renderWindow->AddRenderer(renderer);
95 this->setRenderWindow(_renderWindow);
96
97 // Set callback to match VTK parameters to Geant4
98 geant4Callback->SetGeant4ViewParameters(&fVP);
99 renderer->AddObserver(vtkCommand::EndEvent, geant4Callback);
100
101 // Hidden line removal
102 renderer->SetUseHiddenLineRemoval(0);
103
104 // Shadows
105 renderer->SetUseShadows(0);
106
109 this->interactor()->SetInteractorStyle(style);
110}
const G4String & GetName() const
G4ViewParameters fVP
Definition G4VViewer.hh:257
virtual void CreateMainWindow(QVTKOpenGLNativeWidget *, const QString &)
vtkNew< vtkGeant4Callback > geant4Callback
vtkNew< vtkRenderer > renderer

◆ parseAndInsertInSceneTree()

bool G4VtkQtViewer::parseAndInsertInSceneTree ( QTreeWidgetItem * parentItem,
G4PhysicalVolumeModel * pPVModel,
unsigned int fullPathIndex,
const QString & parentRoot,
unsigned int currentIndexInTreeSceneHandler,
int currentPVPOIndex )

Definition at line 261 of file G4VtkQtViewer.cc.

267{
268 return false;
269}

◆ SetWidgetInteractor()

void G4VtkQtViewer::SetWidgetInteractor ( vtkAbstractWidget * widget)
overridevirtual

Reimplemented from G4VtkViewer.

Definition at line 278 of file G4VtkQtViewer.cc.

279{
280 auto qGLW = dynamic_cast<QVTKOpenGLNativeWidget*>(fGLWidget);
281 widget->SetInteractor(qGLW->interactor());
282}

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