#include <G4VisCommandsSceneAdd.hh>
Inheritance diagram for G4VisCommandSceneAddArrow:
Public Member Functions | |
G4VisCommandSceneAddArrow () | |
virtual | ~G4VisCommandSceneAddArrow () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Definition at line 45 of file G4VisCommandsSceneAdd.hh.
G4VisCommandSceneAddArrow::G4VisCommandSceneAddArrow | ( | ) |
Definition at line 95 of file G4VisCommandsSceneAdd.cc.
References G4UIparameter::SetDefaultValue(), and G4UIcommand::SetParameter().
00095 { 00096 fpCommand = new G4UIcommand("/vis/scene/add/arrow", this); 00097 fpCommand -> SetGuidance ("Adds arrow to current scene."); 00098 G4bool omitable; 00099 G4UIparameter* parameter; 00100 parameter = new G4UIparameter ("x1", 'd', omitable = false); 00101 fpCommand -> SetParameter (parameter); 00102 parameter = new G4UIparameter ("y1", 'd', omitable = false); 00103 fpCommand -> SetParameter (parameter); 00104 parameter = new G4UIparameter ("z1", 'd', omitable = false); 00105 fpCommand -> SetParameter (parameter); 00106 parameter = new G4UIparameter ("x2", 'd', omitable = false); 00107 fpCommand -> SetParameter (parameter); 00108 parameter = new G4UIparameter ("y2", 'd', omitable = false); 00109 fpCommand -> SetParameter (parameter); 00110 parameter = new G4UIparameter ("z2", 'd', omitable = false); 00111 fpCommand -> SetParameter (parameter); 00112 parameter = new G4UIparameter ("unit", 's', omitable = true); 00113 parameter->SetDefaultValue ("m"); 00114 fpCommand->SetParameter (parameter); 00115 }
G4VisCommandSceneAddArrow::~G4VisCommandSceneAddArrow | ( | ) | [virtual] |
G4String G4VisCommandSceneAddArrow::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandSceneAddArrow::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 125 of file G4VisCommandsSceneAdd.cc.
References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fCurrentColour, G4VVisCommand::fCurrentLineWidth, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4VisManager::GetVerbosity(), G4VVisCommand::UpdateVisManagerScene(), G4UIcommand::ValueOf(), and G4VisManager::warnings.
00126 { 00127 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 00128 G4bool warn(verbosity >= G4VisManager::warnings); 00129 00130 G4Scene* pScene = fpVisManager->GetCurrentScene(); 00131 if (!pScene) { 00132 if (verbosity >= G4VisManager::errors) { 00133 G4cout << "ERROR: No current scene. Please create one." << G4endl; 00134 } 00135 return; 00136 } 00137 00138 G4String unitString; 00139 G4double x1, y1, z1, x2, y2, z2; 00140 std::istringstream is(newValue); 00141 is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString; 00142 G4double unit = G4UIcommand::ValueOf(unitString); 00143 x1 *= unit; y1 *= unit; z1 *= unit; 00144 x2 *= unit; y2 *= unit; z2 *= unit; 00145 00146 // Consult scene for arrow width. 00147 const G4VisExtent& sceneExtent = pScene->GetExtent(); 00148 G4double arrowWidth = 00149 0.005 * fCurrentLineWidth * sceneExtent.GetExtentRadius(); 00150 00151 G4VModel* model = new G4ArrowModel 00152 (x1, y1, z1, x2, y2, z2, 00153 arrowWidth, fCurrentColour, newValue); 00154 00155 const G4String& currentSceneName = pScene -> GetName (); 00156 G4bool successful = pScene -> AddRunDurationModel (model, warn); 00157 if (successful) { 00158 if (verbosity >= G4VisManager::confirmations) { 00159 G4cout << "Arrow has been added to scene \"" 00160 << currentSceneName << "\"." 00161 << G4endl; 00162 } 00163 } 00164 else G4VisCommandsSceneAddUnsuccessful(verbosity); 00165 UpdateVisManagerScene (currentSceneName); 00166 }