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

#include <G4VisCommandsViewerSet.hh>

Inheritance diagram for G4VisCommandsViewerSet:

Public Member Functions

 G4VisCommandsViewerSet ()
virtual ~G4VisCommandsViewerSet ()
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, const 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 (const 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 46 of file G4VisCommandsViewerSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandsViewerSet()

G4VisCommandsViewerSet::G4VisCommandsViewerSet ( )

Definition at line 50 of file G4VisCommandsViewerSet.cc.

50 :
51fLightsVector (G4ThreeVector(1.,1.,1.)),
52fUpVector (G4ThreeVector(0.,1.,0.)),
53fViewpointVector (G4ThreeVector(0.,0.,1.))
54{
55 G4bool omitable;
56 G4UIparameter* parameter;
57
58 fpCommandAll = new G4UIcmdWithAString ("/vis/viewer/set/all",this);
59 fpCommandAll->SetGuidance
60 ("Copies view parameters.");
61 fpCommandAll->SetGuidance
62 ("Copies ALL view parameters (except the autoRefresh status) from"
63 "\nfrom-viewer to current viewer. You may need \"/vis/viewer/rebuild\".");
64 fpCommandAll->SetGuidance
65 ("Note: to copy only the camera-specific parameters use"
66 "\n\"/vis/viewer/copyfrom\".");
67 fpCommandAll->SetParameterName ("from-viewer-name",omitable = false);
68
69 fpCommandAutoRefresh = new G4UIcmdWithABool
70 ("/vis/viewer/set/autoRefresh",this);
71 fpCommandAutoRefresh->SetGuidance("Sets auto-refresh.");
72 fpCommandAutoRefresh->SetGuidance
73 ("If true, view is automatically refreshed after a change of"
74 "\nview parameters.");
75 fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true);
76 fpCommandAutoRefresh->SetDefaultValue(true);
77
78 fpCommandAuxEdge = new G4UIcmdWithABool
79 ("/vis/viewer/set/auxiliaryEdge",this);
80 fpCommandAuxEdge->SetGuidance("Sets visibility of auxiliary edges");
81 fpCommandAuxEdge->SetGuidance
82 ("Auxiliary edges, i.e., those that are part of a curved surface,"
83 "\nsometimes called soft edges, become visible/invisible.");
84 fpCommandAuxEdge->SetParameterName("edge",omitable = true);
85 fpCommandAuxEdge->SetDefaultValue(true);
86
87 fpCommandBackground = new G4UIcommand
88 ("/vis/viewer/set/background",this);
89 fpCommandBackground->SetGuidance
90 ("Set background colour and transparency (default black and opaque).");
91 fpCommandBackground->SetGuidance(ConvertToColourGuidance());
92 parameter = new G4UIparameter("red_or_string", 's', omitable = true);
93 parameter -> SetDefaultValue ("0.");
94 fpCommandBackground -> SetParameter (parameter);
95 parameter = new G4UIparameter("green", 'd', omitable = true);
96 parameter -> SetDefaultValue (0.);
97 fpCommandBackground -> SetParameter (parameter);
98 parameter = new G4UIparameter ("blue", 'd', omitable = true);
99 parameter -> SetDefaultValue (0.);
100 fpCommandBackground -> SetParameter (parameter);
101 parameter = new G4UIparameter ("opacity", 'd', omitable = true);
102 parameter -> SetDefaultValue (1.);
103 fpCommandBackground -> SetParameter (parameter);
104
105 fpCommandCulling = new G4UIcommand("/vis/viewer/set/culling",this);
106 fpCommandCulling->SetGuidance ("Set culling options.");
107 fpCommandCulling->SetGuidance
108 ("\"global\": enables/disables all other culling options.");
109 fpCommandCulling->SetGuidance
110 ("\"coveredDaughters\": culls, i.e., eliminates, volumes that would not"
111 "\nbe seen because covered by ancestor volumes in surface drawing mode,"
112 "\nand then only if the ancestors are visible and opaque, and then only"
113 "\nif no sections or cutaways are in operation. Intended solely to"
114 "\nimprove the speed of rendering visible volumes.");
115 fpCommandCulling->SetGuidance
116 ("\"invisible\": culls objects with the invisible attribute set.");
117 fpCommandCulling->SetGuidance
118 ("\"density\": culls volumes with density lower than threshold. Useful"
119 "\nfor eliminating \"container volumes\" with no physical correspondence,"
120 "\nwhose material is usually air. If this is selected, provide threshold"
121 "\ndensity and unit (e.g., g/cm3, mg/cm3 or kg/m3)."
122 );
123 parameter = new G4UIparameter("culling-option",'s',omitable = false);
124 parameter->SetParameterCandidates
125 ("global coveredDaughters invisible density");
126 fpCommandCulling->SetParameter(parameter);
127 parameter = new G4UIparameter("action",'b',omitable = true);
128 parameter->SetDefaultValue(1);
129 fpCommandCulling->SetParameter(parameter);
130 parameter = new G4UIparameter("density-threshold",'d',omitable = true);
131 parameter->SetDefaultValue("0.01");
132 fpCommandCulling->SetParameter(parameter);
133 parameter = new G4UIparameter("unit",'s',omitable = true);
134 // parameter->SetParameterCandidates ("g/cm3 mg/cm3 kg/m3");
135 // Instead of the above, SetNewValue accepts *any* density unit.
136 parameter->SetDefaultValue("g/cm3");
137 fpCommandCulling->SetParameter(parameter);
138
139 fpCommandCutawayMode =
140 new G4UIcmdWithAString ("/vis/viewer/set/cutawayMode", this);
141 fpCommandCutawayMode->SetGuidance
142 ("Sets cutaway mode - add (union) or multiply (intersection).");
143 fpCommandCutawayMode->SetParameterName ("cutaway-mode",omitable = false);
144 fpCommandCutawayMode->SetCandidates ("add union multiply intersection");
145 fpCommandCutawayMode->SetDefaultValue("union");
146
147 fpCommandDefaultColour = new G4UIcommand
148 ("/vis/viewer/set/defaultColour",this);
149 fpCommandDefaultColour->SetGuidance
150 ("Set defaultColour colour and transparency (default white and opaque).");
151 fpCommandDefaultColour->SetGuidance(ConvertToColourGuidance());
152 parameter = new G4UIparameter("red_or_string", 's', omitable = true);
153 parameter -> SetDefaultValue ("1.");
154 fpCommandDefaultColour -> SetParameter (parameter);
155 parameter = new G4UIparameter("green", 'd', omitable = true);
156 parameter -> SetDefaultValue (1.);
157 fpCommandDefaultColour -> SetParameter (parameter);
158 parameter = new G4UIparameter ("blue", 'd', omitable = true);
159 parameter -> SetDefaultValue (1.);
160 fpCommandDefaultColour -> SetParameter (parameter);
161 parameter = new G4UIparameter ("opacity", 'd', omitable = true);
162 parameter -> SetDefaultValue (1.);
163 fpCommandDefaultColour -> SetParameter (parameter);
164
165 fpCommandDefaultTextColour = new G4UIcommand
166 ("/vis/viewer/set/defaultTextColour",this);
167 fpCommandDefaultTextColour->SetGuidance
168 ("Set defaultTextColour colour and transparency (default blue and opaque).");
169 fpCommandDefaultTextColour->SetGuidance(ConvertToColourGuidance());
170 parameter = new G4UIparameter("red_or_string", 's', omitable = true);
171 parameter -> SetDefaultValue ("0.");
172 fpCommandDefaultTextColour -> SetParameter (parameter);
173 parameter = new G4UIparameter("green", 'd', omitable = true);
174 parameter -> SetDefaultValue (0.);
175 fpCommandDefaultTextColour -> SetParameter (parameter);
176 parameter = new G4UIparameter ("blue", 'd', omitable = true);
177 parameter -> SetDefaultValue (1.);
178 fpCommandDefaultTextColour -> SetParameter (parameter);
179 parameter = new G4UIparameter ("opacity", 'd', omitable = true);
180 parameter -> SetDefaultValue (1.);
181 fpCommandDefaultTextColour -> SetParameter (parameter);
182
183 fpCommandDotsSize = new G4UIcmdWithADouble("/vis/viewer/set/dotsSize", this);
184 fpCommandDotsSize->SetGuidance("Set dots size.");
185 fpCommandDotsSize->SetParameterName("dots-size", omitable=true);
186 fpCommandDotsSize->SetDefaultValue(1.);
187
188 fpCommandDotsSmooth = new G4UIcmdWithABool("/vis/viewer/set/dotsSmooth", this);
189 fpCommandDotsSmooth->SetGuidance("True/false to enable/disable smooth dots (if available).");
190 fpCommandDotsSmooth->SetGuidance
191 ("\"Smooth\" typically means rounded, i.e., dots drawn as filled circles."
192 "\nThe vis system is configured by default to draw smooth dots. This may"
193 "\nbe switched off with \"/vis/viewer/set/dotsSmooth false\" - typically"
194 "\nthis will result in square dots.");
195 fpCommandDotsSmooth->SetParameterName("dots-smooth-enabled", omitable = true);
196 fpCommandDotsSmooth->SetDefaultValue(true);
197
198 fpCommandEdge = new G4UIcmdWithABool("/vis/viewer/set/edge",this);
199 fpCommandEdge->SetGuidance
200 ("Edges become visible/invisible in surface mode.");
201 fpCommandEdge->SetParameterName("edge",omitable = true);
202 fpCommandEdge->SetDefaultValue(true);
203
204 fpCommandExplodeFactor = new G4UIcommand
205 ("/vis/viewer/set/explodeFactor", this);
206 fpCommandExplodeFactor->SetGuidance
207 ("Moves top-level drawn volumes by this factor from this centre.");
208 parameter = new G4UIparameter("explodeFactor", 'd', omitable=true);
209 parameter->SetParameterRange("explodeFactor>=1.");
210 parameter->SetDefaultValue(1.);
211 fpCommandExplodeFactor->SetParameter(parameter);
212 parameter = new G4UIparameter("x",'d',omitable = true);
213 parameter->SetDefaultValue (0);
214 parameter->SetGuidance ("Coordinate of explode centre.");
215 fpCommandExplodeFactor->SetParameter(parameter);
216 parameter = new G4UIparameter("y",'d',omitable = true);
217 parameter->SetDefaultValue (0);
218 parameter->SetGuidance ("Coordinate of explode centre.");
219 fpCommandExplodeFactor->SetParameter(parameter);
220 parameter = new G4UIparameter("z",'d',omitable = true);
221 parameter->SetDefaultValue (0);
222 parameter->SetGuidance ("Coordinate of explode centre.");
223 fpCommandExplodeFactor->SetParameter(parameter);
224 parameter = new G4UIparameter("unit",'s',omitable = true);
225 parameter->SetDefaultValue ("m");
226 parameter->SetGuidance ("Unit of explode centre.");
227 fpCommandExplodeFactor->SetParameter(parameter);
228
229 fpCommandGlobalLineWidthScale = new G4UIcmdWithADouble
230 ("/vis/viewer/set/globalLineWidthScale", this);
231 fpCommandGlobalLineWidthScale->SetGuidance
232 ("Multiplies line widths by this factor.");
233 fpCommandGlobalLineWidthScale->
234 SetParameterName("scale-factor", omitable=true);
235 fpCommandGlobalLineWidthScale->SetDefaultValue(1.);
236
237 fpCommandGlobalMarkerScale = new G4UIcmdWithADouble
238 ("/vis/viewer/set/globalMarkerScale", this);
239 fpCommandGlobalMarkerScale->SetGuidance
240 ("Multiplies marker sizes by this factor.");
241 fpCommandGlobalMarkerScale->
242 SetParameterName("scale-factor", omitable=true);
243 fpCommandGlobalMarkerScale->SetDefaultValue(1.);
244
245 fpCommandHiddenEdge =
246 new G4UIcmdWithABool("/vis/viewer/set/hiddenEdge",this);
247 fpCommandHiddenEdge->SetGuidance
248 ("Edges become hidden/seen in wireframe or surface mode.");
249 fpCommandHiddenEdge->SetParameterName("hidden-edge",omitable = true);
250 fpCommandHiddenEdge->SetDefaultValue(true);
251
252 fpCommandHiddenMarker =
253 new G4UIcmdWithABool("/vis/viewer/set/hiddenMarker",this);
254 fpCommandHiddenMarker->SetGuidance
255 ("If true, closer objects hide markers. Otherwise, markers always show.");
256 fpCommandHiddenMarker->SetParameterName("hidden-marker",omitable = true);
257 fpCommandHiddenMarker->SetDefaultValue(true);
258
259 fpCommandLightsMove = new G4UIcmdWithAString
260 ("/vis/viewer/set/lightsMove",this);
261 fpCommandLightsMove->SetGuidance
262 ("Lights move with camera or with object");
263 fpCommandLightsMove->SetParameterName("lightsMove",omitable = false);
264 fpCommandLightsMove->SetCandidates
265 ("cam camera with-camera obj object with-object");
266
267 fpCommandLightsThetaPhi = new G4UIcommand
268 ("/vis/viewer/set/lightsThetaPhi", this);
269 fpCommandLightsThetaPhi->SetGuidance
270 ("Set direction from target to lights.");
271 parameter = new G4UIparameter("theta", 'd', omitable = true);
272 parameter -> SetDefaultValue(60.);
273 fpCommandLightsThetaPhi -> SetParameter (parameter);
274 parameter = new G4UIparameter("phi", 'd', omitable = true);
275 parameter -> SetDefaultValue(45.);
276 fpCommandLightsThetaPhi -> SetParameter (parameter);
277 parameter = new G4UIparameter ("unit", 's', omitable = true);
278 parameter -> SetDefaultValue ("deg");
279 fpCommandLightsThetaPhi -> SetParameter (parameter);
280
281 fpCommandLightsVector = new G4UIcommand
282 ("/vis/viewer/set/lightsVector", this);
283 fpCommandLightsVector->SetGuidance
284 ("Set direction from target to lights.");
285 parameter = new G4UIparameter("x", 'd', omitable = true);
286 parameter -> SetDefaultValue (1);
287 fpCommandLightsVector -> SetParameter (parameter);
288 parameter = new G4UIparameter("y", 'd', omitable = true);
289 parameter -> SetDefaultValue (1);
290 fpCommandLightsVector -> SetParameter (parameter);
291 parameter = new G4UIparameter ("z", 'd', omitable = true);
292 parameter -> SetDefaultValue (1);
293 fpCommandLightsVector -> SetParameter (parameter);
294
295 fpCommandLineSegments = new G4UIcmdWithAnInteger
296 ("/vis/viewer/set/lineSegmentsPerCircle",this);
297 fpCommandLineSegments->SetGuidance
298 ("Set number of sides per circle for polygon/polyhedron drawing.");
299 fpCommandLineSegments->SetGuidance
300 ("Refers to graphical representation of objects with curved lines/surfaces.");
301 fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
302 fpCommandLineSegments->SetDefaultValue(24);
303
304 fpCommandLineWidth = new G4UIcmdWithoutParameter
305 ("/vis/viewer/set/lineWidth",this);
306 fpCommandLineWidth->SetGuidance
307 ("Use \"/vis/viewer/set/globalLineWidthScale\" instead."
308 "\nFor trajectories use \"/vis/modeling/trajectories/*/default/setLineWidth\"."
309 "\nFor volumes use \"/vis/geometry/set/lineWidth\".");
310
311 fpCommandNumberOfCloudPoints = new G4UIcmdWithAnInteger
312 ("/vis/viewer/set/numberOfCloudPoints",this);
313 fpCommandNumberOfCloudPoints->SetGuidance
314 ("Set number of points to be used for cloud representation of volumes.");
315 fpCommandNumberOfCloudPoints->SetParameterName("points",omitable = true);
316 fpCommandNumberOfCloudPoints->SetDefaultValue(10000);
317
318 fpCommandPicking = new G4UIcmdWithABool
319 ("/vis/viewer/set/picking",this);
320 fpCommandPicking->SetGuidance("Sets picking, if available.");
321 fpCommandPicking->SetGuidance
322 ("If true, view is set up for picking, if available.");
323 fpCommandPicking->SetGuidance
324 ("You may need to issue \"/vis/viewer/update\".");
325 fpCommandPicking->SetGuidance
326 ("For required actions, watch for instructions for viewer.");
327 fpCommandPicking->SetParameterName("picking",omitable = true);
328 fpCommandPicking->SetDefaultValue(true);
329
330 fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this);
331 fpCommandProjection->SetGuidance
332 ("Set projection style - o[rthogonal] or p[erspective]."
333 "\nIf p[erspective], also set field half angle.");
334 parameter = new G4UIparameter("projection",'s',omitable = true);
335 parameter->SetParameterCandidates("o orthogonal p perspective");
336 parameter->SetDefaultValue("orthogonal");
337 fpCommandProjection->SetParameter(parameter);
338 parameter = new G4UIparameter("field-half-angle",'d',omitable = true);
339 parameter->SetDefaultValue(30.);
340 //parameter->SetCurrentAsDefault(true);
341 fpCommandProjection->SetParameter(parameter);
342 parameter = new G4UIparameter("unit",'s',omitable = true);
343 parameter->SetDefaultValue("deg");
344 //parameter->SetCurrentAsDefault(true);
345 fpCommandProjection->SetParameter(parameter);
346
347 fpCommandRotationStyle = new G4UIcmdWithAString
348 ("/vis/viewer/set/rotationStyle",this);
349 fpCommandRotationStyle->SetGuidance
350 ("Set style of rotation - constrainUpDirection or freeRotation.");
351 fpCommandRotationStyle->SetGuidance
352 ("constrainUpDirection: conventional HEP view.");
353 fpCommandRotationStyle->SetGuidance
354 ("freeRotation: Google-like rotation, using mouse-grab.");
355 fpCommandRotationStyle->SetParameterName ("style",omitable = false);
356 fpCommandRotationStyle->SetCandidates("constrainUpDirection freeRotation");
357
358 fpCommandSectionPlane = new G4UIcommand("/vis/viewer/set/sectionPlane",this);
359 fpCommandSectionPlane -> SetGuidance
360 ("Set plane for drawing section (DCUT).");
361 fpCommandSectionPlane -> SetGuidance
362 ("E.g., for a y-z plane at x = 1 cm:"
363 "\n\"/vis/viewer/set/sectionPlane on 1 0 0 cm 1 0 0\"."
364 "\nTo turn off: /vis/viewer/set/sectionPlane off");
365 parameter = new G4UIparameter("Selector",'c',true);
366 parameter -> SetDefaultValue ("on");
367 fpCommandSectionPlane->SetParameter(parameter);
368 parameter = new G4UIparameter("x",'d',omitable = true);
369 parameter -> SetDefaultValue (0);
370 parameter -> SetGuidance ("Coordinate of point on the plane.");
371 fpCommandSectionPlane->SetParameter(parameter);
372 parameter = new G4UIparameter("y",'d',omitable = true);
373 parameter -> SetDefaultValue (0);
374 parameter -> SetGuidance ("Coordinate of point on the plane.");
375 fpCommandSectionPlane->SetParameter(parameter);
376 parameter = new G4UIparameter("z",'d',omitable = true);
377 parameter -> SetDefaultValue (0);
378 parameter -> SetGuidance ("Coordinate of point on the plane.");
379 fpCommandSectionPlane->SetParameter(parameter);
380 parameter = new G4UIparameter("unit",'s',omitable = true);
381 parameter -> SetDefaultValue ("m");
382 parameter -> SetGuidance ("Unit of point on the plane.");
383 fpCommandSectionPlane->SetParameter(parameter);
384 parameter = new G4UIparameter("nx",'d',omitable = true);
385 parameter -> SetDefaultValue (1);
386 parameter -> SetGuidance ("Component of plane normal.");
387 fpCommandSectionPlane->SetParameter(parameter);
388 parameter = new G4UIparameter("ny",'d',omitable = true);
389 parameter -> SetDefaultValue (0);
390 parameter -> SetGuidance ("Component of plane normal.");
391 fpCommandSectionPlane->SetParameter(parameter);
392 parameter = new G4UIparameter("nz",'d',omitable = true);
393 parameter -> SetDefaultValue (0);
394 parameter -> SetGuidance ("Component of plane normal.");
395 fpCommandSectionPlane->SetParameter(parameter);
396
397 fpCommandSpecialMeshRendering = new G4UIcmdWithABool
398 ("/vis/viewer/set/specialMeshRendering",this);
399 fpCommandSpecialMeshRendering -> SetGuidance
400 ("Request special rendering of volumes (meshes) that use G4VParameterisation.");
401 fpCommandSpecialMeshRendering->SetParameterName("render",omitable = true);
402 fpCommandSpecialMeshRendering->SetDefaultValue(true);
403
404 fpCommandSpecialMeshRenderingOption = new G4UIcmdWithAString
405 ("/vis/viewer/set/specialMeshRenderingOption",this);
406 fpCommandSpecialMeshRenderingOption->SetGuidance
407 ("Set special mesh rendering option - \"default\", \"dots\" or \"surfaces\".");
408 fpCommandSpecialMeshRenderingOption->SetParameterName ("option",omitable = true);
409 fpCommandSpecialMeshRenderingOption->SetCandidates("default dots surfaces");
410 fpCommandSpecialMeshRenderingOption->SetDefaultValue("default");
411
412 fpCommandSpecialMeshVolumes = new G4UIcommand
413 ("/vis/viewer/set/specialMeshVolumes",this);
414 fpCommandSpecialMeshVolumes -> SetGuidance
415 ("Specify the volumes for special rendering. No arguments resets the list"
416 "\nand is interpreted to mean \"all found meshes\".");
417 fpCommandSpecialMeshVolumes->SetGuidance
418 ("Please provide a list of space-separated physical volume names and copy"
419 "\nnumber pairs. Negative copy number means \"all volumes of that name\".");
420 parameter = new G4UIparameter("volumes",'s',omitable = true);
421 parameter->SetGuidance
422 ("List of physical volume names and copy number pairs");
423 fpCommandSpecialMeshVolumes->SetParameter(parameter);
424
425 fpCommandStyle = new G4UIcmdWithAString ("/vis/viewer/set/style",this);
426 fpCommandStyle->SetGuidance
427 ("Set style of drawing - w[ireframe] or s[urface] or c[loud].");
428 fpCommandStyle->SetGuidance
429 ("(Hidden line drawing is controlled by \"/vis/viewer/set/hiddenEdge\".)");
430 fpCommandStyle->SetParameterName ("style",omitable = false);
431 fpCommandStyle->SetCandidates("w wireframe s surface c cloud");
432
433 fpCommandTargetPoint = new G4UIcmdWith3VectorAndUnit
434 ("/vis/viewer/set/targetPoint", this);
435 fpCommandTargetPoint->SetGuidance
436 ("Set target point.");
437 fpCommandTargetPoint->SetGuidance
438 ("This sets the \"Current Target Point\" relative to the \"Standard");
439 fpCommandTargetPoint->SetGuidance
440 ("Target Point\" so that the actual target point is as requested.");
441 fpCommandTargetPoint->SetGuidance
442 ("(See G4ViewParameters.hh for an explanation of target points.)");
443 fpCommandTargetPoint->SetParameterName("x", "y", "z", omitable = false);
444 fpCommandTargetPoint->SetUnitCategory("Length");
445
446 fpCommandTransparencyByDepth = new G4UIcommand
447 ("/vis/viewer/set/transparencyByDepth", this);
448 fpCommandTransparencyByDepth -> SetGuidance
449 ("Set overall transparency by depth in geometry tree.");
450 fpCommandTransparencyByDepth -> SetGuidance
451 ("For a volume at depth D, the opacity (alpha) is:"
452 "\nOption 1: Unwrap: 0 if D <= d (sudden invisibility);"
453 "\nOption 2: Fade: D - d (fade progresssively layer by layer);"
454 "\nOption 3: X-ray: as (2), but fade over whole range of depth."
455 "\nThe opacity calculated here is truncated [0,1] and then"
456 " multiplies any existing opacity."
457 "\nSee G4PhysicalVolumeModel.cc:644(approx) for details.");
458 parameter = new G4UIparameter("d", 'd', omitable = false);
459 fpCommandTransparencyByDepth -> SetParameter (parameter);
460 parameter = new G4UIparameter("option", 'i', omitable = true);
461 parameter -> SetGuidance("1: Unwrap; 2: Fade; 3: X-ray");
462 parameter -> SetDefaultValue (1);
463 fpCommandTransparencyByDepth -> SetParameter (parameter);
464
465 fpCommandUpThetaPhi = new G4UIcommand
466 ("/vis/viewer/set/upThetaPhi", this);
467 fpCommandUpThetaPhi -> SetGuidance ("Set up vector.");
468 fpCommandUpThetaPhi -> SetGuidance
469 ("Viewer will attempt always to show this direction upwards.");
470 parameter = new G4UIparameter("theta", 'd', omitable = true);
471 parameter -> SetDefaultValue (90.);
472 fpCommandUpThetaPhi -> SetParameter (parameter);
473 parameter = new G4UIparameter("phi", 'd', omitable = true);
474 parameter -> SetDefaultValue (90.);
475 fpCommandUpThetaPhi -> SetParameter (parameter);
476 parameter = new G4UIparameter ("unit", 's', omitable = true);
477 parameter -> SetDefaultValue ("deg");
478 fpCommandUpThetaPhi -> SetParameter (parameter);
479
480 fpCommandUpVector = new G4UIcommand
481 ("/vis/viewer/set/upVector", this);
482 fpCommandUpVector -> SetGuidance ("Set up vector.");
483 fpCommandUpVector -> SetGuidance
484 ("Viewer will attempt always to show this direction upwards.");
485 parameter = new G4UIparameter("x", 'd', omitable = true);
486 parameter -> SetDefaultValue (0.);
487 fpCommandUpVector -> SetParameter (parameter);
488 parameter = new G4UIparameter("y", 'd', omitable = true);
489 parameter -> SetDefaultValue (1.);
490 fpCommandUpVector -> SetParameter (parameter);
491 parameter = new G4UIparameter ("z", 'd', omitable = true);
492 parameter -> SetDefaultValue (0.);
493 fpCommandUpVector -> SetParameter (parameter);
494
495 fpCommandViewpointThetaPhi = new G4UIcommand
496 ("/vis/viewer/set/viewpointThetaPhi", this);
497 fpCommandViewpointThetaPhi -> SetGuidance
498 ("Set direction from target to camera.");
499 fpCommandViewpointThetaPhi -> SetGuidance
500 ("Also changes lightpoint direction if lights are set to move with camera.");
501 parameter = new G4UIparameter("theta", 'd', omitable = true);
502 parameter -> SetDefaultValue (60.);
503 fpCommandViewpointThetaPhi -> SetParameter (parameter);
504 parameter = new G4UIparameter("phi", 'd', omitable = true);
505 parameter -> SetDefaultValue (45.);
506 fpCommandViewpointThetaPhi -> SetParameter (parameter);
507 parameter = new G4UIparameter ("unit", 's', omitable = true);
508 parameter -> SetDefaultValue ("deg");
509 fpCommandViewpointThetaPhi -> SetParameter (parameter);
510
511 fpCommandViewpointVector = new G4UIcommand
512 ("/vis/viewer/set/viewpointVector", this);
513 fpCommandViewpointVector -> SetGuidance
514 ("Set direction from target to camera.");
515 fpCommandViewpointVector -> SetGuidance
516 ("Also changes lightpoint direction if lights are set to move with camera.");
517 parameter = new G4UIparameter("x", 'd', omitable = true);
518 parameter -> SetDefaultValue (1.);
519 fpCommandViewpointVector -> SetParameter (parameter);
520 parameter = new G4UIparameter("y", 'd', omitable = true);
521 parameter -> SetDefaultValue (1.);
522 fpCommandViewpointVector -> SetParameter (parameter);
523 parameter = new G4UIparameter ("z", 'd', omitable = true);
524 parameter -> SetDefaultValue (1.);
525 fpCommandViewpointVector -> SetParameter (parameter);
526
527 fpTimeWindowDirectory = new G4UIdirectory ("/vis/viewer/set/timeWindow/");
528 fpTimeWindowDirectory -> SetGuidance ("Set time window parameters of current viewer.");
529 G4String timeWindowGuidance =
530 "For these commands use"
531 "\n /vis/scene/add/trajectories rich"
532 "\n /vis/modeling/trajectories/drawByCharge-0/default/setTimeSliceInterval 0.01 ns"
533 "\nthen typically"
534 "\n /vis/viewer/set/timeWindow/displayLightFront true 0 0 -50 cm -0.5 ns"
535 "\n /vis/viewer/set/timeWindow/displayHeadTime true"
536 "\n /vis/viewer/set/timeWindow/fadeFactor 1"
537 "\n /run/beamOn # or several until you get a good event or events"
538 "\n /vis/viewer/set/timeWindow/startTime 0 ns 1 ns"
539 "\n /vis/viewer/save"
540 "\n /vis/viewer/set/timeWindow/startTime 1 ns 1 ns"
541 "\nthen zoom, pan etc to a view of interest and"
542 "\n /vis/viewer/save"
543 "\nthen repeat with next start time, another view and a save, then try"
544 "\n /vis/viewer/interpolate";
545
546 fpCommandTimeWindowDisplayHeadTime =
547 new G4UIcommand("/vis/viewer/set/timeWindow/displayHeadTime", this);
548 fpCommandTimeWindowDisplayHeadTime->SetGuidance
549 ("Display head time of range in 2D text.");
550 fpCommandTimeWindowDisplayHeadTime->SetGuidance(timeWindowGuidance);
551 parameter = new G4UIparameter ("displayHeadTime", 'b', omitable = false);
552 parameter->SetDefaultValue(false);
553 fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
554 parameter = new G4UIparameter ("screenX", 'd', omitable = true);
555 parameter->SetGuidance("-1 < screenX < 1");
556 parameter->SetParameterRange("screenX >= -1. && screenX <= 1.");
557 parameter->SetCurrentAsDefault(true);
558 fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
559 parameter = new G4UIparameter ("screenY", 'd', omitable = true);
560 parameter->SetGuidance("-1 < screenY < 1");
561 parameter->SetParameterRange("screenY >= -1. && screenY <= 1.");
562 parameter->SetCurrentAsDefault(true);
563 fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
564 parameter = new G4UIparameter ("screenSize", 'd', omitable = true);
565 parameter->SetCurrentAsDefault(true);
566 fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
567 parameter = new G4UIparameter ("red", 'd', omitable = true);
568 parameter->SetParameterRange("red >= 0. && red <= 1.");
569 parameter->SetCurrentAsDefault(true);
570 fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
571 parameter = new G4UIparameter ("green", 'd', omitable = true);
572 parameter->SetParameterRange("green >= 0. && green <= 1.");
573 parameter->SetCurrentAsDefault(true);
574 fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
575 parameter = new G4UIparameter ("blue", 'd', omitable = true);
576 parameter->SetParameterRange("blue >= 0. && blue <= 1.");
577 parameter->SetCurrentAsDefault(true);
578 fpCommandTimeWindowDisplayHeadTime->SetParameter(parameter);
579
580 fpCommandTimeWindowDisplayLightFront =
581 new G4UIcommand("/vis/viewer/set/timeWindow/displayLightFront", this);
582 fpCommandTimeWindowDisplayLightFront->SetGuidance
583 ("Display the light front at head time.");
584 fpCommandTimeWindowDisplayLightFront->SetGuidance
585 ("Tip: The trajectories can appear of jump ahead of the light front"
586 "\nbecause their time range overlaps the viewer's time range. To"
587 "\naverage out this discrete time effect, advance the light front by"
588 "\nhalf the trajectories interval. E.g., if the trajectory time slice"
589 "\ninterval is 0.01 ns:"
590 "\n /vis/viewer/set/timeWindow/displayLightFront true -90 0 0 mm -0.005 ns"
591 "\nTo prevent them beating the light front at all:"
592 "\n /vis/viewer/set/timeWindow/displayLightFront true -90 0 0 mm -0.01 ns");
593 fpCommandTimeWindowDisplayLightFront->SetGuidance(timeWindowGuidance);
594 parameter = new G4UIparameter ("displayLightFront", 'b', omitable = true);
595 parameter->SetDefaultValue(true);
596 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
597 parameter = new G4UIparameter ("originX", 'd', omitable = true);
598 parameter->SetDefaultValue(0.);
599 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
600 parameter = new G4UIparameter ("originY", 'd', omitable = true);
601 parameter->SetDefaultValue(0.);
602 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
603 parameter = new G4UIparameter ("originZ", 'd', omitable = true);
604 parameter->SetDefaultValue(0.);
605 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
606 parameter = new G4UIparameter ("space_unit", 's', omitable = true);
607 parameter->SetDefaultValue("m");
608 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
609 parameter = new G4UIparameter ("originT", 'd', omitable = true);
610 parameter->SetDefaultValue(0.);
611 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
612 parameter = new G4UIparameter ("time_unit", 's', omitable = true);
613 parameter->SetDefaultValue("s");
614 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
615 parameter = new G4UIparameter ("red", 'd', omitable = true);
616 parameter->SetParameterRange("red >= 0. && red <= 1.");
617 parameter->SetDefaultValue(0.);
618 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
619 parameter = new G4UIparameter ("green", 'd', omitable = true);
620 parameter->SetParameterRange("green >= 0. && green <= 1.");
621 parameter->SetDefaultValue(1.);
622 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
623 parameter = new G4UIparameter ("blue", 'd', omitable = true);
624 parameter->SetParameterRange("blue >= 0. && blue <= 1.");
625 parameter->SetDefaultValue(0.);
626 fpCommandTimeWindowDisplayLightFront->SetParameter(parameter);
627
628 fpCommandTimeWindowEndTime =
629 new G4UIcommand("/vis/viewer/set/timeWindow/endTime", this);
630 fpCommandTimeWindowEndTime->SetGuidance("Set end and range of track time.");
631 fpCommandTimeWindowEndTime->SetGuidance(timeWindowGuidance);
632 parameter = new G4UIparameter ("end-time", 'd', omitable = false);
634 fpCommandTimeWindowEndTime->SetParameter(parameter);
635 parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
636 parameter->SetDefaultValue("ns");
637 fpCommandTimeWindowEndTime->SetParameter(parameter);
638 parameter = new G4UIparameter ("time-range", 'd', omitable = true);
639 parameter->SetDefaultValue(-1.);
640 fpCommandTimeWindowEndTime->SetParameter(parameter);
641 parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
642 parameter->SetDefaultValue("ns");
643 fpCommandTimeWindowEndTime->SetParameter(parameter);
644
645 fpCommandTimeWindowFadeFactor =
646 new G4UIcmdWithADouble("/vis/viewer/set/timeWindow/fadeFactor", this);
647 fpCommandTimeWindowFadeFactor->SetGuidance
648 ("0: no fade; 1: maximum fade with time window.");
649 fpCommandTimeWindowFadeFactor->SetGuidance(timeWindowGuidance);
650 fpCommandTimeWindowFadeFactor->SetParameterName("fade_factor", omitable = false);
651 fpCommandTimeWindowFadeFactor->SetRange("fade_factor>=0.&&fade_factor<=1.");
652 fpCommandTimeWindowFadeFactor->SetDefaultValue(0.);
653
654 fpCommandTimeWindowStartTime =
655 new G4UIcommand("/vis/viewer/set/timeWindow/startTime", this);
656 fpCommandTimeWindowStartTime->SetGuidance("Set start and range of track time.");
657 fpCommandTimeWindowStartTime->SetGuidance(timeWindowGuidance);
658 parameter = new G4UIparameter ("start-time", 'd', omitable = false);
660 fpCommandTimeWindowStartTime->SetParameter(parameter);
661 parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
662 parameter->SetDefaultValue("ns");
663 fpCommandTimeWindowStartTime->SetParameter(parameter);
664 parameter = new G4UIparameter ("time-range", 'd', omitable = true);
665 parameter->SetDefaultValue(-1.);
666 fpCommandTimeWindowStartTime->SetParameter(parameter);
667 parameter = new G4UIparameter ("time-range-unit", 's', omitable = true);
668 parameter->SetDefaultValue("ns");
669 fpCommandTimeWindowStartTime->SetParameter(parameter);
670
671 fpCommandZoomToCursor = new G4UIcmdWithABool("/vis/viewer/set/zoomToCursor", this);
672 fpCommandZoomToCursor->SetGuidance("True/false to enable/disable zoom to cursor with mouse wheel");
673 fpCommandZoomToCursor->SetParameterName("zoomToCursor-enabled", omitable = true);
674 fpCommandZoomToCursor->SetDefaultValue(true);
675}
CLHEP::Hep3Vector G4ThreeVector
bool G4bool
Definition G4Types.hh:86
void SetDefaultValue(const char *theDefaultValue)
void SetGuidance(const char *theGuidance)
void SetParameterRange(const char *theRange)
void SetParameterCandidates(const char *theString)
void SetCurrentAsDefault(G4bool val)
const G4String & ConvertToColourGuidance()
static constexpr G4double fVeryLongTime

◆ ~G4VisCommandsViewerSet()

G4VisCommandsViewerSet::~G4VisCommandsViewerSet ( )
virtual

Definition at line 677 of file G4VisCommandsViewerSet.cc.

677 {
678 delete fpCommandZoomToCursor;
679 delete fpCommandTimeWindowStartTime;
680 delete fpCommandTimeWindowFadeFactor;
681 delete fpCommandTimeWindowEndTime;
682 delete fpCommandTimeWindowDisplayLightFront;
683 delete fpCommandTimeWindowDisplayHeadTime;
684 delete fpTimeWindowDirectory;
685 delete fpCommandViewpointVector;
686 delete fpCommandViewpointThetaPhi;
687 delete fpCommandUpVector;
688 delete fpCommandUpThetaPhi;
689 delete fpCommandTransparencyByDepth;
690 delete fpCommandTargetPoint;
691 delete fpCommandStyle;
692 delete fpCommandSpecialMeshVolumes;
693 delete fpCommandSpecialMeshRenderingOption;
694 delete fpCommandSpecialMeshRendering;
695 delete fpCommandSectionPlane;
696 delete fpCommandRotationStyle;
697 delete fpCommandProjection;
698 delete fpCommandPicking;
699 delete fpCommandNumberOfCloudPoints;
700 delete fpCommandLineWidth;
701 delete fpCommandLineSegments;
702 delete fpCommandLightsVector;
703 delete fpCommandLightsThetaPhi;
704 delete fpCommandLightsMove;
705 delete fpCommandHiddenMarker;
706 delete fpCommandHiddenEdge;
707 delete fpCommandGlobalMarkerScale;
708 delete fpCommandGlobalLineWidthScale;
709 delete fpCommandDotsSmooth;
710 delete fpCommandDotsSize;
711 delete fpCommandExplodeFactor;
712 delete fpCommandEdge;
713 delete fpCommandDefaultTextColour;
714 delete fpCommandDefaultColour;
715 delete fpCommandCutawayMode;
716 delete fpCommandCulling;
717 delete fpCommandBackground;
718 delete fpCommandAuxEdge;
719 delete fpCommandAutoRefresh;
720 delete fpCommandAll;
721}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandsViewerSet::GetCurrentValue ( G4UIcommand * command)
virtual

Reimplemented from G4UImessenger.

Definition at line 723 of file G4VisCommandsViewerSet.cc.

723 {
724
725 G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
726 const auto& vp = currentViewer->GetViewParameters();
727
728 if (command == fpCommandTimeWindowDisplayHeadTime) {
729 const auto& tp = vp.GetTimeParameters();
730 return command->ConvertToString(tp.fDisplayHeadTime)
731 + ' ' + command->ConvertToString(tp.fDisplayHeadTimeX)
732 + ' ' + command->ConvertToString(tp.fDisplayHeadTimeY)
733 + ' ' + command->ConvertToString(tp.fDisplayHeadTimeSize)
734 + ' ' + command->ConvertToString(tp.fDisplayHeadTimeRed)
735 + ' ' + command->ConvertToString(tp.fDisplayHeadTimeGreen)
736 + ' ' + command->ConvertToString(tp.fDisplayHeadTimeBlue);
737 }
738
739 else {
740 return "";
741}
742}
static G4String ConvertToString(G4bool boolVal)
const G4ViewParameters & GetViewParameters() const
static G4VisManager * fpVisManager

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 744 of file G4VisCommandsViewerSet.cc.

745 {
746
747 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
748
749 G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
750 if (!currentViewer) {
751 if (verbosity >= G4VisManager::errors) {
752 G4warn <<
753 "ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer."
754 << G4endl;
755 }
756 return;
757 }
758
759 G4ViewParameters vp = currentViewer->GetViewParameters();
760
761 if (command == fpCommandAll) {
762 G4VViewer* fromViewer = fpVisManager->GetViewer(newValue);
763 if (!fromViewer) {
764 if (verbosity >= G4VisManager::errors) {
765 G4warn <<
766 "ERROR: G4VisCommandsViewerSet::SetNewValue: all:"
767 "\n unrecognised from-viewer."
768 << G4endl;
769 }
770 return;
771 }
772 if (fromViewer == currentViewer) {
773 if (verbosity >= G4VisManager::warnings) {
774 G4warn <<
775 "WARNING: G4VisCommandsViewerSet::SetNewValue: all:"
776 "\n from-viewer and current viewer are identical."
777 << G4endl;
778 }
779 return;
780 }
781 // Copy view parameters except for autoRefresh and background...
782 auto keepAutoRefresh = vp.IsAutoRefresh();
783 auto keepBackground = vp.GetBackgroundColour();
784 vp = fromViewer->GetViewParameters();
785 vp.SetAutoRefresh(keepAutoRefresh);
786 vp.SetBackgroundColour(keepBackground);
787 // Concatenate any private vis attributes modifiers...
788 const std::vector<G4ModelingParameters::VisAttributesModifier>*
789 privateVAMs = fromViewer->GetPrivateVisAttributesModifiers();
790 if (privateVAMs) {
791 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator i;
792 for (i = privateVAMs->begin(); i != privateVAMs->end(); ++i) {
794 }
795 }
796 if (verbosity >= G4VisManager::confirmations) {
797 G4cout << "View parameters of viewer \"" << currentViewer->GetName()
798 << "\"\n set to those of viewer \"" << fromViewer->GetName()
799 << "\"."
800 << G4endl;
801 }
802 if (verbosity >= G4VisManager::warnings) {
803 G4warn << "You may need \"/vis/viewer/rebuild\"."
804 << G4endl;
805 }
806 }
807
808 else if (command == fpCommandAutoRefresh) {
809 G4bool autoRefresh = G4UIcommand::ConvertToBool(newValue);
810 const G4ViewParameters& defaultVP =
811 currentViewer->GetDefaultViewParameters();
812 if (autoRefresh && !defaultVP.IsAutoRefresh()) {
813 if (verbosity >= G4VisManager::warnings) {
814 G4warn
815 << "WARNING: "
816 << currentViewer->GetName() << " is NOT auto-refesh by default"
817 << "\n so cannot be set to auto-refresh."
818 << G4endl;
819 }
820 return;
821 }
822 vp.SetAutoRefresh(autoRefresh);
823 if (verbosity >= G4VisManager::confirmations) {
824 G4cout << "Views will ";
825 if (!vp.IsAutoRefresh()) G4cout << "not ";
826 G4cout << "be automatically refreshed after a change of view parameters."
827 << G4endl;
828 }
829 if (!vp.IsAutoRefresh()) {
830 currentViewer->SetViewParameters(vp);
831 return; // Avoid a refresh if auto-refresh has been set to off...
832 } // ...otherwise take normal action.
833 }
834
835 else if (command == fpCommandAuxEdge) {
837 if (verbosity >= G4VisManager::confirmations) {
838 G4cout << "Auxiliary edges will ";
839 if (!vp.IsAuxEdgeVisible()) G4cout << "not ";
840 G4cout << "be visible." << G4endl;
841 }
842 }
843
844 else if (command == fpCommandBackground) {
845 G4String redOrString;
846 G4double green, blue, opacity;
847 std::istringstream iss(newValue);
848 iss >> redOrString >> green >> blue >> opacity;
849 G4Colour colour(0.,0.,0.); // Default black and opaque.
850 ConvertToColour(colour, redOrString, green, blue, opacity);
851 vp.SetBackgroundColour(colour);
852 if (verbosity >= G4VisManager::confirmations) {
853 G4cout << "Background colour "
854 << vp.GetBackgroundColour()
855 << " requested."
856 << G4endl;
857 }
858 }
859
860 else if (command == fpCommandCulling) {
861 G4String cullingOption, stringFlag, unit;
862 G4double density;
863 std::istringstream is (newValue);
864 is >> cullingOption >> stringFlag >> density >> unit;
865 G4bool boolFlag = G4UIcommand::ConvertToBool(stringFlag);
866 if (cullingOption == "global") {
867 vp.SetCulling(boolFlag);
868 if (verbosity >= G4VisManager::confirmations) {
869 G4cout <<
870 "G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
871 " set to " << G4UIcommand::ConvertToString(boolFlag) <<
872 ".\n Does not change specific culling flags."
873 << G4endl;
874 }
875 }
876 else if (cullingOption == "coveredDaughters") {
877 vp.SetCullingCovered(boolFlag);
878 if (verbosity >= G4VisManager::confirmations) {
879 G4cout <<
880 "G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
881 "\n daughters flag set to "
882 << G4UIcommand::ConvertToString(boolFlag) <<
883 ". Daughters covered by opaque mothers"
884 "\n will be culled, i.e., not drawn, if this flag is true."
885 "\n Note: this is only effective in surface drawing style,"
886 "\n and then only if the volumes are visible and opaque, and then"
887 "\n only if no sections or cutaways are in operation."
888 << G4endl;
889 }
890 }
891 else if (cullingOption == "invisible") {
892 vp.SetCullingInvisible(boolFlag);
893 if (verbosity >= G4VisManager::confirmations) {
894 G4cout <<
895 "G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
896 "\n flag set to "
897 << boolFlag << G4UIcommand::ConvertToString(boolFlag) <<
898 ". Volumes marked invisible will be culled,"
899 "\n i.e., not drawn, if this flag is true."
900 << G4endl;
901 }
902 }
903 else if (cullingOption == "density") {
904 const G4String where =
905 "G4VisCommandsViewerSet::SetNewValue: culling: culling by density";
906 if (boolFlag) {
907 G4double valueOfUnit;
908 // "Volumic Mass" is Michel's phrase for "Density"
909 if (ProvideValueOfUnit(where,unit,"Volumic Mass",valueOfUnit)) {
910 // Successful outcome of unit search
911 vp.SetDensityCulling(boolFlag);
912 density *= valueOfUnit;
913 vp.SetVisibleDensity(density);
914 } else {
915 // Unsuccessful outcome of unit search. Flag and density unchanged.
916 density = vp.GetVisibleDensity();
917 }
918 } else { // Reset flag but density unchanged.
919 vp.SetDensityCulling(boolFlag);
920 }
921 if (verbosity >= G4VisManager::confirmations) {
922 G4cout
923 << where
924 << "\n flag set to "
925 << std::boolalpha << vp.IsDensityCulling()
926 << ". Volumes with density less than "
927 << G4BestUnit(density,"Volumic Mass")
928 << "\n will be culled, i.e., not drawn, if this flag is true."
929 << G4endl;
930 }
931 }
932 else {
933 if (verbosity >= G4VisManager::errors) {
934 G4warn <<
935 "ERROR: G4VisCommandsViewerSet::SetNewValue: culling:"
936 "\n option not recognised."
937 << G4endl;
938 }
939 }
940 }
941
942 else if (command == fpCommandCutawayMode) {
943 if (newValue == "add" || newValue == "union")
945 if (newValue == "multiply" || newValue == "intersection")
947
948 if (verbosity >= G4VisManager::confirmations) {
949 G4cout << "Cutaway mode set to ";
951 G4cout << "cutawayUnion";
953 G4cout << "cutawayIntersection";
954 G4cout << G4endl;
955 }
956 }
957
958 else if (command == fpCommandDefaultColour) {
959 G4String redOrString;
960 G4double green, blue, opacity;
961 std::istringstream iss(newValue);
962 iss >> redOrString >> green >> blue >> opacity;
963 G4Colour colour(1.,1.,1.); // Default white and opaque.
964 ConvertToColour(colour, redOrString, green, blue, opacity);
965 G4VisAttributes va = vp.GetDefaultVisAttributes();
966 va.SetColour(colour);
968 if (verbosity >= G4VisManager::confirmations) {
969 G4cout << "Default colour "
971 << " requested."
972 << G4endl;
973 }
974 }
975
976 else if (command == fpCommandDefaultTextColour) {
977 G4String redOrString;
978 G4double green, blue, opacity;
979 std::istringstream iss(newValue);
980 iss >> redOrString >> green >> blue >> opacity;
981 G4Colour colour(1.,1.,1.); // Default white and opaque.
982 ConvertToColour(colour, redOrString, green, blue, opacity);
983 G4VisAttributes va = vp.GetDefaultTextVisAttributes();
984 va.SetColour(colour);
986 if (verbosity >= G4VisManager::confirmations) {
987 G4cout << "Default colour "
989 << " requested."
990 << G4endl;
991 }
992 }
993
994 else if (command == fpCommandDotsSize) {
995 G4double dotsSize = fpCommandDotsSize->GetNewDoubleValue(newValue);
996 vp.SetDotsSize(dotsSize);
997 if (verbosity >= G4VisManager::confirmations) {
998 G4cout << "Dots size changed to " << vp.GetDotsSize() << G4endl;
999 }
1000 }
1001
1002 else if (command == fpCommandDotsSmooth) {
1003 vp.SetDotsSmooth(command->ConvertToBool(newValue));
1004 if (verbosity >= G4VisManager::confirmations) {
1005 G4cout << "DotsSmooth mode changed to " << vp.IsDotsSmooth() << G4endl;
1006 }
1007 }
1008
1009 else if (command == fpCommandEdge) {
1011 if (G4UIcommand::ConvertToBool(newValue)) { // true
1012 switch (existingStyle) {
1014 break;
1016 break;
1019 break;
1021 break;
1023 break;
1024 }
1025 }
1026 else { // false
1027 switch (existingStyle) {
1029 break;
1031 break;
1033 break;
1036 break;
1038 break;
1039 }
1040 }
1041 if (verbosity >= G4VisManager::confirmations) {
1042 G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
1043 << "\" set to " << vp.GetDrawingStyle()
1044 << G4endl;
1045 }
1046 }
1047
1048 else if (command == fpCommandExplodeFactor) {
1049 G4double explodeFactor, x, y, z;
1050 G4String unitString;
1051 std::istringstream is (newValue);
1052 is >> explodeFactor >> x >> y >> z >> unitString;
1053 G4double unit = G4UIcommand::ValueOf(unitString);
1054 vp.SetExplodeFactor(explodeFactor);
1055 vp.SetExplodeCentre(G4Point3D(x * unit, y * unit, z * unit));
1056 if (verbosity >= G4VisManager::confirmations) {
1057 G4cout << "Explode factor changed to " << vp.GetExplodeFactor()
1058 << " from centre " << vp.GetExplodeCentre()
1059 << G4endl;
1060 }
1061 }
1062
1063 else if (command == fpCommandGlobalLineWidthScale) {
1064 G4double globalLineWidthScale
1065 = fpCommandGlobalLineWidthScale->GetNewDoubleValue(newValue);
1066 vp.SetGlobalLineWidthScale(globalLineWidthScale);
1067 if (verbosity >= G4VisManager::confirmations) {
1068 G4cout << "Global Line Width Scale changed to "
1070 }
1071 }
1072
1073 else if (command == fpCommandGlobalMarkerScale) {
1074 G4double globalMarkerScale
1075 = fpCommandGlobalMarkerScale->GetNewDoubleValue(newValue);
1076 vp.SetGlobalMarkerScale(globalMarkerScale);
1077 if (verbosity >= G4VisManager::confirmations) {
1078 G4cout << "Global Marker Scale changed to "
1079 << vp.GetGlobalMarkerScale() << G4endl;
1080 }
1081 }
1082
1083 else if (command == fpCommandHiddenEdge) {
1085 if (G4UIcommand::ConvertToBool(newValue)) {
1086 switch (existingStyle) {
1089 break;
1091 break;
1094 break;
1096 break;
1098 break;
1099 }
1100 }
1101 else {
1102 switch (existingStyle) {
1104 break;
1107 break;
1109 break;
1112 break;
1114 break;
1115 }
1116 }
1117 if (verbosity >= G4VisManager::confirmations) {
1118 G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
1119 << "\" set to " << vp.GetDrawingStyle()
1120 << G4endl;
1121 }
1122 }
1123
1124 else if (command == fpCommandHiddenMarker) {
1125 G4bool hidden = G4UIcommand::ConvertToBool(newValue);
1126 if (hidden) vp.SetMarkerHidden();
1127 else vp.SetMarkerNotHidden();
1128 if (verbosity >= G4VisManager::confirmations) {
1129 G4cout << "Markers will ";
1130 if (vp.IsMarkerNotHidden()) G4cout << "not ";
1131 G4cout << "be hidden under solid objects." << G4endl;
1132 }
1133 }
1134
1135 else if (command == fpCommandLightsMove) {
1136 if (newValue.find("cam") != G4String::npos)
1137 vp.SetLightsMoveWithCamera(true);
1138 else if(newValue.find("obj") != G4String::npos)
1139 vp.SetLightsMoveWithCamera(false);
1140 else {
1141 if (verbosity >= G4VisManager::errors) {
1142 G4warn << "ERROR: \"" << newValue << "\" not recognised."
1143 " Looking for \"cam\" or \"obj\" in string." << G4endl;
1144 }
1145 }
1146 if (verbosity >= G4VisManager::confirmations) {
1147 G4cout << "Lights move with ";
1148 if (vp.GetLightsMoveWithCamera())
1149 G4cout << "camera (object appears to rotate).";
1150 else G4cout << "object (the viewer appears to be moving).";
1151 G4cout << G4endl;
1152 }
1153 }
1154
1155 else if (command == fpCommandLightsThetaPhi) {
1156 G4double theta, phi;
1157 if (ConvertToDoublePair(newValue, theta, phi)) {
1158 G4double x = std::sin (theta) * std::cos (phi);
1159 G4double y = std::sin (theta) * std::sin (phi);
1160 G4double z = std::cos (theta);
1161 fLightsVector = G4ThreeVector (x, y, z);
1162 vp.SetLightpointDirection(fLightsVector);
1163 if (verbosity >= G4VisManager::confirmations) {
1164 G4cout << "Lights direction set to "
1165 << vp.GetLightpointDirection() << G4endl;
1166 }
1167 }
1168 }
1169
1170 else if (command == fpCommandLightsVector) {
1171 fLightsVector = G4UIcommand::ConvertTo3Vector(newValue);
1172 vp.SetLightpointDirection(fLightsVector);
1173 if (verbosity >= G4VisManager::confirmations) {
1174 G4cout << "Lights direction set to "
1175 << vp.GetLightpointDirection() << G4endl;
1176 }
1177 }
1178
1179 else if (command == fpCommandLineWidth) {
1180 if (verbosity >= G4VisManager::errors) {
1181 // A do-nothing command
1182 G4warn << command->GetGuidanceLine(0) << G4endl;
1183 }
1184 }
1185
1186 else if (command == fpCommandLineSegments) {
1187 G4int nSides = G4UIcommand::ConvertToInt(newValue);
1188 vp.SetNoOfSides(nSides);
1189 if (verbosity >= G4VisManager::confirmations) {
1190 G4cout <<
1191 "Number of line segments per circle in polygon approximation is "
1192 << nSides << G4endl;
1193 }
1194 }
1195
1196 else if (command == fpCommandNumberOfCloudPoints) {
1197 G4int nPoints = G4UIcommand::ConvertToInt(newValue);
1198 vp.SetNumberOfCloudPoints(nPoints);
1199 if (verbosity >= G4VisManager::confirmations) {
1200 G4cout <<
1201 "Number of points to be used in cloud representation of volumes is "
1202 << nPoints << G4endl;
1203 }
1204 }
1205
1206 else if (command == fpCommandPicking) {
1208 if (verbosity >= G4VisManager::confirmations) {
1209 G4cout << "Picking ";
1210 if (vp.IsPicking()) G4cout << "requested.";
1211 else G4cout << "inhibited.";
1212 G4cout << G4endl;
1213 }
1214 if (verbosity >= G4VisManager::warnings) {
1215 G4warn << "You may need to issue \"/vis/viewer/update\"."
1216 << G4endl;
1217 }
1218 }
1219
1220 else if (command == fpCommandProjection) {
1221 G4double fieldHalfAngle;
1222 const size_t iPos0 = 0;
1223 if (newValue[iPos0] == 'o') { // "orthogonal"
1224 fieldHalfAngle = 0.;
1225 }
1226 else if (newValue[iPos0] == 'p') { // "perspective"
1227 G4String dummy;
1228 G4String unit;
1229 std::istringstream is (newValue);
1230 is >> dummy >> fieldHalfAngle >> unit;
1231 fieldHalfAngle *= G4UIcommand::ValueOf(unit);
1232 if (fieldHalfAngle > 89.5 * deg || fieldHalfAngle <= 0.0) {
1233 if (verbosity >= G4VisManager::errors) {
1234 G4warn <<
1235 "ERROR: Field half angle should be 0 < angle <= 89.5 degrees.";
1236 G4warn << G4endl;
1237 }
1238 return;
1239 }
1240 }
1241 else {
1242 if (verbosity >= G4VisManager::errors) {
1243 G4warn << "ERROR: \"" << newValue << "\" not recognised."
1244 " Looking for 'o' or 'p' first character." << G4endl;
1245 }
1246 return;
1247 }
1248 vp.SetFieldHalfAngle(fieldHalfAngle);
1249 if (verbosity >= G4VisManager::confirmations) {
1250 G4cout << "Projection style of viewer \"" << currentViewer->GetName()
1251 << "\" set to ";
1252 if (fieldHalfAngle == 0.) {
1253 G4cout << "orthogonal.";
1254 }
1255 else {
1256 G4cout << "perspective\n with half angle " << fieldHalfAngle / deg
1257 << " degrees.";
1258 }
1259 G4cout << G4endl;
1260 }
1261 }
1262
1263 else if (command == fpCommandRotationStyle) {
1265 if (newValue == "constrainUpDirection")
1267 else if (newValue == "freeRotation")
1269 else {
1270 if (verbosity >= G4VisManager::errors) {
1271 G4warn << "ERROR: \"" << newValue << "\" not recognised." << G4endl;
1272 }
1273 return;
1274 }
1275 vp.SetRotationStyle(style);
1276 if (verbosity >= G4VisManager::confirmations) {
1277 G4cout << "Rotation style of viewer \"" << currentViewer->GetName()
1278 << "\" set to " << vp.GetRotationStyle()
1279 << G4endl;
1280 }
1281 }
1282
1283 else if (command == fpCommandSectionPlane) {
1284 G4String choice, unit;
1285 G4double x, y, z, nx, ny, nz, F = 1.;
1286 std::istringstream is (newValue);
1287 is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz;
1288 G4int iSelector = -1;
1289 if (G4StrUtil::icompare(choice, "off") == 0 ||
1290 !G4UIcommand::ConvertToBool(choice)) iSelector = 0;
1291 if (G4StrUtil::icompare(choice, "on") == 0 ||
1292 G4UIcommand::ConvertToBool(choice)) iSelector = 1;
1293 if (iSelector < 0) {
1294 if (verbosity >= G4VisManager::errors) {
1295 G4warn << "Choice not recognised (on/true or off/false)." << G4endl;
1296 }
1297 goto write_result;
1298 }
1299 // iSelector can only be 0 or 1
1300 switch (iSelector) {
1301 case 0:
1302 vp.UnsetSectionPlane();
1303 break;
1304 case 1:
1305 F = G4UIcommand::ValueOf(unit);
1306 x *= F; y *= F; z *= F;
1307 if (nx == 0. && ny == 0. && nz == 0.) {
1308 if (verbosity >= G4VisManager::errors) {
1309 G4warn << "Null normal." << G4endl;
1310 }
1311 break;;
1312 }
1313 // Make sure normal is normalised
1314 const G4Normal3D& normal = G4Normal3D(nx,ny,nz).unit();
1315 vp.SetSectionPlane(G4Plane3D(normal, G4Point3D(x,y,z)));
1316 vp.SetViewpointDirection(normal);
1317 break;
1318 }
1319 write_result:
1320 if (verbosity >= G4VisManager::confirmations) {
1321 G4cout << "Section drawing is: ";
1322 if (vp.IsSection ()) G4cout << "on";
1323 else G4cout << "off";
1324 G4cout << ".\nSection plane is now: "
1325 << vp.GetSectionPlane ();
1326 G4cout << G4endl;
1327 }
1328 }
1329
1330 else if (command == fpCommandSpecialMeshRendering) {
1332 if (verbosity >= G4VisManager::confirmations) {
1333 G4cout << "Special mesh rendering";
1334 if (vp.IsSpecialMeshRendering()) {
1335 G4cout << " requested. Current option is \""
1336 << vp.GetSpecialMeshRenderingOption() << "\" for ";
1337 if (vp.GetSpecialMeshVolumes().empty()) {
1338 G4cout << "any mesh.";
1339 } else{
1340 G4cout << "selected volumes:";
1341 for (const auto& pvNameCopyNo: vp.GetSpecialMeshVolumes()) {
1342 G4cout << "\n " << pvNameCopyNo.GetName();
1343 if (pvNameCopyNo.GetCopyNo() >= 0) G4cout << ':' << pvNameCopyNo.GetCopyNo();
1344 }
1345 }
1346 }
1347 else G4cout << ": off.";
1348 G4cout << G4endl;
1349 }
1350 }
1351
1352 else if (command == fpCommandSpecialMeshRenderingOption) {
1354 if (newValue == "dots") {
1356 }
1357 else if(newValue == "surfaces") {
1359 }
1361 if (verbosity >= G4VisManager::confirmations) {
1362 G4cout << "Special mesh rendering option set to \""
1363 << vp.GetSpecialMeshRenderingOption() << "\"."
1364 << G4endl;
1365 }
1366 }
1367
1368 else if (command == fpCommandSpecialMeshVolumes) {
1369 std::vector<G4ModelingParameters::PVNameCopyNo> requestedMeshes;
1370 if (newValue.empty()) {
1371 vp.SetSpecialMeshVolumes(requestedMeshes); // Empty list
1372 } else {
1373 // Algorithm from Josuttis p.476.
1374 G4String::size_type iBegin, iEnd;
1375 iBegin = newValue.find_first_not_of(' ');
1376 while (iBegin != G4String::npos) {
1377 iEnd = newValue.find_first_of(' ',iBegin);
1378 if (iEnd == G4String::npos) {
1379 iEnd = newValue.length();
1380 }
1381 const G4String& name(newValue.substr(iBegin,iEnd-iBegin));
1382 iBegin = newValue.find_first_not_of(' ',iEnd);
1383 if (iBegin == G4String::npos) {
1384 if (verbosity >= G4VisManager::warnings) {
1385 G4warn <<
1386 "WARNING: G4VisCommandsViewerSet::SetNewValue: /vis/viewer/set/specialMeshVolumes"
1387 "\n A pair not found. (There should be an even number of parameters.)"
1388 "\n Command ignored."
1389 << G4endl;
1390 return;
1391 }
1392 }
1393 iEnd = newValue.find_first_of(' ',iBegin);
1394 if (iEnd == G4String::npos) {
1395 iEnd = newValue.length();
1396 }
1397 G4int copyNo;
1398 std::istringstream iss(newValue.substr(iBegin,iEnd-iBegin));
1399 if (!(iss >> copyNo)) {
1400 if (verbosity >= G4VisManager::warnings) {
1401 G4warn <<
1402 "WARNING: G4VisCommandsViewerSet::SetNewValue: /vis/viewer/set/specialMeshVolumes"
1403 "\n Error reading copy number - it was not numeric?"
1404 "\n Command ignored."
1405 << G4endl;
1406 return;
1407 }
1408 }
1409 requestedMeshes.push_back(G4ModelingParameters::PVNameCopyNo(name,copyNo));
1410 iBegin = newValue.find_first_not_of(' ',iEnd);
1411 }
1412 vp.SetSpecialMeshVolumes(requestedMeshes);
1413 }
1414 if (verbosity >= G4VisManager::confirmations) {
1415 if (vp.GetSpecialMeshVolumes().empty()) {
1416 G4cout <<
1417 "Special mesh list empty, which means \"all meshes\"."
1418 << G4endl;
1419 } else {
1420 G4cout << "Selected special mesh volumes are:";
1421 for (const auto& pvNameCopyNo: vp.GetSpecialMeshVolumes()) {
1422 G4cout << "\n " << pvNameCopyNo.GetName();
1423 if (pvNameCopyNo.GetCopyNo() >= 0) G4cout << ':' << pvNameCopyNo.GetCopyNo();
1424 }
1425 G4cout << G4endl;
1426 }
1427 }
1428 }
1429
1430 else if (command == fpCommandStyle) {
1432 const size_t iPos0 = 0;
1433 if (newValue[iPos0] == 'w') { // "wireframe"
1434 switch (existingStyle) {
1436 break;
1438 break;
1441 break;
1444 break;
1447 break;
1448 }
1449 }
1450 else if (newValue[iPos0] == 's') { // "surface"
1451 switch (existingStyle) {
1454 break;
1457 break;
1459 break;
1461 break;
1464 break;
1465 }
1466 }
1467 else if (newValue[iPos0] == 'c') { // "cloud"
1468 switch (existingStyle) {
1471 break;
1474 break;
1477 break;
1480 break;
1482 break;
1483 }
1484 }
1485 else {
1486 if (verbosity >= G4VisManager::errors) {
1487 G4warn << "ERROR: \"" << newValue << "\" not recognised."
1488 " Looking for 'w' or 's' or 'c' first character." << G4endl;
1489 }
1490 return;
1491 }
1492 if (verbosity >= G4VisManager::confirmations) {
1493 G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
1494 << "\" set to " << vp.GetDrawingStyle()
1495 << G4endl;
1496 }
1497 }
1498
1499 else if (command == fpCommandTargetPoint) {
1500 G4ThreeVector targetPoint =
1501 fpCommandTargetPoint->GetNew3VectorValue(newValue);
1502 const G4Point3D& standardTargetPoint =
1503 currentViewer->GetSceneHandler()->GetScene()->GetStandardTargetPoint();
1504 vp.SetCurrentTargetPoint(targetPoint - standardTargetPoint);
1505 if (verbosity >= G4VisManager::confirmations) {
1506 G4cout << "Target point set to "
1507 << fpCommandTargetPoint->ConvertToStringWithBestUnit
1508 (targetPoint)
1509 << "\n\"Current Target Point\" set to "
1510 << fpCommandTargetPoint->ConvertToStringWithBestUnit
1512 << "\n\"Standard Target Point\" is "
1513 << fpCommandTargetPoint->ConvertToStringWithBestUnit
1514 (standardTargetPoint)
1515 << G4endl;
1516 }
1517 }
1518
1519 else if (command == fpCommandTransparencyByDepth) {
1520 G4double transparencyByDepth;
1521 G4int option;
1522 std::istringstream is (newValue);
1523 is >> transparencyByDepth >> option;
1524 vp.SetTransparencyByDepth(transparencyByDepth);
1526 if (verbosity >= G4VisManager::confirmations) {
1527 G4cout << "Transparency by depth set to " << transparencyByDepth
1528 << " with option " << option << G4endl;
1529 }
1530 }
1531
1532 else if (command == fpCommandUpThetaPhi) {
1533 G4double theta, phi;
1534 if (ConvertToDoublePair(newValue, theta, phi)) {
1535 G4double x = std::sin (theta) * std::cos (phi);
1536 G4double y = std::sin (theta) * std::sin (phi);
1537 G4double z = std::cos (theta);
1538 fUpVector = G4ThreeVector (x, y, z);
1539 vp.SetUpVector(fUpVector);
1540 if (verbosity >= G4VisManager::confirmations) {
1541 G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
1542 }
1543 }
1544 }
1545
1546 else if (command == fpCommandUpVector) {
1547 fUpVector = G4UIcommand::ConvertTo3Vector(newValue).unit();
1548 vp.SetUpVector(fUpVector);
1549 if (verbosity >= G4VisManager::confirmations) {
1550 G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
1551 }
1552 }
1553
1554 else if (command == fpCommandViewpointThetaPhi) {
1555 G4double theta, phi;
1556 if (ConvertToDoublePair(newValue, theta, phi)) {
1557 G4double x = std::sin (theta) * std::cos (phi);
1558 G4double y = std::sin (theta) * std::sin (phi);
1559 G4double z = std::cos (theta);
1560 fViewpointVector = G4ThreeVector (x, y, z);
1561 vp.SetViewAndLights(fViewpointVector);
1562 if (verbosity >= G4VisManager::confirmations) {
1563 G4cout << "Viewpoint direction set to "
1564 << vp.GetViewpointDirection() << G4endl;
1565 if (vp.GetLightsMoveWithCamera ()) {
1566 G4cout << "Lightpoint direction set to "
1568 }
1569 }
1570 }
1571 }
1572
1573 else if (command == fpCommandViewpointVector) {
1574 G4ThreeVector viewpointVector = G4UIcommand::ConvertTo3Vector(newValue);
1575 if (viewpointVector.mag2() <= 0.) {
1576 if (verbosity >= G4VisManager::errors) {
1577 G4warn << "ERROR: Null viewpoint vector. No action taken." << G4endl;
1578 }
1579 } else {
1580 fViewpointVector = viewpointVector.unit();
1581 vp.SetViewAndLights(fViewpointVector);
1582 if (verbosity >= G4VisManager::confirmations) {
1583 G4cout << "Viewpoint direction set to "
1584 << vp.GetViewpointDirection() << G4endl;
1585 if (vp.GetLightsMoveWithCamera ()) {
1586 G4cout << "Lightpoint direction set to "
1588 }
1589 }
1590 }
1591 }
1592
1593 else if (command == fpCommandTimeWindowDisplayHeadTime)
1594 {
1595 G4String display;
1596 G4double screenX, screenY, screenSize, red, green, blue;
1597 std::istringstream iss(newValue);
1598 iss >> display >> screenX >> screenY
1599 >> screenSize >> red >> green >> blue;
1600 auto timeParameters = vp.GetTimeParameters();
1601 timeParameters.fDisplayHeadTime = command->ConvertToBool(display);
1602 timeParameters.fDisplayHeadTimeX = screenX;
1603 timeParameters.fDisplayHeadTimeY = screenY;
1604 timeParameters.fDisplayHeadTimeSize = screenSize;
1605 timeParameters.fDisplayHeadTimeRed = red;
1606 timeParameters.fDisplayHeadTimeGreen = green;
1607 timeParameters.fDisplayHeadTimeBlue = blue;
1608 vp.SetTimeParameters(timeParameters);
1609 if (verbosity >= G4VisManager::confirmations) {
1610 G4cout << "Display head time flag set: "
1611 << vp
1612 << G4endl;
1613 }
1614 }
1615
1616 else if (command == fpCommandTimeWindowDisplayLightFront)
1617 {
1618 G4String display, originX, originY, originZ, unitS, originT, unitT;
1619 G4double red, green, blue;
1620 std::istringstream iss(newValue);
1621 iss >> display
1622 >> originX >> originY >> originZ >> unitS
1623 >> originT >> unitT
1624 >> red >> green >> blue;
1625 auto timeParameters = vp.GetTimeParameters();
1626 timeParameters.fDisplayLightFront = command->ConvertToBool(display);
1627 timeParameters.fDisplayLightFrontX
1628 = command->ConvertToDimensionedDouble(G4String(originX + ' ' + unitS));
1629 timeParameters.fDisplayLightFrontY
1630 = command->ConvertToDimensionedDouble(G4String(originY + ' ' + unitS));
1631 timeParameters.fDisplayLightFrontZ
1632 = command->ConvertToDimensionedDouble(G4String(originZ + ' ' + unitS));
1633 timeParameters.fDisplayLightFrontT
1634 = command->ConvertToDimensionedDouble(G4String(originT + ' ' + unitT));
1635 timeParameters.fDisplayLightFrontRed = red;
1636 timeParameters.fDisplayLightFrontGreen = green;
1637 timeParameters.fDisplayLightFrontBlue = blue;
1638 vp.SetTimeParameters(timeParameters);
1639 if (verbosity >= G4VisManager::confirmations) {
1640 G4cout << "Display light front flag set: "
1641 << vp
1642 << G4endl;
1643 }
1644 }
1645
1646 else if (command == fpCommandTimeWindowEndTime)
1647 {
1648 G4String end_time_string, end_time_unit, time_range_string, time_range_unit;
1649 std::istringstream iss(newValue);
1650 iss >> end_time_string >> end_time_unit >> time_range_string >> time_range_unit;
1651 auto endTime = command->ConvertToDimensionedDouble
1652 (G4String(end_time_string + ' ' + end_time_unit));
1653 auto timeRange = command->ConvertToDimensionedDouble
1654 (G4String(time_range_string + ' ' + time_range_unit));
1655 auto timeParameters = vp.GetTimeParameters();
1656 timeParameters.fEndTime = endTime;
1657 if (timeRange > 0.) {
1658 timeParameters.fStartTime = endTime - timeRange;
1659 }
1660 vp.SetTimeParameters(timeParameters);
1661 if (verbosity >= G4VisManager::confirmations) {
1662 G4cout
1663 << "Time window start time: " << vp.GetTimeParameters().fStartTime/ns << " ns"
1664 << ", time window end time: " << vp.GetTimeParameters().fEndTime/ns << " ns";
1665 if (timeRange > 0.) {
1666 G4cout << "\n (time range: " << timeRange/ns << " ns)";
1667 }
1668 G4cout << G4endl;
1669 }
1670 }
1671
1672 else if (command == fpCommandTimeWindowFadeFactor) {
1673 auto timeParameters = vp.GetTimeParameters();
1674 timeParameters.fFadeFactor = command->ConvertToDouble(newValue);
1675 vp.SetTimeParameters(timeParameters);
1676 if (verbosity >= G4VisManager::confirmations) {
1677 G4cout << "Time window fade factor changed to " << vp.GetTimeParameters().fFadeFactor
1678 << G4endl;
1679 }
1680 }
1681
1682 else if (command == fpCommandTimeWindowStartTime)
1683 {
1684 G4String start_time_string, start_time_unit, time_range_string, time_range_unit;
1685 std::istringstream iss(newValue);
1686 iss >> start_time_string >> start_time_unit >> time_range_string >> time_range_unit;
1687 auto startTime = command->ConvertToDimensionedDouble
1688 (G4String(start_time_string + ' ' + start_time_unit));
1689 auto timeRange = command->ConvertToDimensionedDouble
1690 (G4String(time_range_string + ' ' + time_range_unit));
1691 auto timeParameters = vp.GetTimeParameters();
1692 timeParameters.fStartTime = startTime;
1693 if (timeRange > 0.) {
1694 timeParameters.fEndTime = startTime + timeRange;
1695 }
1696 vp.SetTimeParameters(timeParameters);
1697 if (verbosity >= G4VisManager::confirmations) {
1698 G4cout
1699 << "Time window start time: " << vp.GetTimeParameters().fStartTime/ns << " ns"
1700 << ", time window end time: " << vp.GetTimeParameters().fEndTime/ns << " ns";
1701 if (timeRange > 0.) {
1702 G4cout << "\n (time range: " << timeRange/ns << " ns)";
1703 }
1704 G4cout << G4endl;
1705 }
1706 }
1707
1708 else if (command == fpCommandZoomToCursor) {
1709 vp.SetZoomToCursor(command->ConvertToBool(newValue));
1710 if (verbosity >= G4VisManager::confirmations) {
1711 G4cout << "ZoomToCursor mode changed to " << vp.IsZoomToCursor() << G4endl;
1712 }
1713 }
1714
1715 else {
1716 if (verbosity >= G4VisManager::errors) {
1717 G4warn <<
1718 "ERROR: G4VisCommandsViewerSet::SetNewValue: unrecognised command."
1719 << G4endl;
1720 }
1721 return;
1722 }
1723
1724 SetViewParameters(currentViewer,vp);
1725}
HepGeom::Normal3D< G4double > G4Normal3D
Definition G4Normal3D.hh:34
HepGeom::Plane3D< G4double > G4Plane3D
Definition G4Plane3D.hh:34
HepGeom::Point3D< G4double > G4Point3D
Definition G4Point3D.hh:34
#define G4warn
Definition G4Scene.cc:41
#define G4BestUnit(a, b)
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
Hep3Vector unit() const
double mag2() const
const G4Point3D & GetStandardTargetPoint() const
const G4String & GetGuidanceLine(G4int i) const
static G4ThreeVector ConvertTo3Vector(const char *st)
static G4double ValueOf(const char *unitName)
static G4int ConvertToInt(const char *st)
static G4bool ConvertToBool(const char *st)
static G4double ConvertToDouble(const char *st)
static G4double ConvertToDimensionedDouble(const char *st)
G4Scene * GetScene() const
const G4String & GetName() const
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers() const
const G4ViewParameters & GetDefaultViewParameters() const
void SetViewParameters(const G4ViewParameters &vp)
Definition G4VViewer.cc:216
G4VSceneHandler * GetSceneHandler() const
void ConvertToColour(G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
static G4bool ConvertToDoublePair(const G4String &paramString, G4double &xval, G4double &yval)
void SetViewParameters(G4VViewer *viewer, const G4ViewParameters &viewParams)
G4bool ProvideValueOfUnit(const G4String &where, const G4String &unit, const G4String &category, G4double &value)
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
G4int SetNumberOfCloudPoints(G4int)
G4int SetNoOfSides(G4int nSides)
void SetViewAndLights(const G4Vector3D &viewpointDirection)
void SetAutoRefresh(G4bool)
void SetBackgroundColour(const G4Colour &)
void SetGlobalMarkerScale(G4double globalMarkerScale)
void SetExplodeCentre(const G4Point3D &explodeCentre)
G4bool IsSpecialMeshRendering() const
void SetDotsSize(G4double)
CutawayMode GetCutawayMode() const
G4double GetExplodeFactor() const
const G4ModelingParameters::TimeParameters & GetTimeParameters() const
void SetSpecialMeshRenderingOption(SMROption)
G4bool IsMarkerNotHidden() const
void SetVisibleDensity(G4double visibleDensity)
G4double GetGlobalLineWidthScale() const
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
G4Vector3D & GetActualLightpointDirection()
void SetCulling(G4bool)
void SetCurrentTargetPoint(const G4Point3D &currentTargetPoint)
void UnsetSectionPlane()
void SetZoomToCursor(G4bool)
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)
const G4Colour & GetBackgroundColour() const
const G4Vector3D & GetLightpointDirection() const
G4bool IsZoomToCursor() const
void SetDefaultVisAttributes(const G4VisAttributes &)
void SetFieldHalfAngle(G4double fieldHalfAngle)
void SetCullingCovered(G4bool)
const G4Vector3D & GetViewpointDirection() const
G4bool IsSection() const
void SetExplodeFactor(G4double explodeFactor)
void SetGlobalLineWidthScale(G4double globalLineWidthScale)
const G4Point3D & GetCurrentTargetPoint() const
G4bool IsPicking() const
void SetSpecialMeshVolumes(const std::vector< G4ModelingParameters::PVNameCopyNo > &)
G4bool IsDotsSmooth() const
void SetPicking(G4bool)
void SetMarkerHidden()
const G4VisAttributes * GetDefaultTextVisAttributes() const
void SetDotsSmooth(G4bool)
void SetDensityCulling(G4bool)
const G4Vector3D & GetUpVector() const
void SetTransparencyByDepth(G4double)
void SetMarkerNotHidden()
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4double GetGlobalMarkerScale() const
const G4VisAttributes * GetDefaultVisAttributes() const
void SetCullingInvisible(G4bool)
void SetUpVector(const G4Vector3D &upVector)
RotationStyle GetRotationStyle() const
void SetCutawayMode(CutawayMode)
void SetSpecialMeshRendering(G4bool)
void SetTransparencyByDepthOption(G4int)
G4bool IsDensityCulling() const
void SetDefaultTextVisAttributes(const G4VisAttributes &)
void SetLightpointDirection(const G4Vector3D &lightpointDirection)
void SetLightsMoveWithCamera(G4bool moves)
void SetRotationStyle(RotationStyle)
G4bool IsAutoRefresh() const
G4double GetVisibleDensity() const
SMROption GetSpecialMeshRenderingOption() const
G4bool GetLightsMoveWithCamera() const
void SetSectionPlane(const G4Plane3D &sectionPlane)
void SetTimeParameters(const G4ModelingParameters::TimeParameters &)
G4double GetDotsSize() const
void SetAuxEdgeVisible(G4bool)
const G4Point3D & GetExplodeCentre() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
void SetColour(const G4Colour &)
const G4Colour & GetColour() const
BasicVector3D< T > unit() const
const char * name(G4int ptype)
G4int icompare(std::string_view lhs, std::string_view rhs)
Case insensitive comparison of two strings.
#define ns(x)
Definition xmltok.c:1649

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