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 > 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="")
 
 GBase (const std::shared_ptr< GLogger > &logger)
 
 GBase (const GBase &)=default
 
 GBase (GBase &&) noexcept=default
 
virtual ~GBase ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=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,
  • add optional text annotations configured via the g4text option.

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 40 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 48 of file g4SceneProperties.h.

Member Function Documentation

◆ 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 text, when the Z coordinate is explicitly provided).

For each entry the method:

  • sets /vis/set/textColour,
  • issues the appropriate /vis/scene/add/... command with position and size,
  • restores the default text color by issuing /vis/set/textColour with no arguments.
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 63 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:

  • scene creation (/vis/scene/create),
  • optional DAWN viewer setup (when useDawn is enabled),
  • viewer open and initial configuration (when gui is enabled),
  • insertion of scene texts (when configured),
  • camera direction and precision settings.
Parameters
goptsShared options object used to derive viewer/camera configuration.
Returns
Vector of Geant4 command strings for scene initialization.

Definition at line 18 of file g4SceneProperties.cc.


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