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

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddAxes:
G4VVisCommandScene G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSceneAddAxes ()
 
virtual ~G4VisCommandSceneAddAxes ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandScene
 G4VVisCommandScene ()
 
virtual ~G4VVisCommandScene ()
 
- 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 G4VVisCommandScene
G4String CurrentSceneName ()
 
- 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 80 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes ( )

Definition at line 261 of file G4VisCommandsSceneAdd.cc.

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

261  {
262  G4bool omitable;
263  fpCommand = new G4UIcommand ("/vis/scene/add/axes", this);
264  fpCommand -> SetGuidance ("Add axes.");
265  fpCommand -> SetGuidance
266  ("Draws axes at (x0, y0, z0) of given length and colour.");
267  fpCommand -> SetGuidance
268  ("If \"unitcolour\" is \"auto\", x, y and z will be red, green and blue"
269  "\n respectively. Otherwise choose from the pre-defined text-specified"
270  "\n colours - see information printed by the vis manager at start-up or"
271  "\n use \"/vis/list\".");
272  fpCommand -> SetGuidance
273  ("If \"length\" is negative, it is set to about 25% of scene extent.");
274  G4UIparameter* parameter;
275  parameter = new G4UIparameter ("x0", 'd', omitable = true);
276  parameter->SetDefaultValue (0.);
277  fpCommand->SetParameter (parameter);
278  parameter = new G4UIparameter ("y0", 'd', omitable = true);
279  parameter->SetDefaultValue (0.);
280  fpCommand->SetParameter (parameter);
281  parameter = new G4UIparameter ("z0", 'd', omitable = true);
282  parameter->SetDefaultValue (0.);
283  fpCommand->SetParameter (parameter);
284  parameter = new G4UIparameter ("length", 'd', omitable = true);
285  parameter->SetDefaultValue (-1.);
286  fpCommand->SetParameter (parameter);
287  parameter = new G4UIparameter ("unit", 's', omitable = true);
288  parameter->SetDefaultValue ("m");
289  fpCommand->SetParameter (parameter);
290  parameter = new G4UIparameter ("unitcolour", 's', omitable = true);
291  parameter->SetDefaultValue ("auto");
292  fpCommand->SetParameter (parameter);
293 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetDefaultValue(const char *theDefaultValue)
bool G4bool
Definition: G4Types.hh:79
G4VisCommandSceneAddAxes::~G4VisCommandSceneAddAxes ( )
virtual

Definition at line 295 of file G4VisCommandsSceneAdd.cc.

295  {
296  delete fpCommand;
297 }

Member Function Documentation

G4String G4VisCommandSceneAddAxes::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 299 of file G4VisCommandsSceneAdd.cc.

299  {
300  return "";
301 }
void G4VisCommandSceneAddAxes::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 303 of file G4VisCommandsSceneAdd.cc.

References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fCurrentLineWidth, G4VVisCommand::fpVisManager, G4BestUnit, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4VisManager::GetVerbosity(), G4VVisCommand::UpdateVisManagerScene(), G4UIcommand::ValueOf(), G4VisManager::warnings, and G4InuclParticleNames::z0.

303  {
304 
306  G4bool warn(verbosity >= G4VisManager::warnings);
307 
308  G4Scene* pScene = fpVisManager->GetCurrentScene();
309  if (!pScene) {
310  if (verbosity >= G4VisManager::errors) {
311  G4cout << "ERROR: No current scene. Please create one." << G4endl;
312  }
313  return;
314  }
315 
316  G4String unitString, colourString;
317  G4double x0, y0, z0, length;
318  std::istringstream is (newValue);
319  is >> x0 >> y0 >> z0 >> length >> unitString >> colourString;
320 
321  G4double unit = G4UIcommand::ValueOf(unitString);
322  x0 *= unit; y0 *= unit; z0 *= unit;
323  const G4VisExtent& sceneExtent = pScene->GetExtent(); // Existing extent.
324  if (length < 0.) {
325  length = 0.5 * sceneExtent.GetExtentRadius();
326  G4double intLog10Length = std::floor(std::log10(length));
327  length = std::pow(10,intLog10Length);
328  } else {
329  length *= unit;
330  }
331  G4String annotation = G4BestUnit(length,"Length");
332 
333  // Consult scene for arrow width...
334  G4double arrowWidth =
335  0.005 * fCurrentLineWidth * sceneExtent.GetExtentRadius();
336  // ...but limit it to length/50.
337  if (arrowWidth > length/50.) arrowWidth = length/50.;
338 
339  G4VModel* model = new G4AxesModel
340  (x0, y0, z0, length, arrowWidth, colourString, newValue);
341 
342  G4bool successful = pScene -> AddRunDurationModel (model, warn);
343  const G4String& currentSceneName = pScene -> GetName ();
344  if (successful) {
345  if (verbosity >= G4VisManager::confirmations) {
346  G4cout << "Axes have been added to scene \"" << currentSceneName << "\"."
347  << G4endl;
348  }
349  }
350  else G4VisCommandsSceneAddUnsuccessful(verbosity);
351  UpdateVisManagerScene (currentSceneName);
352 }
void UpdateVisManagerScene(const G4String &sceneName="")
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:73
G4GLOB_DLL std::ostream G4cout
const G4VisExtent & GetExtent() const
bool G4bool
Definition: G4Types.hh:79
const XML_Char XML_Content * model
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:294
static G4double fCurrentLineWidth
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4Scene * GetCurrentScene() const
static G4VisManager * fpVisManager

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