Geant4 11.2.2
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 G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static G4VisManagerGetVisManager ()
 
static void SetVisManager (G4VisManager *pVisManager)
 
static const G4ColourGetCurrentTextColour ()
 
- Protected Member Functions inherited from G4VVisCommand
void SetViewParameters (G4VViewer *viewer, const G4ViewParameters &viewParams)
 
void RefreshIfRequired (G4VViewer *viewer)
 
void InterpolateViews (G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void InterpolateToNewView (G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void Twinkle (G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
 
const G4StringConvertToColourGuidance ()
 
void ConvertToColour (G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
 
G4bool ProvideValueOfUnit (const G4String &where, const G4String &unit, const G4String &category, G4double &value)
 
void CopyCameraParameters (G4ViewParameters &target, const G4ViewParameters &from)
 
void CheckSceneAndNotifyHandlers (G4Scene *=nullptr)
 
G4bool CheckView ()
 
void G4VisCommandsSceneAddUnsuccessful (G4VisManager::Verbosity verbosity)
 
void CopyGuidanceFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
 
void CopyParametersFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd)
 
void DrawExtent (const G4VisExtent &)
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 G4bool ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = nullptr
 
static G4int fCurrentArrow3DLineSegmentsPerCircle = 6
 
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 G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
 
static G4VisExtent fCurrentExtentForField
 
static std::vector< G4PhysicalVolumesSearchScene::FindingsfCurrrentPVFindingsForField
 
static G4bool fThereWasAViewer = false
 
static G4ViewParameters fExistingVP
 
static G4SceneTreeItem fExistingSceneTree
 

Detailed Description

Definition at line 41 of file G4VisCommandsTouchableSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandsTouchableSet()

G4VisCommandsTouchableSet::G4VisCommandsTouchableSet ( )

Definition at line 45 of file G4VisCommandsTouchableSet.cc.

46{
47 G4bool omitable;
48 G4UIparameter* parameter;
49
50 fpCommandSetColour = new G4UIcommand
51 ("/vis/touchable/set/colour", this);
52 fpCommandSetColour->SetGuidance("Set colour of current touchable.");
53 fpCommandSetColour->SetGuidance
54 ("Use \"/vis/set/touchable\" to set current touchable.");
55 fpCommandSetColour->SetGuidance(ConvertToColourGuidance());
56 parameter = new G4UIparameter("red", 's', omitable = true);
57 parameter->SetDefaultValue("1.");
58 fpCommandSetColour->SetParameter(parameter);
59 parameter = new G4UIparameter("green", 'd', omitable = true);
60 parameter->SetDefaultValue(1.);
61 fpCommandSetColour->SetParameter(parameter);
62 parameter = new G4UIparameter("blue", 'd', omitable = true);
63 parameter->SetDefaultValue(1.);
64 fpCommandSetColour->SetParameter(parameter);
65 parameter = new G4UIparameter("opacity", 'd', omitable = true);
66 parameter->SetDefaultValue(1.);
67 fpCommandSetColour->SetParameter(parameter);
68
69 fpCommandSetDaughtersInvisible = new G4UIcmdWithABool
70 ("/vis/touchable/set/daughtersInvisible", this);
71 fpCommandSetDaughtersInvisible->SetGuidance
72 ("Daughters of current touchable invisible: true/false.");
73 fpCommandSetDaughtersInvisible->SetGuidance
74 ("Use \"/vis/set/touchable\" to set current touchable.");
75 fpCommandSetDaughtersInvisible->SetParameterName("daughtersInvisible", omitable = true);
76 fpCommandSetDaughtersInvisible->SetDefaultValue(true);
77
78 fpCommandSetForceAuxEdgeVisible = new G4UIcmdWithABool
79 ("/vis/touchable/set/forceAuxEdgeVisible", this);
80 fpCommandSetForceAuxEdgeVisible->SetGuidance
81 ("Force auxiliary (soft) edges of current touchable to be visible: true/false.");
82 fpCommandSetForceAuxEdgeVisible->SetGuidance
83 ("Use \"/vis/set/touchable\" to set current touchable.");
84 fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
85 fpCommandSetForceAuxEdgeVisible->SetDefaultValue(true);
86
87 fpCommandSetForceCloud = new G4UIcmdWithABool
88 ("/vis/touchable/set/forceCloud", this);
89 fpCommandSetForceCloud->SetGuidance
90 ("Force current touchable always to be drawn as a cloud.");
91 fpCommandSetForceCloud->SetGuidance
92 ("Use \"/vis/set/touchable\" to set current touchable.");
93 fpCommandSetForceCloud->SetParameterName("force", omitable = true);
94 fpCommandSetForceCloud->SetDefaultValue(true);
95
96 fpCommandSetForceSolid = new G4UIcmdWithABool
97 ("/vis/touchable/set/forceSolid", this);
98 fpCommandSetForceSolid->SetGuidance
99 ("Force current touchable always to be drawn solid (surface drawing).");
100 fpCommandSetForceSolid->SetGuidance
101 ("Use \"/vis/set/touchable\" to set current touchable.");
102 fpCommandSetForceSolid->SetParameterName("force", omitable = true);
103 fpCommandSetForceSolid->SetDefaultValue(true);
104
105 fpCommandSetForceWireframe = new G4UIcmdWithABool
106 ("/vis/touchable/set/forceWireframe", this);
107 fpCommandSetForceWireframe->SetGuidance
108 ("Force current touchable always to be drawn as wireframe.");
109 fpCommandSetForceWireframe->SetGuidance
110 ("Use \"/vis/set/touchable\" to set current touchable.");
111 fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true);
112 fpCommandSetForceWireframe->SetDefaultValue(true);
113
114 fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger
115 ("/vis/touchable/set/lineSegmentsPerCircle", this);
116 fpCommandSetLineSegmentsPerCircle->SetGuidance
117 ("For current touchable, set number of line segments per circle, the"
118 "\nprecision with which a curved line or surface is represented by a"
119 "\npolygon or polyhedron, regardless of the view parameters."
120 "\nNegative to pick up G4Polyhedron default value.");
121 fpCommandSetLineSegmentsPerCircle->SetGuidance
122 ("Use \"/vis/set/touchable\" to set current touchable.");
123 fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
124 fpCommandSetLineSegmentsPerCircle->SetDefaultValue(0);
125
126 fpCommandSetLineStyle = new G4UIcmdWithAString
127 ("/vis/touchable/set/lineStyle", this);
128 fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing.");
129 fpCommandSetLineStyle->SetGuidance
130 ("Use \"/vis/set/touchable\" to set current touchable.");
131 fpCommandSetLineStyle->SetParameterName("lineStyle", omitable = true);
132 fpCommandSetLineStyle->SetCandidates("unbroken dashed dotted");
133 fpCommandSetLineStyle->SetDefaultValue("unbroken");
134
135 fpCommandSetLineWidth = new G4UIcmdWithADouble
136 ("/vis/touchable/set/lineWidth", this);
137 fpCommandSetLineWidth->SetGuidance("Set line width of current touchable.");
138 fpCommandSetLineWidth->SetGuidance
139 ("Use \"/vis/set/touchable\" to set current touchable.");
140 fpCommandSetLineWidth->SetParameterName("lineWidth", omitable = true);
141 fpCommandSetLineWidth->SetDefaultValue(1.);
142
143 fpCommandSetNumberOfCloudPoints = new G4UIcmdWithAnInteger
144 ("/vis/touchable/set/numberOfCloudPoints", this);
145 fpCommandSetNumberOfCloudPoints->SetGuidance
146 ("For current touchable, set number of cloud points for cloud drawing."
147 "\n<= 0 means under control of viewer.");
148 fpCommandSetNumberOfCloudPoints->SetGuidance
149 ("Use \"/vis/set/touchable\" to set current touchable.");
150 fpCommandSetNumberOfCloudPoints->SetParameterName("numberOfCloudPoints", omitable = true);
151 fpCommandSetNumberOfCloudPoints->SetDefaultValue(0);
152
153 fpCommandSetVisibility = new G4UIcmdWithABool
154 ("/vis/touchable/set/visibility", this);
155 fpCommandSetVisibility->SetGuidance
156 ("Set visibility of current touchable: true/false.");
157 fpCommandSetVisibility->SetGuidance
158 ("Use \"/vis/set/touchable\" to set current touchable.");
159 fpCommandSetVisibility->SetParameterName("visibility", omitable = true);
160 fpCommandSetVisibility->SetDefaultValue(true);
161}
bool G4bool
Definition G4Types.hh:86
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)
void SetGuidance(const char *aGuidance)
void SetDefaultValue(const char *theDefaultValue)
const G4String & ConvertToColourGuidance()

◆ ~G4VisCommandsTouchableSet()

G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet ( )
virtual

Definition at line 163 of file G4VisCommandsTouchableSet.cc.

163 {
164 delete fpCommandSetVisibility;
165 delete fpCommandSetNumberOfCloudPoints;
166 delete fpCommandSetLineWidth;
167 delete fpCommandSetLineStyle;
168 delete fpCommandSetForceWireframe;
169 delete fpCommandSetForceSolid;
170 delete fpCommandSetForceCloud;
171 delete fpCommandSetLineSegmentsPerCircle;
172 delete fpCommandSetForceAuxEdgeVisible;
173 delete fpCommandSetDaughtersInvisible;
174 delete fpCommandSetColour;
175}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandsTouchableSet::GetCurrentValue ( G4UIcommand * command)
virtual

Reimplemented from G4UImessenger.

Definition at line 177 of file G4VisCommandsTouchableSet.cc.

177 {
178 return "";
179}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 181 of file G4VisCommandsTouchableSet.cc.

183{
185
186 G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
187 if (!currentViewer) {
188 if (verbosity >= G4VisManager::errors) {
189 G4warn <<
190 "ERROR: G4VisCommandsTouchableSet::SetNewValue: no current viewer."
191 << G4endl;
192 }
193 return;
194 }
195
196 G4ViewParameters workingVP = currentViewer->GetViewParameters();
197 G4VisAttributes workingVisAtts;
198
199 if (command == fpCommandSetColour)
200 {
201 G4String redOrString;
202 G4double green, blue, opacity;
203 std::istringstream iss(newValue);
204 iss >> redOrString >> green >> blue >> opacity;
205 G4Colour colour(1,1,1,1); // Default white and opaque.
206 ConvertToColour(colour, redOrString, green, blue, opacity);
207 workingVisAtts.SetColour(colour);
210 (workingVisAtts,
213 }
214
215 else if (command == fpCommandSetDaughtersInvisible) {
216 workingVisAtts.SetDaughtersInvisible(G4UIcommand::ConvertToBool(newValue));
219 (workingVisAtts,
222 }
223
224 else if (command == fpCommandSetForceAuxEdgeVisible) {
225 workingVisAtts.SetForceAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue));
228 (workingVisAtts,
231 }
232
233 else if (command == fpCommandSetLineSegmentsPerCircle) {
234 workingVisAtts.SetForceLineSegmentsPerCircle
235 (G4UIcommand::ConvertToInt(newValue));
238 (workingVisAtts,
241 }
242
243 else if (command == fpCommandSetForceCloud) {
244 workingVisAtts.SetForceCloud(G4UIcommand::ConvertToBool(newValue));
247 (workingVisAtts,
250 }
251
252 else if (command == fpCommandSetForceSolid) {
253 workingVisAtts.SetForceSolid(G4UIcommand::ConvertToBool(newValue));
256 (workingVisAtts,
259 }
260
261 else if (command == fpCommandSetForceWireframe) {
262 workingVisAtts.SetForceWireframe(G4UIcommand::ConvertToBool(newValue));
265 (workingVisAtts,
268 }
269
270 else if (command == fpCommandSetLineStyle) {
272 if (newValue == "dashed") {
273 lineStyle = G4VisAttributes::dashed;
274 } else if (newValue == "dotted") {
275 lineStyle = G4VisAttributes::dotted;
276 }
277 // All other values are "unbroken".
278 workingVisAtts.SetLineStyle(lineStyle);
281 (workingVisAtts,
284 }
285
286 else if (command == fpCommandSetLineWidth) {
287 workingVisAtts.SetLineWidth(G4UIcommand::ConvertToDouble(newValue));
290 (workingVisAtts,
293 }
294
295 else if (command == fpCommandSetNumberOfCloudPoints) {
296 workingVisAtts.SetForceNumberOfCloudPoints
297 (G4UIcommand::ConvertToInt(newValue));
300 (workingVisAtts,
303 }
304
305 else if (command == fpCommandSetVisibility) {
306 workingVisAtts.SetVisibility(G4UIcommand::ConvertToBool(newValue));
309 (workingVisAtts,
312 if (verbosity >= G4VisManager::warnings) {
313 static G4bool first = true;
314 if (first) {
315 first = false;
316 G4warn << "WARNING: If \"/vis/touchable/set/visibility\" does not appear to"
317 "\n work, check that opacity (4th component of colour) is non-zero." << G4endl;
318 G4warn << "ALSO: The volume must be in a requested physical volume tree,"
319 "\n not in the \"base path\". E.g., if"
320 "\n /vis/drawVolume volume-name"
321 "\n there is no way to make a parent of volume-name visible except by"
322 "\n explicitly adding the parent:"
323 "\n /vis/scene/add/volume parent-name" << G4endl;
324 }
325 }
326 }
327
328 else {
329 if (verbosity >= G4VisManager::errors) {
330 G4warn <<
331 "ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command."
332 << G4endl;
333 }
334 return;
335 }
336
337 SetViewParameters(currentViewer,workingVP);
338
339 // To update all views
340 G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
341}
#define G4warn
Definition G4Scene.cc:41
double G4double
Definition G4Types.hh:83
#define G4endl
Definition G4ios.hh:67
static G4int ConvertToInt(const char *st)
static G4bool ConvertToBool(const char *st)
static G4double ConvertToDouble(const char *st)
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
const G4ViewParameters & GetViewParameters() const
void ConvertToColour(G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
static G4VisManager * fpVisManager
void SetViewParameters(G4VViewer *viewer, const G4ViewParameters &viewParams)
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
void SetColour(const G4Colour &)
void SetVisibility(G4bool=true)
void SetForceAuxEdgeVisible(G4bool=true)
void SetForceCloud(G4bool=true)
void SetForceWireframe(G4bool=true)
void SetLineWidth(G4double)
void SetForceSolid(G4bool=true)
void SetLineStyle(LineStyle)
void SetForceLineSegmentsPerCircle(G4int nSegments)
void SetDaughtersInvisible(G4bool=true)
void SetForceNumberOfCloudPoints(G4int nPoints)
G4VViewer * GetCurrentViewer() const
static Verbosity GetVerbosity()
G4ModelingParameters::PVNameCopyNoPath fTouchablePath

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