Geant4 10.7.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 G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
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="")
 
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 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 DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (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 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 = 0
 
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
 

Detailed Description

Definition at line 41 of file G4VisCommandsTouchableSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandsTouchableSet()

G4VisCommandsTouchableSet::G4VisCommandsTouchableSet ( )

Definition at line 43 of file G4VisCommandsTouchableSet.cc.

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

◆ ~G4VisCommandsTouchableSet()

G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet ( )
virtual

Definition at line 161 of file G4VisCommandsTouchableSet.cc.

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

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandsTouchableSet::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 175 of file G4VisCommandsTouchableSet.cc.

175 {
176 return "";
177}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 179 of file G4VisCommandsTouchableSet.cc.

181{
183
184 G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
185 if (!currentViewer) {
186 if (verbosity >= G4VisManager::errors) {
187 G4cerr <<
188 "ERROR: G4VisCommandsTouchableSet::SetNewValue: no current viewer."
189 << G4endl;
190 }
191 return;
192 }
193
194 G4ViewParameters workingVP = currentViewer->GetViewParameters();
195 G4VisAttributes workingVisAtts;
196
197 if (command == fpCommandSetColour)
198 {
199 G4String redOrString;
200 G4double green, blue, opacity;
201 std::istringstream iss(newValue);
202 iss >> redOrString >> green >> blue >> opacity;
203 G4Colour colour(1,1,1,1); // Default white and opaque.
204 ConvertToColour(colour, redOrString, green, blue, opacity);
205 workingVisAtts.SetColour(colour);
208 (workingVisAtts,
211 }
212
213 else if (command == fpCommandSetDaughtersInvisible) {
214 workingVisAtts.SetDaughtersInvisible(G4UIcommand::ConvertToBool(newValue));
217 (workingVisAtts,
220 }
221
222 else if (command == fpCommandSetForceAuxEdgeVisible) {
223 workingVisAtts.SetForceAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue));
226 (workingVisAtts,
229 }
230
231 else if (command == fpCommandSetLineSegmentsPerCircle) {
232 workingVisAtts.SetForceLineSegmentsPerCircle
233 (G4UIcommand::ConvertToInt(newValue));
236 (workingVisAtts,
239 }
240
241 else if (command == fpCommandSetForceCloud) {
242 workingVisAtts.SetForceCloud(G4UIcommand::ConvertToBool(newValue));
245 (workingVisAtts,
248 }
249
250 else if (command == fpCommandSetForceSolid) {
251 workingVisAtts.SetForceSolid(G4UIcommand::ConvertToBool(newValue));
254 (workingVisAtts,
257 }
258
259 else if (command == fpCommandSetForceWireframe) {
260 workingVisAtts.SetForceWireframe(G4UIcommand::ConvertToBool(newValue));
263 (workingVisAtts,
266 }
267
268 else if (command == fpCommandSetLineStyle) {
270 if (newValue == "dashed") {
271 lineStyle = G4VisAttributes::dashed;
272 } else if (newValue == "dotted") {
273 lineStyle = G4VisAttributes::dotted;
274 }
275 // All other values are "unbroken".
276 workingVisAtts.SetLineStyle(lineStyle);
279 (workingVisAtts,
282 }
283
284 else if (command == fpCommandSetLineWidth) {
285 workingVisAtts.SetLineWidth(G4UIcommand::ConvertToDouble(newValue));
288 (workingVisAtts,
291 }
292
293 else if (command == fpCommandSetNumberOfCloudPoints) {
294 workingVisAtts.SetForceNumberOfCloudPoints
295 (G4UIcommand::ConvertToInt(newValue));
298 (workingVisAtts,
301 }
302
303 else if (command == fpCommandSetVisibility) {
304 workingVisAtts.SetVisibility(G4UIcommand::ConvertToBool(newValue));
307 (workingVisAtts,
310 }
311
312 else {
313 if (verbosity >= G4VisManager::errors) {
314 G4cerr <<
315 "ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command."
316 << G4endl;
317 }
318 return;
319 }
320
321 SetViewParameters(currentViewer,workingVP);
322
323 // To update all views
324 G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
325}
double G4double
Definition: G4Types.hh:83
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:543
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:530
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:561
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
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: