#include <G4VisCommandsSceneAdd.hh>
Inheritance diagram for G4VisCommandSceneAddLine:
Public Member Functions | |
G4VisCommandSceneAddLine () | |
virtual | ~G4VisCommandSceneAddLine () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Data Structures | |
struct | Line |
Definition at line 198 of file G4VisCommandsSceneAdd.hh.
G4VisCommandSceneAddLine::G4VisCommandSceneAddLine | ( | ) |
Definition at line 884 of file G4VisCommandsSceneAdd.cc.
References G4UIparameter::SetDefaultValue(), and G4UIcommand::SetParameter().
00884 { 00885 fpCommand = new G4UIcommand("/vis/scene/add/line", this); 00886 fpCommand -> SetGuidance ("Adds line to current scene."); 00887 G4bool omitable; 00888 G4UIparameter* parameter; 00889 parameter = new G4UIparameter ("x1", 'd', omitable = false); 00890 fpCommand -> SetParameter (parameter); 00891 parameter = new G4UIparameter ("y1", 'd', omitable = false); 00892 fpCommand -> SetParameter (parameter); 00893 parameter = new G4UIparameter ("z1", 'd', omitable = false); 00894 fpCommand -> SetParameter (parameter); 00895 parameter = new G4UIparameter ("x2", 'd', omitable = false); 00896 fpCommand -> SetParameter (parameter); 00897 parameter = new G4UIparameter ("y2", 'd', omitable = false); 00898 fpCommand -> SetParameter (parameter); 00899 parameter = new G4UIparameter ("z2", 'd', omitable = false); 00900 fpCommand -> SetParameter (parameter); 00901 parameter = new G4UIparameter ("unit", 's', omitable = true); 00902 parameter->SetDefaultValue ("m"); 00903 fpCommand->SetParameter (parameter); 00904 }
G4VisCommandSceneAddLine::~G4VisCommandSceneAddLine | ( | ) | [virtual] |
G4String G4VisCommandSceneAddLine::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandSceneAddLine::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 914 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(), G4UIcommand::ValueOf(), and G4VisManager::warnings.
00915 { 00916 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 00917 G4bool warn(verbosity >= G4VisManager::warnings); 00918 00919 G4Scene* pScene = fpVisManager->GetCurrentScene(); 00920 if (!pScene) { 00921 if (verbosity >= G4VisManager::errors) { 00922 G4cout << "ERROR: No current scene. Please create one." << G4endl; 00923 } 00924 return; 00925 } 00926 00927 G4String unitString; 00928 G4double x1, y1, z1, x2, y2, z2; 00929 std::istringstream is(newValue); 00930 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString; 00931 G4double unit = G4UIcommand::ValueOf(unitString); 00932 x1 *= unit; y1 *= unit; z1 *= unit; 00933 x2 *= unit; y2 *= unit; z2 *= unit; 00934 00935 Line* line = new Line(x1, y1, z1, x2, y2, z2, 00936 fCurrentLineWidth, fCurrentColour); 00937 G4VModel* model = 00938 new G4CallbackModel<G4VisCommandSceneAddLine::Line>(line); 00939 model->SetType("Line"); 00940 model->SetGlobalTag("Line"); 00941 model->SetGlobalDescription("Line: " + newValue); 00942 const G4String& currentSceneName = pScene -> GetName (); 00943 G4bool successful = pScene -> AddRunDurationModel (model, warn); 00944 if (successful) { 00945 if (verbosity >= G4VisManager::confirmations) { 00946 G4cout << "Line has been added to scene \"" 00947 << currentSceneName << "\"." 00948 << G4endl; 00949 } 00950 } 00951 else G4VisCommandsSceneAddUnsuccessful(verbosity); 00952 UpdateVisManagerScene (currentSceneName); 00953 }