Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandsTouchableSet Class Reference

#include <G4VisCommandsTouchableSet.hh>

+ Inheritance 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)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
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)
 
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::G4VisCommandsTouchableSet ( )

Definition at line 44 of file G4VisCommandsTouchableSet.cc.

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 parameter = new G4UIparameter("red", 's', omitable = true);
55 parameter->SetDefaultValue("1.");
56 parameter->SetGuidance
57 ("Red component or a string, e.g., \"blue\", in which case succeeding colour"
58 "\ncomponents are ignored.");
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:"
83 " true/false.");
84 fpCommandSetForceAuxEdgeVisible->SetGuidance
85 ("Use \"/vis/set/touchable\" to set current touchable.");
86 fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
87 fpCommandSetForceAuxEdgeVisible->SetDefaultValue(false);
88
89 fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger
90 ("/vis/touchable/set/lineSegmentsPerCircle", this);
91 fpCommandSetLineSegmentsPerCircle->SetGuidance
92 ("For current touchable, set number of line segments per circle, the"
93 "\nprecision with which a curved line or surface is represented by a"
94 "\npolygon or polyhedron, regardless of the view parameters."
95 "\nNegative to pick up G4Polyhedron default value.");
96 fpCommandSetLineSegmentsPerCircle->SetGuidance
97 ("Use \"/vis/set/touchable\" to set current touchable.");
98 fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
99 fpCommandSetLineSegmentsPerCircle->SetDefaultValue(-1);
100
101 fpCommandSetForceSolid = new G4UIcmdWithABool
102 ("/vis/touchable/set/forceSolid", this);
103 fpCommandSetForceSolid->SetGuidance
104 ("Force current touchable always to be drawn solid (surface drawing).");
105 fpCommandSetForceSolid->SetGuidance
106 ("Use \"/vis/set/touchable\" to set current touchable.");
107 fpCommandSetForceSolid->SetParameterName("forceSolid", omitable = true);
108 fpCommandSetForceSolid->SetDefaultValue(false);
109
110 fpCommandSetForceWireframe = new G4UIcmdWithABool
111 ("/vis/touchable/set/forceWireframe", this);
112 fpCommandSetForceWireframe->SetGuidance
113 ("Force current touchable always to be drawn as wireframe.");
114 fpCommandSetForceWireframe->SetGuidance
115 ("Use \"/vis/set/touchable\" to set current touchable.");
116 fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true);
117 fpCommandSetForceWireframe->SetDefaultValue(false);
118
119 fpCommandSetLineStyle = new G4UIcmdWithAString
120 ("/vis/touchable/set/lineStyle", this);
121 fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing.");
122 fpCommandSetLineStyle->SetGuidance
123 ("Use \"/vis/set/touchable\" to set current touchable.");
124 fpCommandSetLineStyle->SetParameterName("lineStyle", omitable = true);
125 fpCommandSetLineStyle->SetCandidates("unbroken dashed dotted");
126 fpCommandSetLineStyle->SetDefaultValue("unbroken");
127
128 fpCommandSetLineWidth = new G4UIcmdWithADouble
129 ("/vis/touchable/set/lineWidth", this);
130 fpCommandSetLineWidth->SetGuidance("Set line width of current touchable.");
131 fpCommandSetLineWidth->SetGuidance
132 ("Use \"/vis/set/touchable\" to set current touchable.");
133 fpCommandSetLineWidth->SetParameterName("lineWidth", omitable = true);
134 fpCommandSetLineWidth->SetDefaultValue(1.);
135
136 fpCommandSetVisibility = new G4UIcmdWithABool
137 ("/vis/touchable/set/visibility", this);
138 fpCommandSetVisibility->SetGuidance
139 ("Set visibility of current touchable: true/false.");
140 fpCommandSetVisibility->SetGuidance
141 ("Use \"/vis/set/touchable\" to set current touchable.");
142 fpCommandSetVisibility->SetParameterName("visibility", omitable = true);
143 fpCommandSetVisibility->SetDefaultValue(false);
144}
bool G4bool
Definition: G4Types.hh:67
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4double defVal)
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:147
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetDefaultValue(const char *theDefaultValue)
void SetGuidance(const char *theGuidance)

◆ ~G4VisCommandsTouchableSet()

G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet ( )
virtual

Definition at line 146 of file G4VisCommandsTouchableSet.cc.

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

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandsTouchableSet::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 158 of file G4VisCommandsTouchableSet.cc.

158 {
159 return "";
160}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 162 of file G4VisCommandsTouchableSet.cc.

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

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