Geant4 11.3.0
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 ExportX3DScene (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 ()
 
virtual G4bool ReadyToDraw ()
 
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
 
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
 
- Public Attributes inherited from G4VViewer
const G4int fMaxNTouchables = 10000
 
G4bool fCurtailDescent = false
 
- 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.
 
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 58 of file G4VtkQtViewer.cc.

59 : G4VtkViewer(sceneHandler, name)
60{
62 //this->setFormat(QVTKOpenGLNativeWidget::defaultFormat());
63}
static G4Qt * getInstance()
Definition G4Qt.cc:51
G4VtkViewer(G4VSceneHandler &, const G4String &name)

◆ ~G4VtkQtViewer()

G4VtkQtViewer::~G4VtkQtViewer ( )
override

Definition at line 65 of file G4VtkQtViewer.cc.

66{
67}

Member Function Documentation

◆ addNonPVSceneTreeElement()

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

Definition at line 229 of file G4VtkQtViewer.cc.

231{}

◆ addPVSceneTreeElement()

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

Definition at line 233 of file G4VtkQtViewer.cc.

236{}

◆ CreateMainWindow()

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

Definition at line 94 of file G4VtkQtViewer.cc.

95{
96 G4UImanager* UI = G4UImanager::GetUIpointer();
97 fUiQt = static_cast<G4UIQt*>(UI->GetG4UIWindow());
98 fUiQt->AddTabWidget((QWidget*)vtkWidget, name);
99 vtkWidget->setAttribute(Qt::WA_AcceptTouchEvents, false);
100 fGLWidget = vtkWidget;
102}
G4UIsession * GetG4UIWindow() const
static G4UImanager * GetUIpointer()
void createSceneTreeWidget()

Referenced by Initialise().

◆ createSceneTreeComponent()

void G4VtkQtViewer::createSceneTreeComponent ( )

Definition at line 217 of file G4VtkQtViewer.cc.

217{}

◆ createSceneTreeWidget()

void G4VtkQtViewer::createSceneTreeWidget ( )

Definition at line 215 of file G4VtkQtViewer.cc.

215{}

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 220 of file G4VtkQtViewer.cc.

224{
225 QTreeWidgetItem* newItem = nullptr;
226 return newItem;
227}

◆ EnableClipperWidget()

void G4VtkQtViewer::EnableClipperWidget ( )
overridevirtual

Reimplemented from G4VtkViewer.

Definition at line 254 of file G4VtkQtViewer.cc.

255{
257 auto qGLW = dynamic_cast<QVTKOpenGLNativeWidget*>(fGLWidget);
258 qGLW->interactor()->Initialize();
259}
virtual void EnableClipperWidget()

◆ FinishView()

void G4VtkQtViewer::FinishView ( void )
overridevirtual

Reimplemented from G4VViewer.

Definition at line 203 of file G4VtkQtViewer.cc.

204{
205 auto& fVtkSceneHandler = dynamic_cast<G4VtkSceneHandler&>(fSceneHandler);
206 fVtkSceneHandler.Modified();
207
208 _renderWindow->Render();
209
210 auto qGLW = dynamic_cast<QVTKOpenGLNativeWidget*>(fGLWidget);
211 qGLW->interactor()->Initialize();
212 qGLW->interactor()->Start();
213}
G4VSceneHandler & fSceneHandler
Definition G4VViewer.hh:253
vtkRenderWindow * _renderWindow

◆ getModelShortName()

QString G4VtkQtViewer::getModelShortName ( const G4String & model)

Definition at line 238 of file G4VtkQtViewer.cc.

239{
240 QString modelShortName;
241 return modelShortName;
242}

◆ Initialise()

void G4VtkQtViewer::Initialise ( )
overridevirtual

Reimplemented from G4VViewer.

Definition at line 69 of file G4VtkQtViewer.cc.

70{
71 CreateMainWindow(this, QString(GetName()));
72
73 // Specific GL render window and interactor for Qt
74 _renderWindow = vtkGenericOpenGLRenderWindow::New();
75
76 _renderWindow->AddRenderer(renderer);
77 this->setRenderWindow(_renderWindow);
78
79 // Set callback to match VTK parameters to Geant4
80 geant4Callback->SetGeant4ViewParameters(&fVP);
81 renderer->AddObserver(vtkCommand::EndEvent, geant4Callback);
82
83 // Hidden line removal
84 renderer->SetUseHiddenLineRemoval(0);
85
86 // Shadows
87 renderer->SetUseShadows(0);
88
89 vtkSmartPointer<G4VtkInteractorStyle> style =
90 vtkSmartPointer<G4VtkInteractorStyle>::New();
91 this->interactor()->SetInteractorStyle(style);
92}
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 244 of file G4VtkQtViewer.cc.

250{
251 return false;
252}

◆ SetWidgetInteractor()

void G4VtkQtViewer::SetWidgetInteractor ( vtkAbstractWidget * widget)
overridevirtual

Reimplemented from G4VtkViewer.

Definition at line 261 of file G4VtkQtViewer.cc.

262{
263 auto qGLW = dynamic_cast<QVTKOpenGLNativeWidget*>(fGLWidget);
264 widget->SetInteractor(qGLW->interactor());
265}

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