#include <G4VisCommandsSet.hh>
Inheritance diagram for G4VisCommandSetTouchable:
Public Member Functions | |
G4VisCommandSetTouchable () | |
virtual | ~G4VisCommandSetTouchable () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Definition at line 90 of file G4VisCommandsSet.hh.
G4VisCommandSetTouchable::G4VisCommandSetTouchable | ( | ) |
Definition at line 273 of file G4VisCommandsSet.cc.
References G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), and G4UIcommand::SetParameter().
00274 { 00275 G4bool omitable; 00276 G4UIparameter* parameter; 00277 fpCommand = new G4UIcommand("/vis/set/touchable", this); 00278 fpCommand->SetGuidance 00279 ("Defines touchable for future \"/vis/touchable/set/\" commands."); 00280 fpCommand->SetGuidance 00281 ("Please provide a list of space-separated physical volume names and" 00282 "\ncopy number pairs starting at the world volume, e.g:" 00283 "\n/vis/set/touchable World 0 Envelope 0 Shape1 0"); 00284 parameter = new G4UIparameter ("list", 's', omitable = false); 00285 parameter->SetGuidance 00286 ("List of physical volume names and copy number pairs"); 00287 fpCommand->SetParameter (parameter); 00288 }
G4VisCommandSetTouchable::~G4VisCommandSetTouchable | ( | ) | [virtual] |
G4String G4VisCommandSetTouchable::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 295 of file G4VisCommandsSet.cc.
00296 { 00297 return G4String(); 00298 }
void G4VisCommandSetTouchable::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 300 of file G4VisCommandsSet.cc.
References G4VisManager::confirmations, G4VVisCommand::fCurrentTouchablePath, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetVerbosity(), and G4VisManager::warnings.
00301 { 00302 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 00303 00304 G4ModelingParameters::PVNameCopyNoPath currentTouchablePath; 00305 00306 // Algorithm from Josuttis p.476. 00307 G4String::size_type iBegin, iEnd; 00308 iBegin = newValue.find_first_not_of(' '); 00309 while (iBegin != G4String::npos) { 00310 iEnd = newValue.find_first_of(' ',iBegin); 00311 if (iEnd == G4String::npos) { 00312 iEnd = newValue.length(); 00313 } 00314 G4String name(newValue.substr(iBegin,iEnd-iBegin)); 00315 iBegin = newValue.find_first_not_of(' ',iEnd); 00316 if (iBegin == G4String::npos) { 00317 if (verbosity >= G4VisManager::warnings) { 00318 G4cout << 00319 "WARNING: G4VisCommandSetTouchable::SetNewValue" 00320 "\n A pair not found. (Did you have an even number of parameters?)" 00321 "\n Command ignored." 00322 << G4endl; 00323 return; 00324 } 00325 } 00326 iEnd = newValue.find_first_of(' ',iBegin); 00327 if (iEnd == G4String::npos) { 00328 iEnd = newValue.length(); 00329 } 00330 G4int copyNo; 00331 std::istringstream iss(newValue.substr(iBegin,iEnd-iBegin)); 00332 if (!(iss >> copyNo)) { 00333 if (verbosity >= G4VisManager::warnings) { 00334 G4cout << 00335 "WARNING: G4VisCommandSetTouchable::SetNewValue" 00336 "\n Error reading copy number - it was not numeric?" 00337 "\n Command ignored." 00338 << G4endl; 00339 return; 00340 } 00341 } 00342 currentTouchablePath.push_back 00343 (G4ModelingParameters::PVNameCopyNo(name,copyNo)); 00344 iBegin = newValue.find_first_not_of(' ',iEnd); 00345 } 00346 00347 fCurrentTouchablePath = currentTouchablePath; 00348 00349 if (verbosity >= G4VisManager::confirmations) { 00350 G4cout << fCurrentTouchablePath 00351 << G4endl; 00352 } 00353 }