#include <G4VisCommandsSceneAdd.hh>
Inheritance diagram for G4VisCommandSceneAddLogo2D:
Public Member Functions | |
G4VisCommandSceneAddLogo2D () | |
virtual | ~G4VisCommandSceneAddLogo2D () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Data Structures | |
struct | Logo2D |
Definition at line 276 of file G4VisCommandsSceneAdd.hh.
G4VisCommandSceneAddLogo2D::G4VisCommandSceneAddLogo2D | ( | ) |
Definition at line 1565 of file G4VisCommandsSceneAdd.cc.
01565 { 01566 G4bool omitable; 01567 fpCommand = new G4UIcommand ("/vis/scene/add/logo2D", this); 01568 fpCommand -> SetGuidance ("Adds 2D logo to current scene."); 01569 G4UIparameter* parameter; 01570 parameter = new G4UIparameter ("size", 'i', omitable = true); 01571 parameter -> SetGuidance ("Screen size of text in pixels."); 01572 parameter -> SetDefaultValue (48); 01573 fpCommand -> SetParameter (parameter); 01574 parameter = new G4UIparameter ("x-position", 'd', omitable = true); 01575 parameter -> SetGuidance ("x screen position in range -1 < x < 1."); 01576 parameter -> SetDefaultValue (-0.9); 01577 fpCommand -> SetParameter (parameter); 01578 parameter = new G4UIparameter ("y-position", 'd', omitable = true); 01579 parameter -> SetGuidance ("y screen position in range -1 < y < 1."); 01580 parameter -> SetDefaultValue (-0.9); 01581 fpCommand -> SetParameter (parameter); 01582 parameter = new G4UIparameter ("layout", 's', omitable = true); 01583 parameter -> SetGuidance ("Layout, i.e., adjustment: left|centre|right."); 01584 parameter -> SetDefaultValue ("left"); 01585 fpCommand -> SetParameter (parameter); 01586 }
G4VisCommandSceneAddLogo2D::~G4VisCommandSceneAddLogo2D | ( | ) | [virtual] |
G4String G4VisCommandSceneAddLogo2D::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandSceneAddLogo2D::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 1596 of file G4VisCommandsSceneAdd.cc.
References G4Text::centre, G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4VisManager::GetVerbosity(), G4Text::left, G4Text::right, G4VModel::SetGlobalDescription(), G4VModel::SetGlobalTag(), G4VModel::SetType(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.
01597 { 01598 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 01599 G4bool warn(verbosity >= G4VisManager::warnings); 01600 01601 G4Scene* pScene = fpVisManager->GetCurrentScene(); 01602 if (!pScene) { 01603 if (verbosity >= G4VisManager::errors) { 01604 G4cout << "ERROR: No current scene. Please create one." << G4endl; 01605 } 01606 return; 01607 } 01608 01609 G4int size; 01610 G4double x, y; 01611 G4String layoutString; 01612 std::istringstream is(newValue); 01613 is >> size >> x >> y >> layoutString; 01614 G4Text::Layout layout = G4Text::right; 01615 if (layoutString(0) == 'l') layout = G4Text::left; 01616 else if (layoutString(0) == 'c') layout = G4Text::centre; 01617 else if (layoutString(0) == 'r') layout = G4Text::right; 01618 01619 Logo2D* logo2D = new Logo2D(fpVisManager, size, x, y, layout); 01620 G4VModel* model = 01621 new G4CallbackModel<G4VisCommandSceneAddLogo2D::Logo2D>(logo2D); 01622 model->SetType("G4Logo2D"); 01623 model->SetGlobalTag("G4Logo2D"); 01624 model->SetGlobalDescription("G4Logo2D: " + newValue); 01625 const G4String& currentSceneName = pScene -> GetName (); 01626 G4bool successful = pScene -> AddRunDurationModel (model, warn); 01627 if (successful) { 01628 if (verbosity >= G4VisManager::confirmations) { 01629 G4cout << "2D logo has been added to scene \"" 01630 << currentSceneName << "\"." 01631 << G4endl; 01632 } 01633 } 01634 else G4VisCommandsSceneAddUnsuccessful(verbosity); 01635 UpdateVisManagerScene (currentSceneName); 01636 }