g4display
Loading...
Searching...
No Matches
G4SceneProperties Class Reference

Helper for constructing Geant4 visualization command sequences. More...

#include <g4SceneProperties.h>

Public Member Functions

 G4SceneProperties (const std::shared_ptr< GOptions > &gopts)
 Construct a scene-properties helper bound to a set of options.
std::vector< std::string > addSceneTexts (const std::shared_ptr< GOptions > &gopts)
 Build commands that insert configured text annotations into the scene.
std::vector< std::string > addSceneDecorations (const std::shared_ptr< GOptions > &gopts)
 Build commands for optional scene decorations such as scale, axes, logos, and frame.
std::vector< std::string > scene_commands (const std::shared_ptr< GOptions > &gopts)
 Build the full command sequence for scene initialization.
Public Member Functions inherited from GBase< G4SceneProperties >
 GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
virtual ~GBase ()
GBaseoperator= (const GBase &)=default

Additional Inherited Members

Protected Attributes inherited from GBase< G4SceneProperties >
std::shared_ptr< GLoggerlog

Detailed Description

G4SceneProperties encapsulates the “policy” of how a scene is initialized from options:

  • determine whether GUI mode is enabled (--gui),
  • optionally enable DAWN output (--useDawn),
  • open a viewer driver and apply initial camera/viewer settings.

The helper does not apply commands directly; it returns a list of command strings so the caller can decide when to execute them (typically right after the Geant4 visualization system is initialized).

Definition at line 39 of file g4SceneProperties.h.

Constructor & Destructor Documentation

◆ G4SceneProperties()

G4SceneProperties::G4SceneProperties ( const std::shared_ptr< GOptions > & gopts)
inlineexplicit
Parameters
goptsShared options object used for module configuration and logging.

Definition at line 47 of file g4SceneProperties.h.

Member Function Documentation

◆ addSceneDecorations()

std::vector< std::string > G4SceneProperties::addSceneDecorations ( const std::shared_ptr< GOptions > & gopts)
Parameters
goptsShared options object used to read decoration configuration.
Returns
Vector of Geant4 commands that add configured decorations.

Definition at line 94 of file g4SceneProperties.cc.

◆ addSceneTexts()

std::vector< std::string > G4SceneProperties::addSceneTexts ( const std::shared_ptr< GOptions > & gopts)

The g4text option is parsed into a list of g4display::G4SceneText objects, and then mapped to Geant4 commands of the form:

  • /vis/scene/add/text (3D text that belongs to the scene),
  • /vis/scene/add/text2D (2D overlay text).

For each entry the method:

  • sets /vis/set/textColour,
  • optionally sets /vis/set/textLayout,
  • issues the appropriate /vis/scene/add/... command with position and size,
  • restores text layout and color defaults where needed.
Parameters
goptsShared options object used to read text configuration.
Returns
Vector of Geant4 command strings that insert the configured text into the current scene.

Definition at line 122 of file g4SceneProperties.cc.

◆ scene_commands()

std::vector< std::string > G4SceneProperties::scene_commands ( const std::shared_ptr< GOptions > & gopts)

The returned command list typically includes:

  • optional DAWN viewer setup (when useDawn is enabled),
  • viewer open and initial configuration (when gui is enabled),
  • scene creation and attachment after the viewer exists,
  • adding the initialized GEMC root volume so the scene has an extent,
  • camera direction and precision settings.

The Geant4 world must be initialized before the returned commands are applied.

Parameters
goptsShared options object used to derive viewer/camera configuration.
Returns
Vector of Geant4 command strings for scene initialization.

Definition at line 36 of file g4SceneProperties.cc.


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