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

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddArrow:
G4VVisCommandScene G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSceneAddArrow ()
 
virtual ~G4VisCommandSceneAddArrow ()
 
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 46 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

G4VisCommandSceneAddArrow::G4VisCommandSceneAddArrow ( )

Definition at line 92 of file G4VisCommandsSceneAdd.cc.

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

92  {
93  fpCommand = new G4UIcommand("/vis/scene/add/arrow", this);
94  fpCommand -> SetGuidance ("Adds arrow to current scene.");
95  G4bool omitable;
96  G4UIparameter* parameter;
97  parameter = new G4UIparameter ("x1", 'd', omitable = false);
98  fpCommand -> SetParameter (parameter);
99  parameter = new G4UIparameter ("y1", 'd', omitable = false);
100  fpCommand -> SetParameter (parameter);
101  parameter = new G4UIparameter ("z1", 'd', omitable = false);
102  fpCommand -> SetParameter (parameter);
103  parameter = new G4UIparameter ("x2", 'd', omitable = false);
104  fpCommand -> SetParameter (parameter);
105  parameter = new G4UIparameter ("y2", 'd', omitable = false);
106  fpCommand -> SetParameter (parameter);
107  parameter = new G4UIparameter ("z2", 'd', omitable = false);
108  fpCommand -> SetParameter (parameter);
109  parameter = new G4UIparameter ("unit", 's', omitable = true);
110  parameter->SetDefaultValue ("m");
111  fpCommand->SetParameter (parameter);
112 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetDefaultValue(const char *theDefaultValue)
bool G4bool
Definition: G4Types.hh:79
G4VisCommandSceneAddArrow::~G4VisCommandSceneAddArrow ( )
virtual

Definition at line 114 of file G4VisCommandsSceneAdd.cc.

114  {
115  delete fpCommand;
116 }

Member Function Documentation

G4String G4VisCommandSceneAddArrow::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 118 of file G4VisCommandsSceneAdd.cc.

118  {
119  return "";
120 }
void G4VisCommandSceneAddArrow::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 122 of file G4VisCommandsSceneAdd.cc.

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

123 {
125  G4bool warn(verbosity >= G4VisManager::warnings);
126 
127  G4Scene* pScene = fpVisManager->GetCurrentScene();
128  if (!pScene) {
129  if (verbosity >= G4VisManager::errors) {
130  G4cout << "ERROR: No current scene. Please create one." << G4endl;
131  }
132  return;
133  }
134 
135  G4String unitString;
136  G4double x1, y1, z1, x2, y2, z2;
137  std::istringstream is(newValue);
138  is >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> unitString;
139  G4double unit = G4UIcommand::ValueOf(unitString);
140  x1 *= unit; y1 *= unit; z1 *= unit;
141  x2 *= unit; y2 *= unit; z2 *= unit;
142 
143  // Consult scene for arrow width.
144  const G4VisExtent& sceneExtent = pScene->GetExtent();
145  G4double arrowWidth =
146  0.005 * fCurrentLineWidth * sceneExtent.GetExtentRadius();
147 
149  (x1, y1, z1, x2, y2, z2,
150  arrowWidth, fCurrentColour, newValue);
151 
152  const G4String& currentSceneName = pScene -> GetName ();
153  G4bool successful = pScene -> AddRunDurationModel (model, warn);
154  if (successful) {
155  if (verbosity >= G4VisManager::confirmations) {
156  G4cout << "Arrow has been added to scene \""
157  << currentSceneName << "\"."
158  << G4endl;
159  }
160  }
161  else G4VisCommandsSceneAddUnsuccessful(verbosity);
162  UpdateVisManagerScene (currentSceneName);
163 }
static G4Colour fCurrentColour
void UpdateVisManagerScene(const G4String &sceneName="")
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: