#include <G4VisCommandsSceneAdd.hh>
Inheritance diagram for G4VisCommandSceneAddLine2D:
Public Member Functions | |
G4VisCommandSceneAddLine2D () | |
virtual | ~G4VisCommandSceneAddLine2D () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Data Structures | |
struct | Line2D |
Definition at line 219 of file G4VisCommandsSceneAdd.hh.
G4VisCommandSceneAddLine2D::G4VisCommandSceneAddLine2D | ( | ) |
Definition at line 979 of file G4VisCommandsSceneAdd.cc.
00979 { 00980 fpCommand = new G4UIcommand("/vis/scene/add/line2D", this); 00981 fpCommand -> SetGuidance ("Adds 2D line to current scene."); 00982 G4bool omitable; 00983 G4UIparameter* parameter; 00984 parameter = new G4UIparameter ("x1", 'd', omitable = false); 00985 fpCommand -> SetParameter (parameter); 00986 parameter = new G4UIparameter ("y1", 'd', omitable = false); 00987 fpCommand -> SetParameter (parameter); 00988 parameter = new G4UIparameter ("x2", 'd', omitable = false); 00989 fpCommand -> SetParameter (parameter); 00990 parameter = new G4UIparameter ("y2", 'd', omitable = false); 00991 fpCommand -> SetParameter (parameter); 00992 }
G4VisCommandSceneAddLine2D::~G4VisCommandSceneAddLine2D | ( | ) | [virtual] |
G4String G4VisCommandSceneAddLine2D::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandSceneAddLine2D::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 1002 of file G4VisCommandsSceneAdd.cc.
References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fCurrentColour, G4VVisCommand::fCurrentLineWidth, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4VisManager::GetVerbosity(), G4VModel::SetGlobalDescription(), G4VModel::SetGlobalTag(), G4VModel::SetType(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.
01003 { 01004 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 01005 G4bool warn(verbosity >= G4VisManager::warnings); 01006 01007 G4Scene* pScene = fpVisManager->GetCurrentScene(); 01008 if (!pScene) { 01009 if (verbosity >= G4VisManager::errors) { 01010 G4cout << "ERROR: No current scene. Please create one." << G4endl; 01011 } 01012 return; 01013 } 01014 01015 G4double x1, y1, x2, y2; 01016 std::istringstream is(newValue); 01017 is >> x1 >> y1 >> x2 >> y2; 01018 01019 Line2D* line2D = new Line2D 01020 (x1, y1, x2, y2, fCurrentLineWidth, fCurrentColour); 01021 G4VModel* model = 01022 new G4CallbackModel<G4VisCommandSceneAddLine2D::Line2D>(line2D); 01023 model->SetType("Line2D"); 01024 model->SetGlobalTag("Line2D"); 01025 model->SetGlobalDescription("Line2D: " + newValue); 01026 const G4String& currentSceneName = pScene -> GetName (); 01027 G4bool successful = pScene -> AddRunDurationModel (model, warn); 01028 if (successful) { 01029 if (verbosity >= G4VisManager::confirmations) { 01030 G4cout << "A 2D line has been added to scene \"" 01031 << currentSceneName << "\"." 01032 << G4endl; 01033 } 01034 } 01035 else G4VisCommandsSceneAddUnsuccessful(verbosity); 01036 UpdateVisManagerScene (currentSceneName); 01037 }