Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VViewer::SceneTreeScene Class Reference

#include <G4VViewer.hh>

Inheritance diagram for G4VViewer::SceneTreeScene:

Public Member Functions

 SceneTreeScene (G4VViewer *, G4PhysicalVolumeModel *)
 ~SceneTreeScene ()=default
Public Member Functions inherited from G4PseudoScene
 G4PseudoScene ()=default
virtual ~G4PseudoScene ()=default
void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &visAttributes)
void PostAddSolid ()
void AddSolid (const G4Box &solid)
void AddSolid (const G4Cons &solid)
void AddSolid (const G4Orb &solid)
void AddSolid (const G4Para &solid)
void AddSolid (const G4Sphere &solid)
void AddSolid (const G4Torus &solid)
void AddSolid (const G4Trap &solid)
void AddSolid (const G4Trd &solid)
void AddSolid (const G4Tubs &solid)
void AddSolid (const G4Ellipsoid &solid)
void AddSolid (const G4Polycone &solid)
void AddSolid (const G4Polyhedra &solid)
void AddSolid (const G4TessellatedSolid &solid)
void AddSolid (const G4VSolid &solid)
void AddCompound (const G4VTrajectory &)
void AddCompound (const G4VHit &)
void AddCompound (const G4VDigi &)
void AddCompound (const G4THitsMap< G4double > &)
void AddCompound (const G4THitsMap< G4StatDouble > &)
void AddCompound (const G4Mesh &)
void BeginPrimitives (const G4Transform3D &)
void EndPrimitives ()
void BeginPrimitives2D (const G4Transform3D &)
void EndPrimitives2D ()
void AddPrimitive (const G4Polyline &)
void AddPrimitive (const G4Text &)
void AddPrimitive (const G4Circle &)
void AddPrimitive (const G4Square &)
void AddPrimitive (const G4Polymarker &)
void AddPrimitive (const G4Polyhedron &)
void AddPrimitive (const G4Plotter &)
Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
virtual ~G4VGraphicsScene ()
virtual const G4VisExtentGetExtent () const
G4int GetMaxGeometryDepth () const
void SetMaxGeometryDepth (G4int maxDepth)

Additional Inherited Members

Protected Attributes inherited from G4PseudoScene
const G4Transform3DfpCurrentObjectTransformation = nullptr
const G4VisAttributesfpVisAttributes = nullptr
Protected Attributes inherited from G4VGraphicsScene
G4int fMaxGeometryDepth = 0

Detailed Description

  • The scene tree is a tree of G4SceneTreeItem objects (see graphics-reps).
  • Its root is a data member fSceneTree of all viewers by virtue of G4VViewer inheritance,
  • G4SceneTreeItem is an aggregate of data members that represent properties of objects in the scene (G4Scene). Its data members are low-level types - G4String, G4VisAttributes and G4AttDef/Value - so that it can be used across categories, avoiding coupling.
  • The root item has children that represent the models (G4VModel sub-classes) in the scene.
  • For a G4PhysicalVolumeModel (detector components), its children and children's children, etc., imitate the geometry hierarchy of that model. These descendants are called "touchables".
  • There may be more than one G4PhysicalVolumeModel, depending how the user creates his/her scene.
  • The scene tree is reviewed, and updated if necessary, at every pass of G4VSceneHandler::ProcessScene. This is called a "kernel visit".
  • A kernel visit is triggered by some vis commands (e.g., /vis/viewer/rebuild) and by a viewer if it deems necessary. For example, a kernel visit may not be required for a rotation, zoom, etc., but required for a change from surface to wireframe.
  • The idea is that the scene tree can be passed to a GUI, the GUI can create a tree widget, and interactions with it raise UI commands such as /vis/scene/activateModel, /vis/set/touchable and /vis/touchable/set/... The viewer decides if this requires a kernel visit, otherwise it must update fSceneTree itself (utilities are provided - G4VViewer::TouchableSetVisibility/Colour).

Definition at line 171 of file G4VViewer.hh.

Constructor & Destructor Documentation

◆ SceneTreeScene()

G4VViewer::SceneTreeScene::SceneTreeScene ( G4VViewer * pViewer,
G4PhysicalVolumeModel * pPVModel )

Definition at line 408 of file G4VViewer.cc.

409: fpViewer (pViewer)
410, fpPVModel(pPVModel)
411{
412 if (fpPVModel == nullptr) {
413 G4Exception("G4VViewer::SceneTreeScene::SceneTreeScene", "visman0405", FatalException,
414 "G4PhysicalVolumeModel pointer is null");
415 return; // To keep Coverity happy
416 }
417
418 // Limit the expanded depth to limit the number expanded so as not to swamp the GUI
419 G4int expanded = 0;
420 for (const auto& dn : fpPVModel->GetMapOfDrawnTouchables()) {
421 expanded += dn.second;
422 if (fMaximumExpandedDepth < dn.first) fMaximumExpandedDepth = dn.first;
423 if (expanded > fMaximumExpanded) break;
424 }
425
426 // Find appropriate model and its iterator
427 const auto& modelID = fpPVModel->GetGlobalDescription();
428 auto& modelItems = fpViewer->fSceneTree.AccessChildren();
429 fModelIter = modelItems.begin();
430 for (; fModelIter != modelItems.end(); ++fModelIter) {
431 if (fModelIter->GetModelDescription() == modelID) break;
432 }
433 if (fModelIter == modelItems.end()) {
434 G4Exception("G4VViewer::SceneTreeScene::SceneTreeScene", "visman0406", JustWarning,
435 "Model not found");
436 }
437}
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
int G4int
Definition G4Types.hh:85

◆ ~SceneTreeScene()

G4VViewer::SceneTreeScene::~SceneTreeScene ( )
default

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