Geant4  10.02.p03
G4VisCommandsTouchableSet Class Reference

#include <G4VisCommandsTouchableSet.hh>

Inheritance diagram for G4VisCommandsTouchableSet:
Collaboration diagram for G4VisCommandsTouchableSet:

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
 
G4bool CommandsShouldBeInMaster () const
 

Private Member Functions

 G4VisCommandsTouchableSet (const G4VisCommandsTouchableSet &)
 
G4VisCommandsTouchableSetoperator= (const G4VisCommandsTouchableSet &)
 

Private Attributes

G4UIcommandfpCommandSetColour
 
G4UIcmdWithABoolfpCommandSetDaughtersInvisible
 
G4UIcmdWithABoolfpCommandSetForceAuxEdgeVisible
 
G4UIcmdWithAnIntegerfpCommandSetLineSegmentsPerCircle
 
G4UIcmdWithABoolfpCommandSetForceSolid
 
G4UIcmdWithABoolfpCommandSetForceWireframe
 
G4UIcmdWithAStringfpCommandSetLineStyle
 
G4UIcmdWithADoublefpCommandSetLineWidth
 
G4UIcmdWithABoolfpCommandSetVisibility
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
static const G4ColourGetCurrentColour ()
 
static G4double GetCurrentLineWidth ()
 
static const G4ColourGetCurrentTextColour ()
 
static G4Text::Layout GetCurrentTextLayout ()
 
static G4double GetCurrentTextSize ()
 
- 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
 
G4bool commandsShouldBeInMaster
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
 

Detailed Description

Definition at line 42 of file G4VisCommandsTouchableSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandsTouchableSet() [1/2]

G4VisCommandsTouchableSet::G4VisCommandsTouchableSet ( )

Definition at line 44 of file G4VisCommandsTouchableSet.cc.

45 {
46  G4bool omitable;
47  G4UIparameter* parameter;
48 
50  ("/vis/touchable/set/colour", this);
51  fpCommandSetColour->SetGuidance("Set colour of current touchable.");
53  ("Use \"/vis/set/touchable\" to set current touchable.");
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 
71  ("/vis/touchable/set/daughtersInvisible", this);
73  ("Daughters of current touchable invisible: true/false.");
75  ("Use \"/vis/set/touchable\" to set current touchable.");
76  fpCommandSetDaughtersInvisible->SetParameterName("daughtersInvisible", omitable = true);
78 
80  ("/vis/touchable/set/forceAuxEdgeVisible", this);
82  ("Force auxiliary (soft) edges of current touchable to be visible: true/false.");
84  ("Use \"/vis/set/touchable\" to set current touchable.");
85  fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
87 
89  ("/vis/touchable/set/lineSegmentsPerCircle", this);
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.");
96  ("Use \"/vis/set/touchable\" to set current touchable.");
97  fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
99 
101  ("/vis/touchable/set/forceSolid", this);
103  ("Force current touchable always to be drawn solid (surface drawing).");
105  ("Use \"/vis/set/touchable\" to set current touchable.");
106  fpCommandSetForceSolid->SetParameterName("forceSolid", omitable = true);
108 
110  ("/vis/touchable/set/forceWireframe", this);
112  ("Force current touchable always to be drawn as wireframe.");
114  ("Use \"/vis/set/touchable\" to set current touchable.");
115  fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true);
117 
119  ("/vis/touchable/set/lineStyle", this);
120  fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing.");
122  ("Use \"/vis/set/touchable\" to set current touchable.");
123  fpCommandSetLineStyle->SetParameterName("lineStyle", omitable = true);
124  fpCommandSetLineStyle->SetCandidates("unbroken dashed dotted");
126 
128  ("/vis/touchable/set/lineWidth", this);
129  fpCommandSetLineWidth->SetGuidance("Set line width of current touchable.");
131  ("Use \"/vis/set/touchable\" to set current touchable.");
132  fpCommandSetLineWidth->SetParameterName("lineWidth", omitable = true);
134 
136  ("/vis/touchable/set/visibility", this);
138  ("Set visibility of current touchable: true/false.");
140  ("Use \"/vis/set/touchable\" to set current touchable.");
141  fpCommandSetVisibility->SetParameterName("visibility", omitable = true);
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)
G4UIcmdWithAString * fpCommandSetLineStyle
G4UIcmdWithABool * fpCommandSetForceAuxEdgeVisible
G4UIcmdWithADouble * fpCommandSetLineWidth
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
G4UIcmdWithAnInteger * fpCommandSetLineSegmentsPerCircle
G4UIcmdWithABool * fpCommandSetForceWireframe
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)
G4UIcmdWithABool * fpCommandSetDaughtersInvisible
Here is the call graph for this function:

◆ ~G4VisCommandsTouchableSet()

G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet ( )
virtual

Definition at line 145 of file G4VisCommandsTouchableSet.cc.

145  {
146  delete fpCommandSetVisibility;
147  delete fpCommandSetLineWidth;
148  delete fpCommandSetLineStyle;
150  delete fpCommandSetForceSolid;
154  delete fpCommandSetColour;
155 }
G4UIcmdWithAString * fpCommandSetLineStyle
G4UIcmdWithABool * fpCommandSetForceAuxEdgeVisible
G4UIcmdWithADouble * fpCommandSetLineWidth
G4UIcmdWithAnInteger * fpCommandSetLineSegmentsPerCircle
G4UIcmdWithABool * fpCommandSetForceWireframe
G4UIcmdWithABool * fpCommandSetDaughtersInvisible

◆ G4VisCommandsTouchableSet() [2/2]

G4VisCommandsTouchableSet::G4VisCommandsTouchableSet ( const G4VisCommandsTouchableSet )
private

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandsTouchableSet::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 157 of file G4VisCommandsTouchableSet.cc.

157  {
158  return "";
159 }
Here is the call graph for this function:

◆ operator=()

G4VisCommandsTouchableSet& G4VisCommandsTouchableSet::operator= ( const G4VisCommandsTouchableSet )
private

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 162 of file G4VisCommandsTouchableSet.cc.

163 {
165 
166  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
167  if (!currentViewer) {
168  if (verbosity >= G4VisManager::errors) {
169  G4cerr <<
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  G4cerr <<
292  "ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command."
293  << G4endl;
294  }
295  return;
296  }
297 
298  SetViewParameters(currentViewer,workingVP);
299 }
void SetColour(const G4Colour &)
G4VViewer * GetCurrentViewer() const
void SetForceWireframe(G4bool)
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
void SetLineStyle(LineStyle)
void SetLineWidth(G4double)
void SetVisibility(G4bool)
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:126
void SetViewParameters(G4VViewer *, const G4ViewParameters &)
void SetForceSolid(G4bool)
G4UIcmdWithAString * fpCommandSetLineStyle
Definition: test07.cc:36
G4UIcmdWithABool * fpCommandSetForceAuxEdgeVisible
G4UIcmdWithADouble * fpCommandSetLineWidth
G4GLOB_DLL std::ostream G4cout
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:425
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:443
G4UIcmdWithAnInteger * fpCommandSetLineSegmentsPerCircle
void SetForceAuxEdgeVisible(G4bool)
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:435
G4UIcmdWithABool * fpCommandSetForceWireframe
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
static Verbosity GetVerbosity()
const G4ViewParameters & GetViewParameters() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetDaughtersInvisible(G4bool)
G4UIcmdWithABool * fpCommandSetDaughtersInvisible
G4GLOB_DLL std::ostream G4cerr
void SetForceLineSegmentsPerCircle(G4int nSegments)
static G4VisManager * fpVisManager
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fpCommandSetColour

G4UIcommand* G4VisCommandsTouchableSet::fpCommandSetColour
private

Definition at line 51 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetDaughtersInvisible

G4UIcmdWithABool* G4VisCommandsTouchableSet::fpCommandSetDaughtersInvisible
private

Definition at line 52 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetForceAuxEdgeVisible

G4UIcmdWithABool* G4VisCommandsTouchableSet::fpCommandSetForceAuxEdgeVisible
private

Definition at line 53 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetForceSolid

G4UIcmdWithABool* G4VisCommandsTouchableSet::fpCommandSetForceSolid
private

Definition at line 55 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetForceWireframe

G4UIcmdWithABool* G4VisCommandsTouchableSet::fpCommandSetForceWireframe
private

Definition at line 56 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetLineSegmentsPerCircle

G4UIcmdWithAnInteger* G4VisCommandsTouchableSet::fpCommandSetLineSegmentsPerCircle
private

Definition at line 54 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetLineStyle

G4UIcmdWithAString* G4VisCommandsTouchableSet::fpCommandSetLineStyle
private

Definition at line 57 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetLineWidth

G4UIcmdWithADouble* G4VisCommandsTouchableSet::fpCommandSetLineWidth
private

Definition at line 58 of file G4VisCommandsTouchableSet.hh.

◆ fpCommandSetVisibility

G4UIcmdWithABool* G4VisCommandsTouchableSet::fpCommandSetVisibility
private

Definition at line 59 of file G4VisCommandsTouchableSet.hh.


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