Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4VisCommandSetTouchable Class Reference

#include <G4VisCommandsSet.hh>

Inheritance diagram for G4VisCommandSetTouchable:
G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSetTouchable ()
 
virtual ~G4VisCommandSetTouchable ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
- Protected Member Functions inherited from G4VVisCommand
void UpdateVisManagerScene (const G4String &sceneName="")
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentLineWidth = 1.
 
static
G4ModelingParameters::PVNameCopyNoPath 
fCurrentTouchablePath
 

Detailed Description

Definition at line 89 of file G4VisCommandsSet.hh.

Constructor & Destructor Documentation

G4VisCommandSetTouchable::G4VisCommandSetTouchable ( )

Definition at line 272 of file G4VisCommandsSet.cc.

References G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), and G4UIcommand::SetParameter().

273 {
274  G4bool omitable;
275  G4UIparameter* parameter;
276  fpCommand = new G4UIcommand("/vis/set/touchable", this);
277  fpCommand->SetGuidance
278  ("Defines touchable for future \"/vis/touchable/set/\" commands.");
279  fpCommand->SetGuidance
280  ("Please provide a list of space-separated physical volume names and"
281  "\ncopy number pairs starting at the world volume, e.g:"
282  "\n /vis/set/touchable World 0 Envelope 0 Shape1 0"
283  "\n(To get list of touchables, use \"/vis/drawTree\")"
284  "\n(To save, use \"/vis/viewer/save\")");
285  parameter = new G4UIparameter ("list", 's', omitable = false);
286  parameter->SetGuidance
287  ("List of physical volume names and copy number pairs");
288  fpCommand->SetParameter (parameter);
289 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetGuidance(const char *theGuidance)
G4VisCommandSetTouchable::~G4VisCommandSetTouchable ( )
virtual

Definition at line 291 of file G4VisCommandsSet.cc.

292 {
293  delete fpCommand;
294 }

Member Function Documentation

G4String G4VisCommandSetTouchable::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 296 of file G4VisCommandsSet.cc.

void G4VisCommandSetTouchable::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 301 of file G4VisCommandsSet.cc.

References G4VisManager::confirmations, G4VVisCommand::fCurrentTouchablePath, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetVerbosity(), and G4VisManager::warnings.

302 {
304 
305  G4ModelingParameters::PVNameCopyNoPath currentTouchablePath;
306 
307  // Algorithm from Josuttis p.476.
308  G4String::size_type iBegin, iEnd;
309  iBegin = newValue.find_first_not_of(' ');
310  while (iBegin != G4String::npos) {
311  iEnd = newValue.find_first_of(' ',iBegin);
312  if (iEnd == G4String::npos) {
313  iEnd = newValue.length();
314  }
315  G4String name(newValue.substr(iBegin,iEnd-iBegin));
316  iBegin = newValue.find_first_not_of(' ',iEnd);
317  if (iBegin == G4String::npos) {
318  if (verbosity >= G4VisManager::warnings) {
319  G4cout <<
320  "WARNING: G4VisCommandSetTouchable::SetNewValue"
321  "\n A pair not found. (Did you have an even number of parameters?)"
322  "\n Command ignored."
323  << G4endl;
324  return;
325  }
326  }
327  iEnd = newValue.find_first_of(' ',iBegin);
328  if (iEnd == G4String::npos) {
329  iEnd = newValue.length();
330  }
331  G4int copyNo;
332  std::istringstream iss(newValue.substr(iBegin,iEnd-iBegin));
333  if (!(iss >> copyNo)) {
334  if (verbosity >= G4VisManager::warnings) {
335  G4cout <<
336  "WARNING: G4VisCommandSetTouchable::SetNewValue"
337  "\n Error reading copy number - it was not numeric?"
338  "\n Command ignored."
339  << G4endl;
340  return;
341  }
342  }
343  currentTouchablePath.push_back
345  iBegin = newValue.find_first_not_of(' ',iEnd);
346  }
347 
348  fCurrentTouchablePath = currentTouchablePath;
349 
350  if (verbosity >= G4VisManager::confirmations) {
352  << G4endl;
353  }
354 }
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
const XML_Char * name
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
std::vector< PVNameCopyNo > PVNameCopyNoPath
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
static G4VisManager * fpVisManager

The documentation for this class was generated from the following files: