#include <G4VisCommandsSceneAdd.hh>
Inheritance diagram for G4VisCommandSceneAddUserAction:
Public Member Functions | |
G4VisCommandSceneAddUserAction () | |
virtual | ~G4VisCommandSceneAddUserAction () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Definition at line 367 of file G4VisCommandsSceneAdd.hh.
G4VisCommandSceneAddUserAction::G4VisCommandSceneAddUserAction | ( | ) |
Definition at line 2433 of file G4VisCommandsSceneAdd.cc.
02433 { 02434 G4bool omitable; 02435 fpCommand = new G4UIcmdWithAString("/vis/scene/add/userAction",this); 02436 fpCommand -> SetGuidance 02437 ("Add named Vis User Action to current scene."); 02438 fpCommand -> SetGuidance 02439 ("Attempts to match search string to name of action - use unique sub-string."); 02440 fpCommand -> SetGuidance 02441 ("(Use /vis/list to see names of registered actions.)"); 02442 fpCommand -> SetGuidance 02443 ("If name == \"all\" (default), all actions are added."); 02444 fpCommand -> SetParameterName("action-name", omitable = true); 02445 fpCommand -> SetDefaultValue("all"); 02446 }
G4VisCommandSceneAddUserAction::~G4VisCommandSceneAddUserAction | ( | ) | [virtual] |
G4String G4VisCommandSceneAddUserAction::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandSceneAddUserAction::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 2457 of file G4VisCommandsSceneAdd.cc.
References G4VisManager::errors, fName, G4cout, G4endl, and G4VisManager::warnings.
02457 { 02458 02459 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 02460 02461 G4Scene* pScene = fpVisManager->GetCurrentScene(); 02462 if (!pScene) { 02463 if (verbosity >= G4VisManager::errors) { 02464 G4cout << "ERROR: No current scene. Please create one." << G4endl; 02465 } 02466 return; 02467 } 02468 02469 G4bool any = false; 02470 02471 const std::vector<G4VisManager::UserVisAction>& runDurationUserVisActions = 02472 fpVisManager->GetRunDurationUserVisActions(); 02473 for (size_t i = 0; i < runDurationUserVisActions.size(); i++) { 02474 const G4String& name = runDurationUserVisActions[i].fName; 02475 G4VUserVisAction* visAction = runDurationUserVisActions[i].fpUserVisAction; 02476 if (newValue == "all" || name.find(newValue) != std::string::npos) { 02477 any = true; 02478 AddVisAction(name,visAction,pScene,runDuration,verbosity); 02479 } 02480 } 02481 02482 const std::vector<G4VisManager::UserVisAction>& endOfEventUserVisActions = 02483 fpVisManager->GetEndOfEventUserVisActions(); 02484 for (size_t i = 0; i < endOfEventUserVisActions.size(); i++) { 02485 const G4String& name = endOfEventUserVisActions[i].fName; 02486 G4VUserVisAction* visAction = endOfEventUserVisActions[i].fpUserVisAction; 02487 if (newValue == "all" || name.find(newValue) != std::string::npos) { 02488 any = true; 02489 AddVisAction(name,visAction,pScene,endOfEvent,verbosity); 02490 } 02491 } 02492 02493 const std::vector<G4VisManager::UserVisAction>& endOfRunUserVisActions = 02494 fpVisManager->GetEndOfRunUserVisActions(); 02495 for (size_t i = 0; i < endOfRunUserVisActions.size(); i++) { 02496 const G4String& name = endOfRunUserVisActions[i].fName; 02497 G4VUserVisAction* visAction = endOfRunUserVisActions[i].fpUserVisAction; 02498 if (newValue == "all" || name.find(newValue) != std::string::npos) { 02499 any = true; 02500 AddVisAction(name,visAction,pScene,endOfRun,verbosity); 02501 } 02502 } 02503 02504 if (!any) { 02505 if (verbosity >= G4VisManager::warnings) { 02506 G4cout << "WARNING: No User Vis Action registered." << G4endl; 02507 } 02508 return; 02509 } 02510 02511 const G4String& currentSceneName = pScene -> GetName (); 02512 UpdateVisManagerScene (currentSceneName); 02513 }