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

#include <G4RTMessenger.hh>

Inheritance diagram for G4RTMessenger:
G4UImessenger

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
 

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
 

Detailed Description

Definition at line 51 of file G4RTMessenger.hh.

Constructor & Destructor Documentation

G4RTMessenger::~G4RTMessenger ( )
virtual

Definition at line 139 of file G4RTMessenger.cc.

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

Member Function Documentation

G4String G4RTMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 156 of file G4RTMessenger.cc.

References G4UIcommand::ConvertToString(), G4TheRayTracer::GetAttenuationLength(), G4TheRayTracer::GetBackgroundColour(), G4TheRayTracer::GetDistortion(), G4TheRayTracer::GetEyePosition(), G4TheRayTracer::GetHeadAngle(), G4RTSteppingAction::GetIgnoreTransparency(), G4TheRayTracer::GetLightDirection(), G4TheRayTracer::GetNColumn(), G4TheRayTracer::GetNRow(), G4TheRayTracer::GetTargetPosition(), and G4TheRayTracer::GetViewSpan().

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

Definition at line 51 of file G4RTMessenger.cc.

Referenced by G4TheRayTracer::G4TheRayTracer().

52 {
53  if (!fpInstance) fpInstance = new G4RTMessenger(p1);
54  return fpInstance;
55 }
void G4RTMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 184 of file G4RTMessenger.cc.

References G4cout, G4endl, G4VisManager::GetCurrentViewer(), G4UIcmdWith3Vector::GetNew3VectorValue(), G4UIcmdWith3VectorAndUnit::GetNew3VectorValue(), G4UIcmdWithABool::GetNewBoolValue(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), G4RayTracerViewer::GetTracer(), G4TheRayTracer::SetAttenuationLength(), G4TheRayTracer::SetDistortion(), G4TheRayTracer::SetEyePosition(), G4TheRayTracer::SetHeadAngle(), G4RTSteppingAction::SetIgnoreTransparency(), G4TheRayTracer::SetLightDirection(), G4TheRayTracer::SetNColumn(), G4TheRayTracer::SetNRow(), G4TheRayTracer::SetTargetPosition(), G4TheRayTracer::SetViewSpan(), and G4TheRayTracer::Trace().

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

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