Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RTMessenger Class Reference

#include <G4RTMessenger.hh>

Inheritance diagram for G4RTMessenger:
Collaboration diagram for G4RTMessenger:

Public Member Functions

virtual ~G4RTMessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
- 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
 
G4bool CommandsShouldBeInMaster () const
 

Static Public Member Functions

static G4RTMessengerGetInstance (G4TheRayTracer *p1)
 

Additional Inherited Members

- 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)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 51 of file G4RTMessenger.hh.

Constructor & Destructor Documentation

G4RTMessenger::~G4RTMessenger ( )
virtual

Definition at line 140 of file G4RTMessenger.cc.

141 {
142  delete columnCmd;
143  delete rowCmd;
144  delete targetCmd;
145  delete eyePosCmd;
146  delete lightCmd;
147  delete spanXCmd;
148  delete headCmd;
149  delete attCmd;
150  delete distCmd;
151  delete transCmd;
152  delete fileCmd;
153  delete bkgColCmd;
154  delete rayDirectory;
155 }

Member Function Documentation

G4String G4RTMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 157 of file G4RTMessenger.cc.

158 {
159  G4String currentValue;
160  if(command==columnCmd)
161  { currentValue = columnCmd->ConvertToString(theTracer->GetNColumn()); }
162  else if(command==rowCmd)
163  { currentValue = rowCmd->ConvertToString(theTracer->GetNRow()); }
164  else if(command==targetCmd)
165  { currentValue = targetCmd->ConvertToString(theTracer->GetTargetPosition(),"m"); }
166  else if(command==eyePosCmd)
167  { currentValue = eyePosCmd->ConvertToString(theTracer->GetEyePosition(),"m"); }
168  else if(command==lightCmd)
169  { currentValue = lightCmd->ConvertToString(theTracer->GetLightDirection()); }
170  else if(command==spanXCmd)
171  { currentValue = spanXCmd->ConvertToString(theTracer->GetViewSpan(),"deg"); }
172  else if(command==headCmd)
173  { currentValue = headCmd->ConvertToString(theTracer->GetHeadAngle(),"deg"); }
174  else if(command==attCmd)
175  { currentValue = attCmd->ConvertToString(theTracer->GetAttenuationLength(),"m");}
176  else if(command==distCmd)
177  { currentValue = distCmd->ConvertToString(theTracer->GetDistortion()); }
178  else if(command==transCmd)
179  { currentValue = transCmd->ConvertToString(G4RTSteppingAction::GetIgnoreTransparency()); }
180  else if(command==bkgColCmd)
181  { currentValue = bkgColCmd->ConvertToString(theTracer->GetBackgroundColour()); }
182  return currentValue;
183 }
static G4bool GetIgnoreTransparency()
G4ThreeVector GetLightDirection() const
G4int GetNColumn() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
G4int GetNRow() const
G4ThreeVector GetTargetPosition() const
G4double GetAttenuationLength() const
G4Colour GetBackgroundColour() const
G4ThreeVector GetEyePosition() const
G4double GetHeadAngle() const
G4double GetViewSpan() const
G4bool GetDistortion() const

Here is the call graph for this function:

G4RTMessenger * G4RTMessenger::GetInstance ( G4TheRayTracer p1)
static

Definition at line 51 of file G4RTMessenger.cc.

52 {
53  if (!fpInstance) fpInstance = new G4RTMessenger(p1);
54  return fpInstance;
55 }

Here is the caller graph for this function:

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

Reimplemented from G4UImessenger.

Definition at line 185 of file G4RTMessenger.cc.

186 {
187  G4VisManager* pVisManager = G4VisManager::GetInstance();
188 
189  theTracer = theDefaultTracer;
190 
191  G4VViewer* pVViewer = pVisManager->GetCurrentViewer();
192  if (pVViewer) {
193  G4RayTracerViewer* pViewer = dynamic_cast<G4RayTracerViewer*>(pVViewer);
194  if (pViewer) {
195  theTracer = pViewer->GetTracer();
196  } else {
197  G4cout <<
198  "G4RTMessenger::SetNewValue: Current viewer is not of type RayTracer."
199  "\n Use \"/vis/viewer/select\" or \"/vis/open\"."
200  << G4endl;
201  }
202  }
203 
204  if (theTracer == theDefaultTracer) {
205  G4cout <<
206 "G4RTMessenger::SetNewValue: No valid current viewer. Using default RayTracer."
207  << G4endl;
208  }
209 
210  if(command==columnCmd)
211  { theTracer->SetNColumn(columnCmd->GetNewIntValue(newValue)); }
212  else if(command==rowCmd)
213  { theTracer->SetNRow(rowCmd->GetNewIntValue(newValue)); }
214  else if(command==targetCmd)
215  { theTracer->SetTargetPosition(targetCmd->GetNew3VectorValue(newValue)); }
216  else if(command==eyePosCmd)
217  { theTracer->SetEyePosition(eyePosCmd->GetNew3VectorValue(newValue)); }
218  else if(command==lightCmd)
219  { theTracer->SetLightDirection(lightCmd->GetNew3VectorValue(newValue)); }
220  else if(command==spanXCmd)
221  { theTracer->SetViewSpan(spanXCmd->GetNewDoubleValue(newValue)); }
222  else if(command==headCmd)
223  { theTracer->SetHeadAngle(headCmd->GetNewDoubleValue(newValue)); }
224  else if(command==attCmd)
225  { theTracer->SetAttenuationLength(attCmd->GetNewDoubleValue(newValue)); }
226  else if(command==distCmd)
227  { theTracer->SetDistortion(distCmd->GetNewBoolValue(newValue)); }
228  else if(command==bkgColCmd)
229  {
230  G4cout << "WARNING: /vis/rayTracer/backgroundColour has been deprecated."
231  "\n Use \"/vis/viewer/set/background\" instead."
232  << G4endl;
233  }
234  else if(command==transCmd)
236  else if(command==fileCmd)
237  { theTracer->Trace(newValue); }
238 }
void SetLightDirection(const G4ThreeVector &val)
void SetHeadAngle(G4double val)
static G4int GetNewIntValue(const char *paramString)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
G4TheRayTracer * GetTracer()
void SetNRow(G4int val)
void SetNColumn(G4int val)
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
virtual void Trace(const G4String &fileName)
G4GLOB_DLL std::ostream G4cout
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetViewSpan(G4double val)
static G4VisManager * GetInstance()
static void SetIgnoreTransparency(G4bool val)
#define G4endl
Definition: G4ios.hh:61
G4VViewer * GetCurrentViewer() const
void SetDistortion(G4bool val)
void SetEyePosition(const G4ThreeVector &val)
void SetAttenuationLength(G4double val)
void SetTargetPosition(const G4ThreeVector &val)

Here is the call graph for this function:


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