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

#include <G4VisCommandsTouchableSet.hh>

Inheritance diagram for G4VisCommandsTouchableSet:
G4VVisCommandViewer G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandsTouchableSet ()
 
virtual ~G4VisCommandsTouchableSet ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandViewer
 G4VVisCommandViewer ()
 
virtual ~G4VVisCommandViewer ()
 
- 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 G4VVisCommandViewer
void SetViewParameters (G4VViewer *, const G4ViewParameters &)
 
void RefreshIfRequired (G4VViewer *)
 
- 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 42 of file G4VisCommandsTouchableSet.hh.

Constructor & Destructor Documentation

G4VisCommandsTouchableSet::G4VisCommandsTouchableSet ( )

Definition at line 44 of file G4VisCommandsTouchableSet.cc.

References G4UIcmdWithAString::SetCandidates(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcmdWithADouble::SetDefaultValue(), G4UIcmdWithAString::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcmdWithADouble::SetParameterName(), and G4UIcmdWithABool::SetParameterName().

45 {
46  G4bool omitable;
47  G4UIparameter* parameter;
48 
49  fpCommandSetColour = new G4UIcommand
50  ("/vis/touchable/set/colour", this);
51  fpCommandSetColour->SetGuidance("Set colour of current touchable.");
52  fpCommandSetColour->SetGuidance
53  ("Use \"/vis/set/touchable\" to set current touchable.");
54  fpCommandSetColour->SetGuidance
55  ("If \"red\" is a string understood by the vis system it will be taken."
56  "\n Otherwise the values of \red\", \"green\", etc., are used.");
57  parameter = new G4UIparameter("red", 's', omitable = true);
58  parameter->SetDefaultValue("1.");
59  fpCommandSetColour->SetParameter(parameter);
60  parameter = new G4UIparameter("green", 'd', omitable = true);
61  parameter->SetDefaultValue(1.);
62  fpCommandSetColour->SetParameter(parameter);
63  parameter = new G4UIparameter("blue", 'd', omitable = true);
64  parameter->SetDefaultValue(1.);
65  fpCommandSetColour->SetParameter(parameter);
66  parameter = new G4UIparameter("opacity", 'd', omitable = true);
67  parameter->SetDefaultValue(1.);
68  fpCommandSetColour->SetParameter(parameter);
69 
70  fpCommandSetDaughtersInvisible = new G4UIcmdWithABool
71  ("/vis/touchable/set/daughtersInvisible", this);
72  fpCommandSetDaughtersInvisible->SetGuidance
73  ("Daughters of current touchable invisible: true/false.");
74  fpCommandSetDaughtersInvisible->SetGuidance
75  ("Use \"/vis/set/touchable\" to set current touchable.");
76  fpCommandSetDaughtersInvisible->SetParameterName("daughtersInvisible", omitable = true);
77  fpCommandSetDaughtersInvisible->SetDefaultValue(false);
78 
79  fpCommandSetForceAuxEdgeVisible = new G4UIcmdWithABool
80  ("/vis/touchable/set/forceAuxEdgeVisible", this);
81  fpCommandSetForceAuxEdgeVisible->SetGuidance
82  ("Force auxiliary (soft) edges of current touchable to be visible: true/false.");
83  fpCommandSetForceAuxEdgeVisible->SetGuidance
84  ("Use \"/vis/set/touchable\" to set current touchable.");
85  fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
86  fpCommandSetForceAuxEdgeVisible->SetDefaultValue(false);
87 
88  fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger
89  ("/vis/touchable/set/lineSegmentsPerCircle", this);
90  fpCommandSetLineSegmentsPerCircle->SetGuidance
91  ("For current touchable, set number of line segments per circle, the"
92  "\nprecision with which a curved line or surface is represented by a"
93  "\npolygon or polyhedron, regardless of the view parameters."
94  "\nNegative to pick up G4Polyhedron default value.");
95  fpCommandSetLineSegmentsPerCircle->SetGuidance
96  ("Use \"/vis/set/touchable\" to set current touchable.");
97  fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
98  fpCommandSetLineSegmentsPerCircle->SetDefaultValue(-1);
99 
100  fpCommandSetForceSolid = new G4UIcmdWithABool
101  ("/vis/touchable/set/forceSolid", this);
102  fpCommandSetForceSolid->SetGuidance
103  ("Force current touchable always to be drawn solid (surface drawing).");
104  fpCommandSetForceSolid->SetGuidance
105  ("Use \"/vis/set/touchable\" to set current touchable.");
106  fpCommandSetForceSolid->SetParameterName("forceSolid", omitable = true);
107  fpCommandSetForceSolid->SetDefaultValue(false);
108 
109  fpCommandSetForceWireframe = new G4UIcmdWithABool
110  ("/vis/touchable/set/forceWireframe", this);
111  fpCommandSetForceWireframe->SetGuidance
112  ("Force current touchable always to be drawn as wireframe.");
113  fpCommandSetForceWireframe->SetGuidance
114  ("Use \"/vis/set/touchable\" to set current touchable.");
115  fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true);
116  fpCommandSetForceWireframe->SetDefaultValue(false);
117 
118  fpCommandSetLineStyle = new G4UIcmdWithAString
119  ("/vis/touchable/set/lineStyle", this);
120  fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing.");
121  fpCommandSetLineStyle->SetGuidance
122  ("Use \"/vis/set/touchable\" to set current touchable.");
123  fpCommandSetLineStyle->SetParameterName("lineStyle", omitable = true);
124  fpCommandSetLineStyle->SetCandidates("unbroken dashed dotted");
125  fpCommandSetLineStyle->SetDefaultValue("unbroken");
126 
127  fpCommandSetLineWidth = new G4UIcmdWithADouble
128  ("/vis/touchable/set/lineWidth", this);
129  fpCommandSetLineWidth->SetGuidance("Set line width of current touchable.");
130  fpCommandSetLineWidth->SetGuidance
131  ("Use \"/vis/set/touchable\" to set current touchable.");
132  fpCommandSetLineWidth->SetParameterName("lineWidth", omitable = true);
133  fpCommandSetLineWidth->SetDefaultValue(1.);
134 
135  fpCommandSetVisibility = new G4UIcmdWithABool
136  ("/vis/touchable/set/visibility", this);
137  fpCommandSetVisibility->SetGuidance
138  ("Set visibility of current touchable: true/false.");
139  fpCommandSetVisibility->SetGuidance
140  ("Use \"/vis/set/touchable\" to set current touchable.");
141  fpCommandSetVisibility->SetParameterName("visibility", omitable = true);
142  fpCommandSetVisibility->SetDefaultValue(false);
143 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *theDefaultValue)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4double defVal)
void SetCandidates(const char *candidateList)
void SetDefaultValue(G4int defVal)
G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet ( )
virtual

Definition at line 145 of file G4VisCommandsTouchableSet.cc.

145  {
146  delete fpCommandSetVisibility;
147  delete fpCommandSetLineWidth;
148  delete fpCommandSetLineStyle;
149  delete fpCommandSetForceWireframe;
150  delete fpCommandSetForceSolid;
151  delete fpCommandSetLineSegmentsPerCircle;
152  delete fpCommandSetForceAuxEdgeVisible;
153  delete fpCommandSetDaughtersInvisible;
154  delete fpCommandSetColour;
155 }

Member Function Documentation

G4String G4VisCommandsTouchableSet::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 157 of file G4VisCommandsTouchableSet.cc.

157  {
158  return "";
159 }
void G4VisCommandsTouchableSet::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 162 of file G4VisCommandsTouchableSet.cc.

References G4ViewParameters::AddVisAttributesModifier(), blue, G4UIcommand::ConvertToBool(), G4UIcommand::ConvertToDouble(), G4UIcommand::ConvertToInt(), G4VisAttributes::dashed, G4VisAttributes::dotted, G4VisManager::errors, G4cout, G4endl, G4Colour::GetBlue(), G4Colour::GetColour(), G4Colour::GetGreen(), G4Colour::GetRed(), G4VViewer::GetViewParameters(), G4VisAttributes::SetColour(), G4VisAttributes::SetDaughtersInvisible(), G4VisAttributes::SetForceAuxEdgeVisible(), G4VisAttributes::SetForceLineSegmentsPerCircle(), G4VisAttributes::SetForceSolid(), G4VisAttributes::SetForceWireframe(), G4VisAttributes::SetLineStyle(), G4VisAttributes::SetLineWidth(), G4VisAttributes::SetVisibility(), G4VisAttributes::unbroken, G4ModelingParameters::VASColour, G4ModelingParameters::VASDaughtersInvisible, G4ModelingParameters::VASForceAuxEdgeVisible, G4ModelingParameters::VASForceLineSegmentsPerCircle, G4ModelingParameters::VASForceSolid, G4ModelingParameters::VASForceWireframe, G4ModelingParameters::VASLineStyle, G4ModelingParameters::VASLineWidth, G4ModelingParameters::VASVisibility, and G4VisManager::warnings.

163 {
165 
166  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
167  if (!currentViewer) {
168  if (verbosity >= G4VisManager::errors) {
169  G4cout <<
170  "ERROR: G4VisCommandsTouchableSet::SetNewValue: no current viewer."
171  << G4endl;
172  }
173  return;
174  }
175 
176  G4ViewParameters workingVP = currentViewer->GetViewParameters();
177  G4VisAttributes workingVisAtts;
178 
179  if (command == fpCommandSetColour)
180  {
181  G4String redOrString;
182  G4double green, blue, opacity;
183  std::istringstream iss(newValue);
184  iss >> redOrString >> green >> blue >> opacity;
185  G4Colour colour(1,1,1,1); // Default white and opaque.
186  const size_t iPos0 = 0;
187  if (std::isalpha(redOrString[iPos0])) {
188  if (!G4Colour::GetColour(redOrString, colour)) {
190  G4cout << "WARNING: Colour \"" << redOrString
191  << "\" not found. Defaulting to white and opaque."
192  << G4endl;
193  }
194  }
195  } else {
196  colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue);
197  }
198  colour = G4Colour
199  (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
200 
201  workingVisAtts.SetColour(colour);
202  workingVP.AddVisAttributesModifier
204  (workingVisAtts,
207  }
208 
209  else if (command == fpCommandSetDaughtersInvisible) {
210  workingVisAtts.SetDaughtersInvisible(G4UIcommand::ConvertToBool(newValue));
211  workingVP.AddVisAttributesModifier
213  (workingVisAtts,
216  }
217 
218  else if (command == fpCommandSetForceAuxEdgeVisible) {
219  workingVisAtts.SetForceAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue));
220  workingVP.AddVisAttributesModifier
222  (workingVisAtts,
225  }
226 
227  else if (command == fpCommandSetLineSegmentsPerCircle) {
228  workingVisAtts.SetForceLineSegmentsPerCircle
229  (G4UIcommand::ConvertToInt(newValue));
230  workingVP.AddVisAttributesModifier
232  (workingVisAtts,
235  }
236 
237  else if (command == fpCommandSetForceSolid) {
238  workingVisAtts.SetForceSolid(G4UIcommand::ConvertToBool(newValue));
239  workingVP.AddVisAttributesModifier
241  (workingVisAtts,
244  }
245 
246  else if (command == fpCommandSetForceWireframe) {
247  workingVisAtts.SetForceWireframe(G4UIcommand::ConvertToBool(newValue));
248  workingVP.AddVisAttributesModifier
250  (workingVisAtts,
253  }
254 
255  else if (command == fpCommandSetLineStyle) {
257  if (newValue == "dashed") {
258  lineStyle = G4VisAttributes::dashed;
259  } else if (newValue == "dotted") {
260  lineStyle = G4VisAttributes::dotted;
261  }
262  // All other values are "unbroken".
263  workingVisAtts.SetLineStyle(lineStyle);
264  workingVP.AddVisAttributesModifier
266  (workingVisAtts,
269  }
270 
271  else if (command == fpCommandSetLineWidth) {
272  workingVisAtts.SetLineWidth(G4UIcommand::ConvertToDouble(newValue));
273  workingVP.AddVisAttributesModifier
275  (workingVisAtts,
278  }
279 
280  else if (command == fpCommandSetVisibility) {
281  workingVisAtts.SetVisibility(G4UIcommand::ConvertToBool(newValue));
282  workingVP.AddVisAttributesModifier
284  (workingVisAtts,
287  }
288 
289  else {
290  if (verbosity >= G4VisManager::errors) {
291  G4cout <<
292  "ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command."
293  << G4endl;
294  }
295  return;
296  }
297 
298  SetViewParameters(currentViewer,workingVP);
299 }
void SetColour(const G4Colour &)
void SetForceWireframe(G4bool)
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
void SetLineStyle(LineStyle)
void SetLineWidth(G4double)
void SetVisibility(G4bool)
const G4ViewParameters & GetViewParameters() const
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:126
void SetViewParameters(G4VViewer *, const G4ViewParameters &)
void SetForceSolid(G4bool)
Definition: test07.cc:36
G4GLOB_DLL std::ostream G4cout
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:411
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:429
void SetForceAuxEdgeVisible(G4bool)
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:421
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
G4VViewer * GetCurrentViewer() const
double G4double
Definition: G4Types.hh:76
void SetDaughtersInvisible(G4bool)
void SetForceLineSegmentsPerCircle(G4int nSegments)
static G4VisManager * fpVisManager

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