Geant4  10.02.p03
G4VisCommandSceneAddUserAction Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddUserAction:
Collaboration diagram for G4VisCommandSceneAddUserAction:

Public Member Functions

 G4VisCommandSceneAddUserAction ()
 
virtual ~G4VisCommandSceneAddUserAction ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandScene
 G4VVisCommandScene ()
 
virtual ~G4VVisCommandScene ()
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Types

enum  ActionType { runDuration, endOfEvent, endOfRun }
 

Private Member Functions

 G4VisCommandSceneAddUserAction (const G4VisCommandSceneAddUserAction &)
 
G4VisCommandSceneAddUserActionoperator= (const G4VisCommandSceneAddUserAction &)
 
void AddVisAction (const G4String &name, G4VUserVisAction *, G4Scene *, ActionType, G4VisManager::Verbosity)
 

Private Attributes

G4UIcmdWithAStringfpCommand
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
static const G4ColourGetCurrentColour ()
 
static G4double GetCurrentLineWidth ()
 
static const G4ColourGetCurrentTextColour ()
 
static G4Text::Layout GetCurrentTextLayout ()
 
static G4double GetCurrentTextSize ()
 
- Protected Member Functions inherited from G4VVisCommandScene
G4String CurrentSceneName ()
 
- Protected Member Functions inherited from G4VVisCommand
void UpdateVisManagerScene (const G4String &sceneName="")
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
 

Detailed Description

Definition at line 398 of file G4VisCommandsSceneAdd.hh.

Member Enumeration Documentation

◆ ActionType

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddUserAction() [1/2]

G4VisCommandSceneAddUserAction::G4VisCommandSceneAddUserAction ( )

Definition at line 2566 of file G4VisCommandsSceneAdd.cc.

2566  {
2567  G4bool omitable;
2568  fpCommand = new G4UIcmdWithAString("/vis/scene/add/userAction",this);
2569  fpCommand -> SetGuidance
2570  ("Add named Vis User Action to current scene.");
2571  fpCommand -> SetGuidance
2572  ("Attempts to match search string to name of action - use unique sub-string.");
2573  fpCommand -> SetGuidance
2574  ("(Use /vis/list to see names of registered actions.)");
2575  fpCommand -> SetGuidance
2576  ("If name == \"all\" (default), all actions are added.");
2577  fpCommand -> SetParameterName("action-name", omitable = true);
2578  fpCommand -> SetDefaultValue("all");
2579 }
bool G4bool
Definition: G4Types.hh:79

◆ ~G4VisCommandSceneAddUserAction()

G4VisCommandSceneAddUserAction::~G4VisCommandSceneAddUserAction ( )
virtual

Definition at line 2581 of file G4VisCommandsSceneAdd.cc.

2581  {
2582  delete fpCommand;
2583 }

◆ G4VisCommandSceneAddUserAction() [2/2]

G4VisCommandSceneAddUserAction::G4VisCommandSceneAddUserAction ( const G4VisCommandSceneAddUserAction )
private

Member Function Documentation

◆ AddVisAction()

void G4VisCommandSceneAddUserAction::AddVisAction ( const G4String name,
G4VUserVisAction visAction,
G4Scene pScene,
G4VisCommandSceneAddUserAction::ActionType  type,
G4VisManager::Verbosity  verbosity 
)
private

Definition at line 2649 of file G4VisCommandsSceneAdd.cc.

2654 {
2655  G4bool warn = verbosity >= G4VisManager::warnings;
2656 
2657  const std::map<G4VUserVisAction*,G4VisExtent>& visExtentMap =
2659  G4VisExtent extent;
2660  std::map<G4VUserVisAction*,G4VisExtent>::const_iterator i =
2661  visExtentMap.find(visAction);
2662  if (i != visExtentMap.end()) extent = i->second;
2663  if (warn) {
2664  if (extent.GetExtentRadius() <= 0.) {
2665  G4cout << "WARNING: User Vis Action extent is null." << G4endl;
2666  }
2667  }
2668 
2669  G4VModel* model = new G4CallbackModel<G4VUserVisAction>(visAction);
2670  model->SetType("User Vis Action");
2671  model->SetGlobalTag(name);
2672  model->SetGlobalDescription(name);
2673  model->SetExtent(extent);
2674  G4bool successful = false;;
2675  switch (type) {
2676  case runDuration:
2677  successful = pScene -> AddRunDurationModel (model, warn);
2678  break;
2679  case endOfEvent:
2680  successful = pScene -> AddEndOfEventModel (model, warn);
2681  break;
2682  case endOfRun:
2683  successful = pScene -> AddEndOfRunModel (model, warn);
2684  break;
2685  }
2686  if (successful && verbosity >= G4VisManager::confirmations) {
2687  const G4String& currentSceneName = pScene -> GetName ();
2688  G4cout << "User Vis Action added to scene \""
2689  << currentSceneName << "\"";
2690  if (verbosity >= G4VisManager::parameters) {
2691  G4cout << "\n with extent " << extent;
2692  }
2693  G4cout << G4endl;
2694  }
2695  else G4VisCommandsSceneAddUnsuccessful(verbosity);
2696 }
void SetGlobalTag(const G4String &)
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:73
void SetExtent(const G4VisExtent &)
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
G4GLOB_DLL std::ostream G4cout
if(nlines<=0)
bool G4bool
Definition: G4Types.hh:79
void SetType(const G4String &)
const std::map< G4VUserVisAction *, G4VisExtent > & GetUserVisActionExtents() const
#define G4endl
Definition: G4ios.hh:61
void SetGlobalDescription(const G4String &)
static G4VisManager * fpVisManager
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentValue()

G4String G4VisCommandSceneAddUserAction::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 2585 of file G4VisCommandsSceneAdd.cc.

2585  {
2586  return "";
2587 }
Here is the call graph for this function:

◆ operator=()

G4VisCommandSceneAddUserAction& G4VisCommandSceneAddUserAction::operator= ( const G4VisCommandSceneAddUserAction )
private

◆ SetNewValue()

void G4VisCommandSceneAddUserAction::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 2590 of file G4VisCommandsSceneAdd.cc.

2590  {
2591 
2593 
2594  G4Scene* pScene = fpVisManager->GetCurrentScene();
2595  if (!pScene) {
2596  if (verbosity >= G4VisManager::errors) {
2597  G4cerr << "ERROR: No current scene. Please create one." << G4endl;
2598  }
2599  return;
2600  }
2601 
2602  G4bool any = false;
2603 
2604  const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions =
2606  for (size_t i = 0; i < runDurationUserVisActions.size(); i++) {
2607  const G4String& name = runDurationUserVisActions[i].fName;
2608  G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction;
2609  if (newValue == "all" || name.find(newValue) != std::string::npos) {
2610  any = true;
2611  AddVisAction(name,visAction,pScene,runDuration,verbosity);
2612  }
2613  }
2614 
2615  const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions =
2617  for (size_t i = 0; i < endOfEventUserVisActions.size(); i++) {
2618  const G4String& name = endOfEventUserVisActions[i].fName;
2619  G4VUserVisAction* visAction = endOfEventUserVisActions[i].fpUserVisAction;
2620  if (newValue == "all" || name.find(newValue) != std::string::npos) {
2621  any = true;
2622  AddVisAction(name,visAction,pScene,endOfEvent,verbosity);
2623  }
2624  }
2625 
2626  const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions =
2628  for (size_t i = 0; i < endOfRunUserVisActions.size(); i++) {
2629  const G4String& name = endOfRunUserVisActions[i].fName;
2630  G4VUserVisAction* visAction = endOfRunUserVisActions[i].fpUserVisAction;
2631  if (newValue == "all" || name.find(newValue) != std::string::npos) {
2632  any = true;
2633  AddVisAction(name,visAction,pScene,endOfRun,verbosity);
2634  }
2635  }
2636 
2637  if (!any) {
2638  if (verbosity >= G4VisManager::warnings) {
2639  G4cout << "WARNING: No User Vis Action registered." << G4endl;
2640  }
2641  return;
2642  }
2643 
2644  const G4String& currentSceneName = pScene -> GetName ();
2645  UpdateVisManagerScene (currentSceneName);
2646 }
const std::vector< UserVisAction > & GetEndOfEventUserVisActions() const
G4Scene * GetCurrentScene() const
void UpdateVisManagerScene(const G4String &sceneName="")
G4String name
Definition: TRTMaterials.hh:40
void AddVisAction(const G4String &name, G4VUserVisAction *, G4Scene *, ActionType, G4VisManager::Verbosity)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const std::vector< UserVisAction > & GetEndOfRunUserVisActions() const
const std::vector< UserVisAction > & GetRunDurationUserVisActions() const
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fpCommand

G4UIcmdWithAString* G4VisCommandSceneAddUserAction::fpCommand
private

Definition at line 410 of file G4VisCommandsSceneAdd.hh.


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