Geant4 11.2.2
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 ()=default
 
 ~SceneTreeScene ()=default
 
void SetViewer (G4VViewer *pViewer)
 
void SetModel (G4VModel *pModel)
 
- 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
 

Additional Inherited Members

- Protected Member Functions inherited from G4PseudoScene
- Protected Attributes inherited from G4PseudoScene
const G4Transform3DfpCurrentObjectTransformation = nullptr
 
const G4VisAttributesfpVisAttributes = nullptr
 

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 ( )
default

◆ ~SceneTreeScene()

G4VViewer::SceneTreeScene::~SceneTreeScene ( )
default

Member Function Documentation

◆ SetModel()

void G4VViewer::SceneTreeScene::SetModel ( G4VModel * pModel)

Definition at line 234 of file G4VViewer.cc.

235{
236 fpModel = pModel;
237
238 // Insert in tree (if not already inserted)
239 auto& modelType = fpModel->GetType();
240 auto& modelID = fpModel->GetGlobalDescription();
241 FindOrInsertModel(modelType, modelID);
242
243 auto pvModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
244 if (pvModel) {
245 // Limit the expanded depth to limit the number expanded so as not to swamp the GUI
246 G4int expanded = 0;
247 for (const auto& dn : pvModel->GetNumberOfTouchables()) {
248 expanded += dn.second;
249 if (fMaximumExpandedDepth < dn.first) fMaximumExpandedDepth = dn.first;
250 if (expanded > fMaximumExpanded) break;
251 }
252 }
253}
int G4int
Definition G4Types.hh:85
const G4String & GetGlobalDescription() const
const G4String & GetType() const

◆ SetViewer()

void G4VViewer::SceneTreeScene::SetViewer ( G4VViewer * pViewer)
inline

Definition at line 176 of file G4VViewer.hh.

176{fpViewer = pViewer;}

Referenced by G4VSceneHandler::DrawEndOfRunModels(), G4VSceneHandler::DrawEvent(), and G4VSceneHandler::ProcessScene().


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