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

#include <G4ViewParameters.hh>

Public Types

enum  DrawingStyle {
  wireframe , hlr , hsr , hlhsr ,
  cloud
}
 
enum  CutawayMode { cutawayUnion , cutawayIntersection }
 
enum  RotationStyle { constrainUpDirection , freeRotation }
 
enum  SMROption { meshAsDots , meshAsSurfaces }
 

Public Member Functions

 G4ViewParameters ()
 
 ~G4ViewParameters ()
 
G4bool operator!= (const G4ViewParameters &) const
 
DrawingStyle GetDrawingStyle () const
 
G4int GetNumberOfCloudPoints () const
 
G4bool IsAuxEdgeVisible () const
 
G4bool IsCulling () const
 
G4bool IsCullingInvisible () const
 
G4bool IsDensityCulling () const
 
G4double GetVisibleDensity () const
 
G4bool IsCullingCovered () const
 
G4int GetCBDAlgorithmNumber () const
 
const std::vector< G4double > & GetCBDParameters () const
 
G4bool IsSection () const
 
const G4Plane3DGetSectionPlane () const
 
G4bool IsCutaway () const
 
CutawayMode GetCutawayMode () const
 
const G4PlanesGetCutawayPlanes () const
 
G4bool IsExplode () const
 
G4double GetExplodeFactor () const
 
const G4Point3DGetExplodeCentre () const
 
G4int GetNoOfSides () const
 
const G4Vector3DGetViewpointDirection () const
 
const G4Vector3DGetUpVector () const
 
G4double GetFieldHalfAngle () const
 
G4double GetZoomFactor () const
 
const G4Vector3DGetScaleFactor () const
 
const G4Point3DGetCurrentTargetPoint () const
 
G4double GetDolly () const
 
G4bool GetLightsMoveWithCamera () const
 
const G4Vector3DGetLightpointDirection () const
 
G4Vector3DGetActualLightpointDirection ()
 
const G4VisAttributesGetDefaultVisAttributes () const
 
const G4VisAttributesGetDefaultTextVisAttributes () const
 
const G4VMarkerGetDefaultMarker () const
 
G4double GetGlobalMarkerScale () const
 
G4double GetGlobalLineWidthScale () const
 
G4bool IsMarkerNotHidden () const
 
unsigned int GetWindowSizeHintX () const
 
unsigned int GetWindowSizeHintY () const
 
G4int GetWindowAbsoluteLocationHintX (G4int) const
 
G4int GetWindowAbsoluteLocationHintY (G4int) const
 
G4int GetWindowLocationHintX () const
 
G4int GetWindowLocationHintY () const
 
G4bool IsWindowLocationHintXNegative () const
 
G4bool IsWindowLocationHintYNegative () const
 
const G4StringGetXGeometryString () const
 
bool IsWindowSizeHintX () const
 
bool IsWindowSizeHintY () const
 
bool IsWindowLocationHintX () const
 
bool IsWindowLocationHintY () const
 
G4bool IsAutoRefresh () const
 
const G4ColourGetBackgroundColour () const
 
G4bool IsPicking () const
 
RotationStyle GetRotationStyle () const
 
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers () const
 
G4double GetStartTime () const
 
G4double GetEndTime () const
 
G4double GetFadeFactor () const
 
G4bool IsDisplayHeadTime () const
 
G4double GetDisplayHeadTimeX () const
 
G4double GetDisplayHeadTimeY () const
 
G4double GetDisplayHeadTimeSize () const
 
G4double GetDisplayHeadTimeRed () const
 
G4double GetDisplayHeadTimeGreen () const
 
G4double GetDisplayHeadTimeBlue () const
 
G4bool IsDisplayLightFront () const
 
G4double GetDisplayLightFrontX () const
 
G4double GetDisplayLightFrontY () const
 
G4double GetDisplayLightFrontZ () const
 
G4double GetDisplayLightFrontT () const
 
G4double GetDisplayLightFrontRed () const
 
G4double GetDisplayLightFrontGreen () const
 
G4double GetDisplayLightFrontBlue () const
 
G4bool IsSpecialMeshRendering () const
 
SMROption GetSpecialMeshRenderingOption () const
 
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes () const
 
G4double GetCameraDistance (G4double radius) const
 
G4double GetNearDistance (G4double cameraDistance, G4double radius) const
 
G4double GetFarDistance (G4double cameraDistance, G4double nearDistance, G4double radius) const
 
G4double GetFrontHalfHeight (G4double nearDistance, G4double radius) const
 
void SetDrawingStyle (G4ViewParameters::DrawingStyle style)
 
G4int SetNumberOfCloudPoints (G4int)
 
void SetAuxEdgeVisible (G4bool)
 
void SetCulling (G4bool)
 
void SetCullingInvisible (G4bool)
 
void SetDensityCulling (G4bool)
 
void SetVisibleDensity (G4double visibleDensity)
 
void SetCullingCovered (G4bool)
 
void SetCBDAlgorithmNumber (G4int)
 
void SetCBDParameters (const std::vector< G4double > &)
 
void SetSectionPlane (const G4Plane3D &sectionPlane)
 
void UnsetSectionPlane ()
 
void SetCutawayMode (CutawayMode)
 
void AddCutawayPlane (const G4Plane3D &cutawayPlane)
 
void ChangeCutawayPlane (size_t index, const G4Plane3D &cutawayPlane)
 
void ClearCutawayPlanes ()
 
void SetExplodeFactor (G4double explodeFactor)
 
void UnsetExplodeFactor ()
 
void SetExplodeCentre (const G4Point3D &explodeCentre)
 
G4int SetNoOfSides (G4int nSides)
 
void SetViewpointDirection (const G4Vector3D &viewpointDirection)
 
void SetViewAndLights (const G4Vector3D &viewpointDirection)
 
void SetUpVector (const G4Vector3D &upVector)
 
void SetFieldHalfAngle (G4double fieldHalfAngle)
 
void SetOrthogonalProjection ()
 
void SetPerspectiveProjection (G4double fieldHalfAngle=30. *CLHEP::deg)
 
void SetZoomFactor (G4double zoomFactor)
 
void MultiplyZoomFactor (G4double zoomFactorMultiplier)
 
void SetScaleFactor (const G4Vector3D &scaleFactor)
 
void MultiplyScaleFactor (const G4Vector3D &scaleFactorMultiplier)
 
void SetCurrentTargetPoint (const G4Point3D &currentTargetPoint)
 
void SetDolly (G4double dolly)
 
void IncrementDolly (G4double dollyIncrement)
 
void SetLightpointDirection (const G4Vector3D &lightpointDirection)
 
void SetLightsMoveWithCamera (G4bool moves)
 
void SetPan (G4double right, G4double up)
 
void IncrementPan (G4double right, G4double up)
 
void IncrementPan (G4double right, G4double up, G4double forward)
 
void SetDefaultVisAttributes (const G4VisAttributes &)
 
void SetDefaultColour (const G4Colour &)
 
void SetDefaultTextVisAttributes (const G4VisAttributes &)
 
void SetDefaultTextColour (const G4Colour &)
 
void SetDefaultMarker (const G4VMarker &defaultMarker)
 
void SetGlobalMarkerScale (G4double globalMarkerScale)
 
void SetGlobalLineWidthScale (G4double globalLineWidthScale)
 
void SetMarkerHidden ()
 
void SetMarkerNotHidden ()
 
void SetWindowSizeHint (G4int xHint, G4int yHint)
 
void SetWindowLocationHint (G4int xHint, G4int yHint)
 
void SetXGeometryString (const G4String &)
 
void SetAutoRefresh (G4bool)
 
void SetBackgroundColour (const G4Colour &)
 
void SetPicking (G4bool)
 
void SetRotationStyle (RotationStyle)
 
void ClearVisAttributesModifiers ()
 
void AddVisAttributesModifier (const G4ModelingParameters::VisAttributesModifier &)
 
void SetStartTime (G4double)
 
void SetEndTime (G4double)
 
void SetFadeFactor (G4double)
 
void SetDisplayHeadTime (G4bool)
 
void SetDisplayHeadTimeX (G4double)
 
void SetDisplayHeadTimeY (G4double)
 
void SetDisplayHeadTimeSize (G4double)
 
void SetDisplayHeadTimeRed (G4double)
 
void SetDisplayHeadTimeGreen (G4double)
 
void SetDisplayHeadTimeBlue (G4double)
 
void SetDisplayLightFront (G4bool)
 
void SetDisplayLightFrontX (G4double)
 
void SetDisplayLightFrontY (G4double)
 
void SetDisplayLightFrontZ (G4double)
 
void SetDisplayLightFrontT (G4double)
 
void SetDisplayLightFrontRed (G4double)
 
void SetDisplayLightFrontGreen (G4double)
 
void SetDisplayLightFrontBlue (G4double)
 
void SetSpecialMeshRendering (G4bool)
 
void SetSpecialMeshRenderingOption (SMROption)
 
void SetSpecialMeshVolumes (const std::vector< G4ModelingParameters::PVNameCopyNo > &)
 
G4String CameraAndLightingCommands (const G4Point3D standardTargetPoint) const
 
G4String DrawingStyleCommands () const
 
G4String SceneModifyingCommands () const
 
G4String TouchableCommands () const
 
G4String TimeWindowCommands () const
 
void PrintDifferences (const G4ViewParameters &v) const
 

Static Public Member Functions

static G4ViewParametersCatmullRomCubicSplineInterpolation (const std::vector< G4ViewParameters > &views, G4int nInterpolationPoints=50)
 

Friends

std::ostream & operator<< (std::ostream &, DrawingStyle)
 
std::ostream & operator<< (std::ostream &, SMROption)
 
std::ostream & operator<< (std::ostream &, const G4ViewParameters &)
 

Detailed Description

Definition at line 90 of file G4ViewParameters.hh.

Member Enumeration Documentation

◆ CutawayMode

Enumerator
cutawayUnion 
cutawayIntersection 

Definition at line 102 of file G4ViewParameters.hh.

102 {
103 cutawayUnion, // Union (addition) of result of each cutaway plane.
104 cutawayIntersection // Intersection (multiplication) " .
105 };

◆ DrawingStyle

Enumerator
wireframe 
hlr 
hsr 
hlhsr 
cloud 

Definition at line 94 of file G4ViewParameters.hh.

94 {
95 wireframe, // Draw edges - no hidden line removal.
96 hlr, // Draw edges - hidden lines removed.
97 hsr, // Draw surfaces - hidden surfaces removed.
98 hlhsr, // Draw surfaces and edges - hidden removed.
99 cloud // Draw volume as a cloud of dots.
100 };

◆ RotationStyle

Enumerator
constrainUpDirection 
freeRotation 

Definition at line 107 of file G4ViewParameters.hh.

107 {
108 constrainUpDirection, // Standard, HEP convention.
109 freeRotation // Free, Google-like rotation, using mouse-grab.
110 };

◆ SMROption

Enumerator
meshAsDots 
meshAsSurfaces 

Definition at line 112 of file G4ViewParameters.hh.

112 { // Special Mesh Rendering Option
115 };

Constructor & Destructor Documentation

◆ G4ViewParameters()

G4ViewParameters::G4ViewParameters ( )

Definition at line 45 of file G4ViewParameters.cc.

45 :
46 fDrawingStyle (wireframe),
47 fNumberOfCloudPoints(10000),
48 fAuxEdgeVisible (false),
49 fCulling (true),
50 fCullInvisible (true),
51 fDensityCulling (false),
52 fVisibleDensity (0.01 * g / cm3),
53 fCullCovered (false),
54 fCBDAlgorithmNumber (0),
55 fSection (false),
56 fSectionPlane (),
57 fCutawayMode (cutawayUnion),
58 fCutawayPlanes (),
59 fExplodeFactor (1.),
60 fNoOfSides (),
61 fViewpointDirection (G4Vector3D (0., 0., 1.)), // On z-axis.
62 fUpVector (G4Vector3D (0., 1., 0.)), // y-axis up.
63 fFieldHalfAngle (0.), // Orthogonal projection.
64 fZoomFactor (1.),
65 fScaleFactor (G4Vector3D (1., 1., 1.)),
66 fCurrentTargetPoint (),
67 fDolly (0.),
68 fLightsMoveWithCamera (false),
69 fRelativeLightpointDirection (G4Vector3D (1., 1., 1.)),
70 fActualLightpointDirection (G4Vector3D (1., 1., 1.)),
71 fDefaultVisAttributes (),
72 fDefaultTextVisAttributes (G4Colour (0., 0., 1.)),
73 fDefaultMarker (),
74 fGlobalMarkerScale (1.),
75 fGlobalLineWidthScale (1.),
76 fMarkerNotHidden (true),
77 fWindowSizeHintX (600),
78 fWindowSizeHintY (600),
79 fWindowLocationHintX(0),
80 fWindowLocationHintY(0),
81 fWindowLocationHintXNegative(true),
82 fWindowLocationHintYNegative(false),
83 fGeometryMask(0),
84 fAutoRefresh (false),
85 fBackgroundColour (G4Colour(0.,0.,0.)), // Black
86 fPicking (false),
87 fRotationStyle (constrainUpDirection),
90 fFadeFactor(0.),
91 fDisplayHeadTime(false),
92 fDisplayHeadTimeX(-0.9),
93 fDisplayHeadTimeY(-0.9),
94 fDisplayHeadTimeSize(24.),
95 fDisplayHeadTimeRed(0.),
96 fDisplayHeadTimeGreen(1.),
97 fDisplayHeadTimeBlue(1.),
98 fDisplayLightFront(false),
99 fDisplayLightFrontX(0.),
100 fDisplayLightFrontY(0.),
101 fDisplayLightFrontZ(0.),
102 fDisplayLightFrontT(0.),
103 fDisplayLightFrontRed(0.),
104 fDisplayLightFrontGreen(1.),
105 fDisplayLightFrontBlue(0.),
106 fSpecialMeshRendering(false),
107 fSpecialMeshRenderingOption(meshAsDots)
108{
109 // Pick up default no of sides from G4Polyhedron.
110 // Note that this parameter is variously called:
111 // No of sides
112 // NumberOfRotationSteps
113 // Line segments per circle
114 // It refers to the approximation of a circle by a polygon of
115 // stated number of sides.
117
118 fDefaultMarker.SetScreenSize (5.);
119 // Markers are 5 pixels "overall" size, i.e., diameter.
120}
void SetScreenSize(G4double)
static constexpr G4double fVeryLongTime
static G4int GetNumberOfRotationSteps()

◆ ~G4ViewParameters()

G4ViewParameters::~G4ViewParameters ( )

Definition at line 122 of file G4ViewParameters.cc.

122{}

Member Function Documentation

◆ AddCutawayPlane()

void G4ViewParameters::AddCutawayPlane ( const G4Plane3D cutawayPlane)

Definition at line 184 of file G4ViewParameters.cc.

184 {
185 if (fCutawayPlanes.size () < 3 ) {
186 fCutawayPlanes.push_back (cutawayPlane);
187 }
188 else {
189 G4warn <<
190 "ERROR: G4ViewParameters::AddCutawayPlane:"
191 "\n A maximum of 3 cutaway planes supported." << G4endl;
192 }
193}
#define G4warn
Definition: G4Scene.cc:41
#define G4endl
Definition: G4ios.hh:57

Referenced by G4VisCommandViewerAddCutawayPlane::SetNewValue().

◆ AddVisAttributesModifier()

void G4ViewParameters::AddVisAttributesModifier ( const G4ModelingParameters::VisAttributesModifier vam)

Definition at line 301 of file G4ViewParameters.cc.

302 {
303 // If target exists with same signifier just change vis attributes.
304 G4bool duplicateTarget = false;
305 auto i = fVisAttributesModifiers.begin();
306 for (; i < fVisAttributesModifiers.end(); ++i) {
307 if (vam.GetPVNameCopyNoPath() == (*i).GetPVNameCopyNoPath() &&
308 vam.GetVisAttributesSignifier() == (*i).GetVisAttributesSignifier()) {
309 duplicateTarget = true;
310 break;
311 }
312 }
313 if (duplicateTarget) (*i).SetVisAttributes(vam.GetVisAttributes());
314 else fVisAttributesModifiers.push_back(vam);
315}
bool G4bool
Definition: G4Types.hh:86
const PVNameCopyNoPath & GetPVNameCopyNoPath() const
VisAttributesSignifier GetVisAttributesSignifier() const
const G4VisAttributes & GetVisAttributes() const

Referenced by G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerSave::SetNewValue(), G4VisCommandsViewerSet::SetNewValue(), G4VViewer::TouchableSetColour(), and G4VViewer::TouchableSetVisibility().

◆ CameraAndLightingCommands()

G4String G4ViewParameters::CameraAndLightingCommands ( const G4Point3D  standardTargetPoint) const

Definition at line 317 of file G4ViewParameters.cc.

319{
320 std::ostringstream oss;
321
322 oss << "#\n# Camera and lights commands";
323
324 oss << "\n/vis/viewer/set/viewpointVector "
325 << fViewpointDirection.x()
326 << ' ' << fViewpointDirection.y()
327 << ' ' << fViewpointDirection.z();
328
329 oss << "\n/vis/viewer/set/upVector "
330 << fUpVector.x()
331 << ' ' << fUpVector.y()
332 << ' ' << fUpVector.z();
333
334 oss << "\n/vis/viewer/set/projection ";
335 if (fFieldHalfAngle == 0.) {
336 oss
337 << "orthogonal";
338 } else {
339 oss
340 << "perspective "
341 << fFieldHalfAngle/deg
342 << " deg";
343 }
344
345 oss << "\n/vis/viewer/zoomTo "
346 << fZoomFactor;
347
348 oss << "\n/vis/viewer/scaleTo "
349 << fScaleFactor.x()
350 << ' ' << fScaleFactor.y()
351 << ' ' << fScaleFactor.z();
352
353 oss << "\n/vis/viewer/set/targetPoint "
354 << G4BestUnit(standardTargetPoint+fCurrentTargetPoint,"Length")
355 << "\n# Note that if you have not set a target point, the vis system sets"
356 << "\n# a target point based on the scene - plus any panning and dollying -"
357 << "\n# so don't be alarmed by strange coordinates here.";
358
359 oss << "\n/vis/viewer/dollyTo "
360 << G4BestUnit(fDolly,"Length");
361
362 oss << "\n/vis/viewer/set/lightsMove ";
363 if (fLightsMoveWithCamera) {
364 oss << "camera";
365 } else {
366 oss << "object";
367 }
368
369 oss << "\n/vis/viewer/set/lightsVector "
370 << fRelativeLightpointDirection.x()
371 << ' ' << fRelativeLightpointDirection.y()
372 << ' ' << fRelativeLightpointDirection.z();
373
374 oss << "\n/vis/viewer/set/rotationStyle ";
375 if (fRotationStyle == constrainUpDirection) {
376 oss << "constrainUpDirection";
377 } else {
378 oss << "freeRotation";
379 }
380
381 G4Colour c = fBackgroundColour;
382 oss << "\n/vis/viewer/set/background "
383 << c.GetRed()
384 << ' ' << c.GetGreen()
385 << ' ' << c.GetBlue()
386 << ' ' << c.GetAlpha();
387
388 c = fDefaultVisAttributes.GetColour();
389 oss << "\n/vis/viewer/set/defaultColour "
390 << c.GetRed()
391 << ' ' << c.GetGreen()
392 << ' ' << c.GetBlue()
393 << ' ' << c.GetAlpha();
394
395 c = fDefaultTextVisAttributes.GetColour();
396 oss << "\n/vis/viewer/set/defaultTextColour "
397 << c.GetRed()
398 << ' ' << c.GetGreen()
399 << ' ' << c.GetBlue()
400 << ' ' << c.GetAlpha();
401
402 oss << std::endl;
403
404 return oss.str();
405}
#define G4BestUnit(a, b)
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetAlpha() const
Definition: G4Colour.hh:155
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153
const G4Colour & GetColour() const

◆ CatmullRomCubicSplineInterpolation()

G4ViewParameters * G4ViewParameters::CatmullRomCubicSplineInterpolation ( const std::vector< G4ViewParameters > &  views,
G4int  nInterpolationPoints = 50 
)
static

Definition at line 1445 of file G4ViewParameters.cc.

1448{
1449 // Returns a null pointer when no more to be done. For example:
1450 // do {
1451 // G4ViewParameters* vp =
1452 // G4ViewParameters::CatmullRomCubicSplineInterpolation(viewVector,nInterpolationPoints);
1453 // if (!vp) break;
1454 // ...
1455 // } while (true);
1456
1457 // See https://en.wikipedia.org/wiki/Cubic_Hermite_spline
1458
1459 // Assumes equal intervals
1460
1461 if (views.size() < 2) {
1463 ("G4ViewParameters::CatmullRomCubicSplineInterpolation",
1464 "visman0301", JustWarning,
1465 "There must be at least two views.");
1466 return 0;
1467 }
1468
1469 if (nInterpolationPoints < 1) {
1471 ("G4ViewParameters::CatmullRomCubicSplineInterpolation",
1472 "visman0302", JustWarning,
1473 "Number of interpolation points cannot be zero or negative.");
1474 return 0;
1475 }
1476
1477 const size_t nIntervals = views.size() - 1;
1478 const G4double dt = 1./nInterpolationPoints;
1479
1480 static G4ViewParameters holdingValues;
1481 static G4double t = 0.; // 0. <= t <= 1.
1482 static G4int iInterpolationPoint = 0;
1483 static size_t iInterval = 0;
1484
1485// G4cout << "Interval " << iInterval << ", t = " << t << G4endl;
1486
1487 // Hermite polynomials.
1488 const G4double h00 = 2.*t*t*t - 3.*t*t +1;
1489 const G4double h10 = t*t*t -2.*t*t + t;
1490 const G4double h01 = -2.*t*t*t + 3.*t*t;
1491 const G4double h11 = t*t*t - t*t;
1492
1493 // Aliases (to simplify code)
1494 const size_t& n = nIntervals;
1495 size_t& i = iInterval;
1496 const std::vector<G4ViewParameters>& v = views;
1497
1498 // The Catmull-Rom cubic spline prescription is as follows:
1499 // Slope at first way point is v[1] - v[0].
1500 // Slope at last way point is v[n] - v[n-1].
1501 // Otherwise slope at way point i is 0.5*(v[i+1] - v[i-1]).
1502 // Result = h00*v[i] + h10*m[i] + h01*v[i+1] + h11*m[i+1],
1503 // where m[i] amd m[i+1] are the slopes at the start and end
1504 // of the interval for the particular value.
1505 // If (n == 1), linear interpolation results.
1506 // If (n == 2), quadratic interpolation results.
1507
1508 // Working variables
1509 G4double mi, mi1, real, x, y, z;
1510
1511 // First, a crude interpolation of all parameters. Then, below, a
1512 // smooth interpolation of those for which it makes sense.
1513 holdingValues = t < 0.5? v[i]: v[i+1];
1514
1515 // Catmull-Rom cubic spline interpolation
1516#define INTERPOLATE(param) \
1517/* This works out the interpolated param in i'th interval */ \
1518/* Assumes n >= 1 */ \
1519if (i == 0) { \
1520/* First interval */ \
1521mi = v[1].param - v[0].param; \
1522/* If there is only one interval, make start and end slopes equal */ \
1523/* (This results in a linear interpolation) */ \
1524if (n == 1) mi1 = mi; \
1525/* else the end slope of the interval takes account of the next waypoint along */ \
1526else mi1 = 0.5 * (v[2].param - v[0].param); \
1527} else if (i >= n - 1) { \
1528/* Similarly for last interval */ \
1529mi1 = v[i+1].param - v[i].param; \
1530/* If there is only one interval, make start and end slopes equal */ \
1531if (n == 1) mi = mi1; \
1532/* else the start slope of the interval takes account of the previous waypoint */ \
1533else mi = 0.5 * (v[i+1].param - v[i-1].param); \
1534} else { \
1535/* Full Catmull-Rom slopes use previous AND next waypoints */ \
1536mi = 0.5 * (v[i+1].param - v[i-1].param); \
1537mi1 = 0.5 * (v[i+2].param - v[i ].param); \
1538} \
1539real = h00 * v[i].param + h10 * mi + h01 * v[i+1].param + h11 * mi1;
1540
1541#define INTERPOLATELOG(param) \
1542if (i == 0) { \
1543mi = std::log(v[1].param) - std::log(v[0].param); \
1544if (n == 1) mi1 = mi; \
1545else mi1 = 0.5 * (std::log(v[2].param) - std::log(v[0].param)); \
1546} else if (i >= n - 1) { \
1547mi1 = std::log(v[i+1].param) - std::log(v[i].param); \
1548if (n == 1) mi = mi1; \
1549else mi = 0.5 * (std::log(v[i+1].param) - std::log(v[i-1].param)); \
1550} else { \
1551mi = 0.5 * (std::log(v[i+1].param) - std::log(v[i-1].param)); \
1552mi1 = 0.5 * (std::log(v[i+2].param) - std::log(v[i ].param)); \
1553} \
1554real = std::exp(h00 * std::log(v[i].param) + h10 * mi + h01 * std::log(v[i+1].param) + h11 * mi1);
1555
1556 // Real parameters
1557 INTERPOLATE(fVisibleDensity);
1558 if (real < 0.) real = 0.;
1559 holdingValues.fVisibleDensity = real;
1560 INTERPOLATELOG(fExplodeFactor);
1561 holdingValues.fExplodeFactor = real;
1562 INTERPOLATE(fFieldHalfAngle);
1563 if (real < 0.) real = 0.;
1564 holdingValues.fFieldHalfAngle = real;
1565 INTERPOLATELOG(fZoomFactor);
1566 holdingValues.fZoomFactor = real;
1567 INTERPOLATE(fDolly);
1568 holdingValues.fDolly = real;
1569 INTERPOLATE(fGlobalMarkerScale);
1570 if (real < 0.) real = 0.;
1571 holdingValues.fGlobalMarkerScale = real;
1572 INTERPOLATE(fGlobalLineWidthScale);
1573 if (real < 0.) real = 0.;
1574 holdingValues.fGlobalLineWidthScale = real;
1575
1576 // Unit vectors
1577#define INTERPOLATEUNITVECTOR(vector) \
1578INTERPOLATE(vector.x()); x = real; \
1579INTERPOLATE(vector.y()); y = real; \
1580INTERPOLATE(vector.z()); z = real;
1581 INTERPOLATEUNITVECTOR(fViewpointDirection);
1582 holdingValues.fViewpointDirection = G4Vector3D(x,y,z).unit();
1583 INTERPOLATEUNITVECTOR(fUpVector);
1584 holdingValues.fUpVector = G4Vector3D(x,y,z).unit();
1585 INTERPOLATEUNITVECTOR(fRelativeLightpointDirection);
1586 holdingValues.fRelativeLightpointDirection = G4Vector3D(x,y,z).unit();
1587 INTERPOLATEUNITVECTOR(fActualLightpointDirection);
1588 holdingValues.fActualLightpointDirection = G4Vector3D(x,y,z).unit();
1589
1590 // Un-normalised vectors
1591#define INTERPOLATEVECTOR(vector) \
1592INTERPOLATE(vector.x()); x = real; \
1593INTERPOLATE(vector.y()); y = real; \
1594INTERPOLATE(vector.z()); z = real;
1595 INTERPOLATEVECTOR(fScaleFactor);
1596 holdingValues.fScaleFactor = G4Vector3D(x,y,z);
1597
1598 // Points
1599#define INTERPOLATEPOINT(point) \
1600INTERPOLATE(point.x()); x = real; \
1601INTERPOLATE(point.y()); y = real; \
1602INTERPOLATE(point.z()); z = real;
1603 INTERPOLATEPOINT(fExplodeCentre);
1604 holdingValues.fExplodeCentre = G4Point3D(x,y,z);
1605 INTERPOLATEPOINT(fCurrentTargetPoint);
1606 holdingValues.fCurrentTargetPoint = G4Point3D(x,y,z);
1607
1608 // Colour
1609 G4double red, green, blue, alpha;
1610#define INTERPOLATECOLOUR(colour) \
1611INTERPOLATE(colour.GetRed()); red = real; \
1612INTERPOLATE(colour.GetGreen()); green = real; \
1613INTERPOLATE(colour.GetBlue()); blue = real; \
1614INTERPOLATE(colour.GetAlpha()); alpha = real;
1615 INTERPOLATECOLOUR(fBackgroundColour);
1616 // Components are clamped to 0. <= component <= 1.
1617 holdingValues.fBackgroundColour = G4Colour(red,green,blue,alpha);
1618
1619 // For some parameters we need to check some continuity
1620 G4bool continuous;
1621#define CONTINUITY(quantity) \
1622 continuous = false; \
1623 /* This follows the logic of the INTERPOLATE macro above; see comments therein */ \
1624 if (i == 0) { \
1625 if (v[1].quantity == v[0].quantity) { \
1626 if (n == 1) continuous = true; \
1627 else if (v[2].quantity == v[0].quantity) \
1628 continuous = true; \
1629 } \
1630 } else if (i >= n - 1) { \
1631 if (v[i+1].quantity == v[i].quantity) { \
1632 if (n == 1) continuous = true; \
1633 else if (v[i+1].quantity == v[i-1].quantity) \
1634 continuous = true; \
1635 } \
1636 } else { \
1637 if (v[i-1].quantity == v[i].quantity && \
1638 v[i+1].quantity == v[i].quantity && \
1639 v[i+2].quantity == v[i].quantity) \
1640 continuous = true; \
1641 }
1642
1643 G4double a, b, c, d;
1644#define INTERPOLATEPLANE(plane) \
1645INTERPOLATE(plane.a()); a = real; \
1646INTERPOLATE(plane.b()); b = real; \
1647INTERPOLATE(plane.c()); c = real; \
1648INTERPOLATE(plane.d()); d = real;
1649
1650 // Section plane
1651 CONTINUITY(fSection);
1652 if (continuous) {
1653 INTERPOLATEPLANE(fSectionPlane);
1654 holdingValues.fSectionPlane = G4Plane3D(a,b,c,d);
1655 }
1656
1657 // Cutaway planes
1658 if (v[i].fCutawayPlanes.size()) {
1659 CONTINUITY(fCutawayPlanes.size());
1660 if (continuous) {
1661 for (size_t j = 0; j < v[i].fCutawayPlanes.size(); ++j) {
1662 INTERPOLATEPLANE(fCutawayPlanes[j]);
1663 holdingValues.fCutawayPlanes[j] = G4Plane3D(a,b,c,d);
1664 }
1665 }
1666 }
1667
1668 // Vis attributes modifiers
1669 // Really, we are only interested in colour - other attributes can follow
1670 // the "crude" interpolation that is guaranteed above.
1671 static G4VisAttributes workingVA;
1672 if (v[i].fVisAttributesModifiers.size()) {
1673 CONTINUITY(fVisAttributesModifiers.size());
1674 if (continuous) {
1675 for (size_t j = 0; j < v[i].fVisAttributesModifiers.size(); ++j) {
1676 CONTINUITY(fVisAttributesModifiers[j].GetPVNameCopyNoPath());
1677 if (continuous) {
1678 CONTINUITY(fVisAttributesModifiers[j].GetVisAttributesSignifier());
1679 if (continuous) {
1680 if (v[i].fVisAttributesModifiers[j].GetVisAttributesSignifier() ==
1682 INTERPOLATECOLOUR(fVisAttributesModifiers[j].GetVisAttributes().GetColour());
1683 workingVA = v[i].fVisAttributesModifiers[j].GetVisAttributes();
1684 workingVA.SetColour(G4Colour(red,green,blue,alpha));
1685 holdingValues.fVisAttributesModifiers[j].SetVisAttributes(workingVA);
1686 }
1687 }
1688 }
1689 }
1690 }
1691 }
1692
1693 // Time window parameters (for showing particles in flight)
1694 // Only two parameters are interpolated. The others are usually chosen
1695 // once and for all by the user for a given series of views - or at least,
1696 // if not, they will be interpolated by the default "crude" method above.
1697 INTERPOLATE(fStartTime)
1698 holdingValues.fStartTime = real;
1699 INTERPOLATE(fEndTime)
1700 holdingValues.fEndTime = real;
1701
1702 // Increment counters
1703 iInterpolationPoint++;
1704 t += dt;
1705 if (iInterpolationPoint > nInterpolationPoints) {
1706 iInterpolationPoint = 1; // Ready for next interval.
1707 t = dt;
1708 iInterval++;
1709 }
1710 if (iInterval >= nIntervals) {
1711 iInterpolationPoint = 0; // Ready for a complete restart.
1712 t = 0.;
1713 iInterval = 0;
1714 return 0;
1715 }
1716
1717 return &holdingValues;
1718}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
HepGeom::Plane3D< G4double > G4Plane3D
Definition: G4Plane3D.hh:34
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:34
#define INTERPOLATECOLOUR(colour)
#define INTERPOLATEVECTOR(vector)
#define INTERPOLATE(param)
#define INTERPOLATEPLANE(plane)
#define CONTINUITY(quantity)
#define INTERPOLATEPOINT(point)
#define INTERPOLATEUNITVECTOR(vector)
#define INTERPOLATELOG(param)
void SetColour(const G4Colour &)
BasicVector3D< T > unit() const

Referenced by G4VVisCommand::InterpolateViews().

◆ ChangeCutawayPlane()

void G4ViewParameters::ChangeCutawayPlane ( size_t  index,
const G4Plane3D cutawayPlane 
)

Definition at line 195 of file G4ViewParameters.cc.

196 {
197 if (index >= fCutawayPlanes.size()) {
198 G4warn <<
199 "ERROR: G4ViewParameters::ChangeCutawayPlane:"
200 "\n Plane " << index << " does not exist." << G4endl;
201 } else {
202 fCutawayPlanes[index] = cutawayPlane;
203 }
204}

Referenced by G4VisCommandViewerChangeCutawayPlane::SetNewValue().

◆ ClearCutawayPlanes()

void G4ViewParameters::ClearCutawayPlanes ( )

◆ ClearVisAttributesModifiers()

void G4ViewParameters::ClearVisAttributesModifiers ( )

◆ DrawingStyleCommands()

G4String G4ViewParameters::DrawingStyleCommands ( ) const

Definition at line 407 of file G4ViewParameters.cc.

408{
409 std::ostringstream oss;
410
411 oss << "#\n# Drawing style commands";
412
413 oss << "\n/vis/viewer/set/style ";
414 switch (fDrawingStyle) {
415 case wireframe:
416 case hlr:
417 oss << "wireframe";
418 break;
419 case hsr:
420 case hlhsr:
421 oss << "surface";
422 break;
423 case cloud:
424 oss << "cloud";
425 break;
426 }
427
428 oss << "\n/vis/viewer/set/hiddenEdge ";
429 if (fDrawingStyle == hlr || fDrawingStyle == hlhsr) {
430 oss << "true";
431 } else {
432 oss << "false";
433 }
434
435 oss << "\n/vis/viewer/set/auxiliaryEdge ";
436 if (fAuxEdgeVisible) {
437 oss << "true";
438 } else {
439 oss << "false";
440 }
441
442 oss << "\n/vis/viewer/set/hiddenMarker ";
443 if (fMarkerNotHidden) {
444 oss << "false";
445 } else {
446 oss << "true";
447 }
448
449 oss << "\n/vis/viewer/set/globalLineWidthScale "
450 << fGlobalLineWidthScale;
451
452 oss << "\n/vis/viewer/set/globalMarkerScale "
453 << fGlobalMarkerScale;
454
455 oss << "\n/vis/viewer/set/numberOfCloudPoints "
456 << fNumberOfCloudPoints;
457
458 oss << "\n/vis/viewer/set/specialMeshRendering ";
459 if (fSpecialMeshRendering) {
460 oss << "true";
461 } else {
462 oss << "false";
463 }
464
465 oss << "\n/vis/viewer/set/specialMeshRenderingOption "
466 << fSpecialMeshRenderingOption;
467
468 oss << "\n/vis/viewer/set/specialMeshVolumes";
469 for (const auto& volume : fSpecialMeshVolumes) {
470 oss << ' ' << volume.GetName() << ' ' << volume.GetCopyNo();
471 }
472
473 oss << std::endl;
474
475 return oss.str();
476}

◆ GetActualLightpointDirection()

G4Vector3D & G4ViewParameters::GetActualLightpointDirection ( )

Definition at line 131 of file G4ViewParameters.cc.

131 {
132 SetViewAndLights (fViewpointDirection);
133 return fActualLightpointDirection;
134}
void SetViewAndLights(const G4Vector3D &viewpointDirection)

Referenced by G4VisCommandsViewerSet::SetNewValue(), G4OpenGLViewer::SetView(), G4RayTracerViewer::SetView(), and G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView().

◆ GetBackgroundColour()

◆ GetCameraDistance()

G4double G4ViewParameters::GetCameraDistance ( G4double  radius) const

Definition at line 144 of file G4ViewParameters.cc.

144 {
145 G4double cameraDistance;
146 if (fFieldHalfAngle == 0.) {
147 cameraDistance = radius;
148 }
149 else {
150 cameraDistance = radius / std::sin (fFieldHalfAngle) - fDolly;
151 }
152 return cameraDistance;
153}

Referenced by G4OpenGLStoredViewer::DrawDisplayLists(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLViewer::SetView(), G4OpenInventorViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), and G4VtkViewer::SetView().

◆ GetCBDAlgorithmNumber()

◆ GetCBDParameters()

◆ GetCurrentTargetPoint()

◆ GetCutawayMode()

◆ GetCutawayPlanes()

◆ GetDefaultMarker()

const G4VMarker & G4ViewParameters::GetDefaultMarker ( ) const

◆ GetDefaultTextVisAttributes()

◆ GetDefaultVisAttributes()

◆ GetDisplayHeadTimeBlue()

G4double G4ViewParameters::GetDisplayHeadTimeBlue ( ) const

◆ GetDisplayHeadTimeGreen()

G4double G4ViewParameters::GetDisplayHeadTimeGreen ( ) const

◆ GetDisplayHeadTimeRed()

G4double G4ViewParameters::GetDisplayHeadTimeRed ( ) const

◆ GetDisplayHeadTimeSize()

G4double G4ViewParameters::GetDisplayHeadTimeSize ( ) const

◆ GetDisplayHeadTimeX()

G4double G4ViewParameters::GetDisplayHeadTimeX ( ) const

◆ GetDisplayHeadTimeY()

G4double G4ViewParameters::GetDisplayHeadTimeY ( ) const

◆ GetDisplayLightFrontBlue()

G4double G4ViewParameters::GetDisplayLightFrontBlue ( ) const

◆ GetDisplayLightFrontGreen()

G4double G4ViewParameters::GetDisplayLightFrontGreen ( ) const

◆ GetDisplayLightFrontRed()

G4double G4ViewParameters::GetDisplayLightFrontRed ( ) const

◆ GetDisplayLightFrontT()

G4double G4ViewParameters::GetDisplayLightFrontT ( ) const

◆ GetDisplayLightFrontX()

G4double G4ViewParameters::GetDisplayLightFrontX ( ) const

◆ GetDisplayLightFrontY()

G4double G4ViewParameters::GetDisplayLightFrontY ( ) const

◆ GetDisplayLightFrontZ()

G4double G4ViewParameters::GetDisplayLightFrontZ ( ) const

◆ GetDolly()

◆ GetDrawingStyle()

◆ GetEndTime()

G4double G4ViewParameters::GetEndTime ( ) const

◆ GetExplodeCentre()

const G4Point3D & G4ViewParameters::GetExplodeCentre ( ) const

◆ GetExplodeFactor()

◆ GetFadeFactor()

G4double G4ViewParameters::GetFadeFactor ( ) const

◆ GetFarDistance()

G4double G4ViewParameters::GetFarDistance ( G4double  cameraDistance,
G4double  nearDistance,
G4double  radius 
) const

Definition at line 163 of file G4ViewParameters.cc.

165 {
166 G4double farDistance = cameraDistance + radius;
167 if (farDistance < nearDistance) farDistance = nearDistance;
168 return farDistance;
169}

Referenced by G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::SetView(), G4Qt3DViewer::SetView(), and G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView().

◆ GetFieldHalfAngle()

◆ GetFrontHalfHeight()

G4double G4ViewParameters::GetFrontHalfHeight ( G4double  nearDistance,
G4double  radius 
) const

Definition at line 171 of file G4ViewParameters.cc.

172 {
173 G4double frontHalfHeight;
174 if (fFieldHalfAngle == 0.) {
175 frontHalfHeight = radius / fZoomFactor;
176 }
177 else {
178 frontHalfHeight = nearDistance * std::tan (fFieldHalfAngle) / fZoomFactor;
179 }
180 return frontHalfHeight;
181}

Referenced by G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), and G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView().

◆ GetGlobalLineWidthScale()

◆ GetGlobalMarkerScale()

◆ GetLightpointDirection()

◆ GetLightsMoveWithCamera()

◆ GetNearDistance()

G4double G4ViewParameters::GetNearDistance ( G4double  cameraDistance,
G4double  radius 
) const

Definition at line 155 of file G4ViewParameters.cc.

156 {
157 const G4double small = 1.e-6 * radius;
158 G4double nearDistance = cameraDistance - radius;
159 if (nearDistance < small) nearDistance = small;
160 return nearDistance;
161}

Referenced by G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), and G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView().

◆ GetNoOfSides()

◆ GetNumberOfCloudPoints()

◆ GetRotationStyle()

◆ GetScaleFactor()

◆ GetSectionPlane()

◆ GetSpecialMeshRenderingOption()

◆ GetSpecialMeshVolumes()

◆ GetStartTime()

G4double G4ViewParameters::GetStartTime ( ) const

◆ GetUpVector()

◆ GetViewpointDirection()

◆ GetVisAttributesModifiers()

◆ GetVisibleDensity()

◆ GetWindowAbsoluteLocationHintX()

G4int G4ViewParameters::GetWindowAbsoluteLocationHintX ( G4int  sizeX) const

Definition at line 1301 of file G4ViewParameters.cc.

1301 {
1302 if ( fWindowLocationHintXNegative ) {
1303 return sizeX + fWindowLocationHintX - fWindowSizeHintX;
1304 }
1305 return fWindowLocationHintX;
1306}

Referenced by G4OpenGLWin32Viewer::CreateMainWindow(), G4OpenGLXmViewer::CreateMainWindow(), G4OpenGLXViewer::CreateMainWindow(), G4OpenGLQtViewer::CreateMainWindow(), G4ToolsSGOffscreenViewer::Initialise(), and G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Initialise().

◆ GetWindowAbsoluteLocationHintY()

G4int G4ViewParameters::GetWindowAbsoluteLocationHintY ( G4int  sizeY) const

Definition at line 1308 of file G4ViewParameters.cc.

1308 {
1309 if ( fWindowLocationHintYNegative ) {
1310 return sizeY + fWindowLocationHintY - fWindowSizeHintY;
1311 }
1312 return fWindowLocationHintY;
1313}

Referenced by G4OpenGLWin32Viewer::CreateMainWindow(), G4OpenGLXmViewer::CreateMainWindow(), G4OpenGLXViewer::CreateMainWindow(), G4OpenGLQtViewer::CreateMainWindow(), G4ToolsSGOffscreenViewer::Initialise(), and G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Initialise().

◆ GetWindowLocationHintX()

G4int G4ViewParameters::GetWindowLocationHintX ( ) const

Referenced by G4VtkViewer::Initialise().

◆ GetWindowLocationHintY()

G4int G4ViewParameters::GetWindowLocationHintY ( ) const

Referenced by G4VtkViewer::Initialise().

◆ GetWindowSizeHintX()

◆ GetWindowSizeHintY()

◆ GetXGeometryString()

◆ GetZoomFactor()

◆ IncrementDolly()

void G4ViewParameters::IncrementDolly ( G4double  dollyIncrement)

◆ IncrementPan() [1/2]

void G4ViewParameters::IncrementPan ( G4double  right,
G4double  up 
)

◆ IncrementPan() [2/2]

void G4ViewParameters::IncrementPan ( G4double  right,
G4double  up,
G4double  forward 
)

Definition at line 295 of file G4ViewParameters.cc.

295 {
296 G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
297 G4Vector3D unitUp = (fViewpointDirection.cross (unitRight)).unit();
298 fCurrentTargetPoint += right * unitRight + up * unitUp + distance * fViewpointDirection;
299}
BasicVector3D< T > cross(const BasicVector3D< T > &v) const

◆ IsAutoRefresh()

◆ IsAuxEdgeVisible()

◆ IsCulling()

◆ IsCullingCovered()

◆ IsCullingInvisible()

◆ IsCutaway()

◆ IsDensityCulling()

◆ IsDisplayHeadTime()

G4bool G4ViewParameters::IsDisplayHeadTime ( ) const

◆ IsDisplayLightFront()

G4bool G4ViewParameters::IsDisplayLightFront ( ) const

◆ IsExplode()

◆ IsMarkerNotHidden()

◆ IsPicking()

◆ IsSection()

◆ IsSpecialMeshRendering()

◆ IsWindowLocationHintX()

bool G4ViewParameters::IsWindowLocationHintX ( ) const

◆ IsWindowLocationHintXNegative()

G4bool G4ViewParameters::IsWindowLocationHintXNegative ( ) const

Referenced by G4VtkViewer::Initialise().

◆ IsWindowLocationHintY()

bool G4ViewParameters::IsWindowLocationHintY ( ) const

◆ IsWindowLocationHintYNegative()

G4bool G4ViewParameters::IsWindowLocationHintYNegative ( ) const

Referenced by G4VtkViewer::Initialise().

◆ IsWindowSizeHintX()

bool G4ViewParameters::IsWindowSizeHintX ( ) const

◆ IsWindowSizeHintY()

bool G4ViewParameters::IsWindowSizeHintY ( ) const

◆ MultiplyScaleFactor()

void G4ViewParameters::MultiplyScaleFactor ( const G4Vector3D scaleFactorMultiplier)

Definition at line 124 of file G4ViewParameters.cc.

125 {
126 fScaleFactor.setX(fScaleFactor.x() * scaleFactorMultiplier.x());
127 fScaleFactor.setY(fScaleFactor.y() * scaleFactorMultiplier.y());
128 fScaleFactor.setZ(fScaleFactor.z() * scaleFactorMultiplier.z());
129}

Referenced by G4VisCommandViewerScale::SetNewValue().

◆ MultiplyZoomFactor()

void G4ViewParameters::MultiplyZoomFactor ( G4double  zoomFactorMultiplier)

◆ operator!=()

G4bool G4ViewParameters::operator!= ( const G4ViewParameters v) const

Definition at line 1100 of file G4ViewParameters.cc.

1100 {
1101
1102 // Put performance-sensitive parameters first.
1103 if (
1104 // This first to optimise spin, etc.
1105 (fViewpointDirection != v.fViewpointDirection) ||
1106
1107 // No particular order from here on.
1108 (fDrawingStyle != v.fDrawingStyle) ||
1109 (fNumberOfCloudPoints != v.fNumberOfCloudPoints) ||
1110 (fAuxEdgeVisible != v.fAuxEdgeVisible) ||
1111 (fCulling != v.fCulling) ||
1112 (fCullInvisible != v.fCullInvisible) ||
1113 (fDensityCulling != v.fDensityCulling) ||
1114 (fCullCovered != v.fCullCovered) ||
1115 (fCBDAlgorithmNumber != v.fCBDAlgorithmNumber) ||
1116 (fSection != v.fSection) ||
1117 (IsCutaway() != v.IsCutaway()) ||
1118 (IsExplode() != v.IsExplode()) ||
1119 (fNoOfSides != v.fNoOfSides) ||
1120 (fUpVector != v.fUpVector) ||
1121 (fFieldHalfAngle != v.fFieldHalfAngle) ||
1122 (fZoomFactor != v.fZoomFactor) ||
1123 (fScaleFactor != v.fScaleFactor) ||
1124 (fCurrentTargetPoint != v.fCurrentTargetPoint) ||
1125 (fDolly != v.fDolly) ||
1126 (fRelativeLightpointDirection != v.fRelativeLightpointDirection) ||
1127 (fLightsMoveWithCamera != v.fLightsMoveWithCamera) ||
1128 (fDefaultVisAttributes != v.fDefaultVisAttributes) ||
1129 (fDefaultTextVisAttributes != v.fDefaultTextVisAttributes) ||
1130 (fDefaultMarker != v.fDefaultMarker) ||
1131 (fGlobalMarkerScale != v.fGlobalMarkerScale) ||
1132 (fGlobalLineWidthScale != v.fGlobalLineWidthScale) ||
1133 (fMarkerNotHidden != v.fMarkerNotHidden) ||
1134 (fWindowSizeHintX != v.fWindowSizeHintX) ||
1135 (fWindowSizeHintY != v.fWindowSizeHintY) ||
1136 (fXGeometryString != v.fXGeometryString) ||
1137 (fGeometryMask != v.fGeometryMask) ||
1138 (fAutoRefresh != v.fAutoRefresh) ||
1139 (fBackgroundColour != v.fBackgroundColour) ||
1140 (fPicking != v.fPicking) ||
1141 (fRotationStyle != v.fRotationStyle) ||
1142 (fSpecialMeshRendering != v.fSpecialMeshRendering) ||
1143 (fSpecialMeshRenderingOption != v.fSpecialMeshRenderingOption)
1144 )
1145 return true;
1146
1147 if (fDensityCulling &&
1148 (fVisibleDensity != v.fVisibleDensity)) return true;
1149
1150 if (fCBDAlgorithmNumber > 0) {
1151 if (fCBDParameters.size() != v.fCBDParameters.size()) return true;
1152 else if (fCBDParameters != v.fCBDParameters) return true;
1153 }
1154
1155 if (fSection &&
1156 (!(fSectionPlane == v.fSectionPlane))) return true;
1157
1158 if (IsCutaway()) {
1159 if (fCutawayPlanes.size () != v.fCutawayPlanes.size ())
1160 return true;
1161 else {
1162 for (size_t i = 0; i < fCutawayPlanes.size (); i++) {
1163 if (!(fCutawayPlanes[i] == v.fCutawayPlanes[i])) return true;
1164 }
1165 }
1166 }
1167
1168 if (IsExplode() &&
1169 ((fExplodeFactor != v.fExplodeFactor) ||
1170 (fExplodeCentre != v.fExplodeCentre))) return true;
1171
1172 if (fVisAttributesModifiers != v.fVisAttributesModifiers) return true;
1173
1174 if (fStartTime != v.fStartTime ||
1175 fEndTime != v.fEndTime ||
1176 fFadeFactor != v.fFadeFactor) return true;
1177
1178 if (fDisplayHeadTime != v.fDisplayHeadTime) return true;
1179 if (fDisplayHeadTime) {
1180 if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
1181 fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
1182 fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
1183 fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
1184 fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
1185 fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
1186 return true;
1187 }
1188 }
1189
1190 if (fDisplayLightFront != v.fDisplayLightFront) return true;
1191 if (fDisplayLightFront) {
1192 if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
1193 fDisplayLightFrontY != v.fDisplayLightFrontY ||
1194 fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
1195 fDisplayLightFrontT != v.fDisplayLightFrontT ||
1196 fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
1197 fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
1198 fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
1199 return true;
1200 }
1201 }
1202
1203 if (fSpecialMeshRendering) {
1204 if (fSpecialMeshVolumes != v.fSpecialMeshVolumes)
1205 return true;;
1206 }
1207
1208 return false;
1209}
G4bool IsCutaway() const
G4bool IsExplode() const

◆ PrintDifferences()

void G4ViewParameters::PrintDifferences ( const G4ViewParameters v) const

Definition at line 759 of file G4ViewParameters.cc.

759 {
760
761 // Put performance-sensitive parameters first.
762 if (
763 // This first to optimise spin, etc.
764 (fViewpointDirection != v.fViewpointDirection) ||
765
766 // No particular order from here on.
767 (fDrawingStyle != v.fDrawingStyle) ||
768 (fNumberOfCloudPoints != v.fNumberOfCloudPoints) ||
769 (fAuxEdgeVisible != v.fAuxEdgeVisible) ||
770 (fCulling != v.fCulling) ||
771 (fCullInvisible != v.fCullInvisible) ||
772 (fDensityCulling != v.fDensityCulling) ||
773 (fVisibleDensity != v.fVisibleDensity) ||
774 (fCullCovered != v.fCullCovered) ||
775 (fCBDAlgorithmNumber != v.fCBDAlgorithmNumber) ||
776 (fSection != v.fSection) ||
777 (fNoOfSides != v.fNoOfSides) ||
778 (fUpVector != v.fUpVector) ||
779 (fFieldHalfAngle != v.fFieldHalfAngle) ||
780 (fZoomFactor != v.fZoomFactor) ||
781 (fScaleFactor != v.fScaleFactor) ||
782 (fCurrentTargetPoint != v.fCurrentTargetPoint) ||
783 (fDolly != v.fDolly) ||
784 (fRelativeLightpointDirection != v.fRelativeLightpointDirection) ||
785 (fLightsMoveWithCamera != v.fLightsMoveWithCamera) ||
786 (fDefaultVisAttributes != v.fDefaultVisAttributes) ||
787 (fDefaultTextVisAttributes != v.fDefaultTextVisAttributes) ||
788 (fDefaultMarker != v.fDefaultMarker) ||
789 (fGlobalMarkerScale != v.fGlobalMarkerScale) ||
790 (fGlobalLineWidthScale != v.fGlobalLineWidthScale) ||
791 (fMarkerNotHidden != v.fMarkerNotHidden) ||
792 (fWindowSizeHintX != v.fWindowSizeHintX) ||
793 (fWindowSizeHintY != v.fWindowSizeHintY) ||
794 (fXGeometryString != v.fXGeometryString) ||
795 (fGeometryMask != v.fGeometryMask) ||
796 (fAutoRefresh != v.fAutoRefresh) ||
797 (fBackgroundColour != v.fBackgroundColour) ||
798 (fPicking != v.fPicking) ||
799 (fRotationStyle != v.fRotationStyle)
800 )
801 G4cout << "Difference in 1st batch." << G4endl;
802
803 if (fCBDAlgorithmNumber > 0) {
804 if (fCBDParameters.size() != v.fCBDParameters.size()) {
805 G4cout << "Difference in number of colour by density parameters." << G4endl;
806 } else if (fCBDParameters != v.fCBDParameters) {
807 G4cout << "Difference in values of colour by density parameters." << G4endl;
808 }
809 }
810
811 if (fSection) {
812 if (!(fSectionPlane == v.fSectionPlane))
813 G4cout << "Difference in section planes batch." << G4endl;
814 }
815
816 if (IsCutaway()) {
817 if (fCutawayPlanes.size () != v.fCutawayPlanes.size ()) {
818 G4cout << "Difference in no of cutaway planes." << G4endl;
819 }
820 else {
821 for (size_t i = 0; i < fCutawayPlanes.size (); i++) {
822 if (!(fCutawayPlanes[i] == v.fCutawayPlanes[i]))
823 G4cout << "Difference in cutaway plane no. " << i << G4endl;
824 }
825 }
826 }
827
828 if (IsExplode()) {
829 if (fExplodeFactor != v.fExplodeFactor)
830 G4cout << "Difference in explode factor." << G4endl;
831 if (fExplodeCentre != v.fExplodeCentre)
832 G4cout << "Difference in explode centre." << G4endl;
833 }
834
835 if (fVisAttributesModifiers != v.fVisAttributesModifiers) {
836 G4cout << "Difference in vis attributes modifiers." << G4endl;
837 }
838
839 if (fStartTime != v.fStartTime ||
840 fEndTime != v.fEndTime) {
841 G4cout << "Difference in time window." << G4endl;
842 }
843
844 if (fFadeFactor != v.fFadeFactor) {
845 G4cout << "Difference in time window fade factor." << G4endl;
846 }
847
848 if (fDisplayHeadTime != v.fDisplayHeadTime) {
849 G4cout << "Difference in display head time flag." << G4endl;
850 } else {
851 if (fDisplayHeadTimeX != v.fDisplayHeadTimeX ||
852 fDisplayHeadTimeY != v.fDisplayHeadTimeY ||
853 fDisplayHeadTimeSize != v.fDisplayHeadTimeSize ||
854 fDisplayHeadTimeRed != v.fDisplayHeadTimeRed ||
855 fDisplayHeadTimeGreen != v.fDisplayHeadTimeGreen ||
856 fDisplayHeadTimeBlue != v.fDisplayHeadTimeBlue) {
857 G4cout << "Difference in display head time parameters." << G4endl;
858 }
859 }
860
861 if (fDisplayLightFront != v.fDisplayLightFront) {
862 G4cout << "Difference in display light front flag." << G4endl;
863 } else {
864 if (fDisplayLightFrontX != v.fDisplayLightFrontX ||
865 fDisplayLightFrontY != v.fDisplayLightFrontY ||
866 fDisplayLightFrontZ != v.fDisplayLightFrontZ ||
867 fDisplayLightFrontT != v.fDisplayLightFrontT ||
868 fDisplayLightFrontRed != v.fDisplayLightFrontRed ||
869 fDisplayLightFrontGreen != v.fDisplayLightFrontGreen ||
870 fDisplayLightFrontBlue != v.fDisplayLightFrontBlue) {
871 G4cout << "Difference in display light front parameters." << G4endl;
872 }
873 }
874}
G4GLOB_DLL std::ostream G4cout

◆ SceneModifyingCommands()

G4String G4ViewParameters::SceneModifyingCommands ( ) const

Definition at line 478 of file G4ViewParameters.cc.

479{
480 std::ostringstream oss;
481
482 oss << "#\n# Scene-modifying commands";
483
484 oss << "\n/vis/viewer/set/culling global ";
485 if (fCulling) {
486 oss << "true";
487 } else {
488 oss << "false";
489 }
490
491 oss << "\n/vis/viewer/set/culling invisible ";
492 if (fCullInvisible) {
493 oss << "true";
494 } else {
495 oss << "false";
496 }
497
498 oss << "\n/vis/viewer/set/culling density ";
499 if (fDensityCulling) {
500 oss << "true " << fVisibleDensity/(g/cm3) << " g/cm3";
501 } else {
502 oss << "false";
503 }
504
505 oss << "\n/vis/viewer/set/culling coveredDaughters ";
506 if (fCullCovered) {
507 oss << "true";
508 } else {
509 oss << "false";
510 }
511
512 oss << "\n/vis/viewer/colourByDensity "
513 << fCBDAlgorithmNumber << " g/cm3";
514 for (auto p: fCBDParameters) {
515 oss << ' ' << p/(g/cm3);
516 }
517
518 oss << "\n/vis/viewer/set/sectionPlane ";
519 if (fSection) {
520 oss << "on "
521 << G4BestUnit(fSectionPlane.point(),"Length")
522 << fSectionPlane.normal().x()
523 << ' ' << fSectionPlane.normal().y()
524 << ' ' << fSectionPlane.normal().z();
525 } else {
526 oss << "off";
527 }
528
529 oss << "\n/vis/viewer/set/cutawayMode ";
530 if (fCutawayMode == cutawayUnion) {
531 oss << "union";
532 } else {
533 oss << "intersection";
534 }
535
536 oss << "\n/vis/viewer/clearCutawayPlanes";
537 if (fCutawayPlanes.size()) {
538 for (size_t i = 0; i < fCutawayPlanes.size(); i++) {
539 oss << "\n/vis/viewer/addCutawayPlane "
540 << G4BestUnit(fCutawayPlanes[i].point(),"Length")
541 << fCutawayPlanes[i].normal().x()
542 << ' ' << fCutawayPlanes[i].normal().y()
543 << ' ' << fCutawayPlanes[i].normal().z();
544 }
545 } else {
546 oss << "\n# No cutaway planes defined.";
547 }
548
549 oss << "\n/vis/viewer/set/explodeFactor "
550 << fExplodeFactor
551 << ' ' << G4BestUnit(fExplodeCentre,"Length");
552
553 oss << "\n/vis/viewer/set/lineSegmentsPerCircle "
554 << fNoOfSides;
555
556 oss << std::endl;
557
558 return oss.str();
559}
Point3D< T > point(const Point3D< T > &p) const
Definition: Plane3D.h:115
Normal3D< T > normal() const
Definition: Plane3D.h:97

◆ SetAutoRefresh()

◆ SetAuxEdgeVisible()

◆ SetBackgroundColour()

void G4ViewParameters::SetBackgroundColour ( const G4Colour )

◆ SetCBDAlgorithmNumber()

void G4ViewParameters::SetCBDAlgorithmNumber ( G4int  )

◆ SetCBDParameters()

void G4ViewParameters::SetCBDParameters ( const std::vector< G4double > &  )

◆ SetCulling()

◆ SetCullingCovered()

void G4ViewParameters::SetCullingCovered ( G4bool  )

◆ SetCullingInvisible()

void G4ViewParameters::SetCullingInvisible ( G4bool  )

◆ SetCurrentTargetPoint()

◆ SetCutawayMode()

void G4ViewParameters::SetCutawayMode ( CutawayMode  )

◆ SetDefaultColour()

void G4ViewParameters::SetDefaultColour ( const G4Colour )

◆ SetDefaultMarker()

void G4ViewParameters::SetDefaultMarker ( const G4VMarker defaultMarker)

◆ SetDefaultTextColour()

void G4ViewParameters::SetDefaultTextColour ( const G4Colour )

◆ SetDefaultTextVisAttributes()

void G4ViewParameters::SetDefaultTextVisAttributes ( const G4VisAttributes )

◆ SetDefaultVisAttributes()

void G4ViewParameters::SetDefaultVisAttributes ( const G4VisAttributes )

◆ SetDensityCulling()

void G4ViewParameters::SetDensityCulling ( G4bool  )

◆ SetDisplayHeadTime()

void G4ViewParameters::SetDisplayHeadTime ( G4bool  )

◆ SetDisplayHeadTimeBlue()

void G4ViewParameters::SetDisplayHeadTimeBlue ( G4double  )

◆ SetDisplayHeadTimeGreen()

void G4ViewParameters::SetDisplayHeadTimeGreen ( G4double  )

◆ SetDisplayHeadTimeRed()

void G4ViewParameters::SetDisplayHeadTimeRed ( G4double  )

◆ SetDisplayHeadTimeSize()

void G4ViewParameters::SetDisplayHeadTimeSize ( G4double  )

◆ SetDisplayHeadTimeX()

void G4ViewParameters::SetDisplayHeadTimeX ( G4double  )

◆ SetDisplayHeadTimeY()

void G4ViewParameters::SetDisplayHeadTimeY ( G4double  )

◆ SetDisplayLightFront()

void G4ViewParameters::SetDisplayLightFront ( G4bool  )

◆ SetDisplayLightFrontBlue()

void G4ViewParameters::SetDisplayLightFrontBlue ( G4double  )

◆ SetDisplayLightFrontGreen()

void G4ViewParameters::SetDisplayLightFrontGreen ( G4double  )

◆ SetDisplayLightFrontRed()

void G4ViewParameters::SetDisplayLightFrontRed ( G4double  )

◆ SetDisplayLightFrontT()

void G4ViewParameters::SetDisplayLightFrontT ( G4double  )

◆ SetDisplayLightFrontX()

void G4ViewParameters::SetDisplayLightFrontX ( G4double  )

◆ SetDisplayLightFrontY()

void G4ViewParameters::SetDisplayLightFrontY ( G4double  )

◆ SetDisplayLightFrontZ()

void G4ViewParameters::SetDisplayLightFrontZ ( G4double  )

◆ SetDolly()

◆ SetDrawingStyle()

◆ SetEndTime()

void G4ViewParameters::SetEndTime ( G4double  )

◆ SetExplodeCentre()

void G4ViewParameters::SetExplodeCentre ( const G4Point3D explodeCentre)

◆ SetExplodeFactor()

void G4ViewParameters::SetExplodeFactor ( G4double  explodeFactor)

◆ SetFadeFactor()

void G4ViewParameters::SetFadeFactor ( G4double  )

◆ SetFieldHalfAngle()

◆ SetGlobalLineWidthScale()

void G4ViewParameters::SetGlobalLineWidthScale ( G4double  globalLineWidthScale)

◆ SetGlobalMarkerScale()

void G4ViewParameters::SetGlobalMarkerScale ( G4double  globalMarkerScale)

◆ SetLightpointDirection()

void G4ViewParameters::SetLightpointDirection ( const G4Vector3D lightpointDirection)

Definition at line 279 of file G4ViewParameters.cc.

280 {
281 fRelativeLightpointDirection = lightpointDirection;
282 SetViewAndLights (fViewpointDirection);
283}

Referenced by G4VVisCommand::CopyCameraParameters(), and G4VisCommandsViewerSet::SetNewValue().

◆ SetLightsMoveWithCamera()

void G4ViewParameters::SetLightsMoveWithCamera ( G4bool  moves)

◆ SetMarkerHidden()

◆ SetMarkerNotHidden()

void G4ViewParameters::SetMarkerNotHidden ( )

◆ SetNoOfSides()

G4int G4ViewParameters::SetNoOfSides ( G4int  nSides)

Definition at line 223 of file G4ViewParameters.cc.

223 {
224 const G4int nSidesMin = fDefaultVisAttributes.GetMinLineSegmentsPerCircle();
225 if (nSides < nSidesMin) {
226 nSides = nSidesMin;
227 G4warn << "G4ViewParameters::SetNoOfSides: attempt to set the"
228 "\nnumber of sides per circle < " << nSidesMin
229 << "; forced to " << nSides << G4endl;
230 }
231 fNoOfSides = nSides;
232 return fNoOfSides;
233}
static G4int GetMinLineSegmentsPerCircle()

Referenced by G4VisCommandsViewerSet::SetNewValue().

◆ SetNumberOfCloudPoints()

G4int G4ViewParameters::SetNumberOfCloudPoints ( G4int  nPoints)

Definition at line 235 of file G4ViewParameters.cc.

235 {
236 const G4int nPointsMin = 100;
237 if (nPoints < nPointsMin) {
238 nPoints = nPointsMin;
239 G4warn << "G4ViewParameters::SetNumberOfCloudPoints:"
240 "\nnumber of points per cloud set to minimum " << nPoints
241 << G4endl;
242 }
243 fNumberOfCloudPoints = nPoints;
244 return fNumberOfCloudPoints;
245}

Referenced by G4VisCommandsViewerSet::SetNewValue().

◆ SetOrthogonalProjection()

void G4ViewParameters::SetOrthogonalProjection ( )

◆ SetPan()

void G4ViewParameters::SetPan ( G4double  right,
G4double  up 
)

Definition at line 285 of file G4ViewParameters.cc.

285 {
286 G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
287 G4Vector3D unitUp = (fViewpointDirection.cross (unitRight)).unit();
288 fCurrentTargetPoint = right * unitRight + up * unitUp;
289}

Referenced by G4VisCommandViewerPan::SetNewValue().

◆ SetPerspectiveProjection()

void G4ViewParameters::SetPerspectiveProjection ( G4double  fieldHalfAngle = 30. *CLHEP::deg)

◆ SetPicking()

void G4ViewParameters::SetPicking ( G4bool  )

◆ SetRotationStyle()

void G4ViewParameters::SetRotationStyle ( RotationStyle  )

◆ SetScaleFactor()

void G4ViewParameters::SetScaleFactor ( const G4Vector3D scaleFactor)

◆ SetSectionPlane()

void G4ViewParameters::SetSectionPlane ( const G4Plane3D sectionPlane)

◆ SetSpecialMeshRendering()

void G4ViewParameters::SetSpecialMeshRendering ( G4bool  )

◆ SetSpecialMeshRenderingOption()

void G4ViewParameters::SetSpecialMeshRenderingOption ( SMROption  )

◆ SetSpecialMeshVolumes()

void G4ViewParameters::SetSpecialMeshVolumes ( const std::vector< G4ModelingParameters::PVNameCopyNo > &  )

◆ SetStartTime()

void G4ViewParameters::SetStartTime ( G4double  )

◆ SetUpVector()

◆ SetViewAndLights()

void G4ViewParameters::SetViewAndLights ( const G4Vector3D viewpointDirection)

Definition at line 247 of file G4ViewParameters.cc.

248 {
249
250 fViewpointDirection = viewpointDirection;
251
252 // If the requested viewpoint direction is parallel to the up
253 // vector, the orientation of the view is undefined...
254 if (fViewpointDirection.unit() * fUpVector.unit() > .9999) {
255 static G4bool firstTime = true;
256 if (firstTime) {
257 firstTime = false;
258 G4warn <<
259 "WARNING: Viewpoint direction is very close to the up vector direction."
260 "\n Change the up vector or \"/vis/viewer/set/rotationStyle freeRotation\"."
261 << G4endl;
262 }
263 }
264
265 // Move the lights too if requested...
266 if (fLightsMoveWithCamera) {
267 G4Vector3D zprime = fViewpointDirection.unit ();
268 G4Vector3D xprime = (fUpVector.cross (zprime)).unit ();
269 G4Vector3D yprime = zprime.cross (xprime);
270 fActualLightpointDirection =
271 fRelativeLightpointDirection.x () * xprime +
272 fRelativeLightpointDirection.y () * yprime +
273 fRelativeLightpointDirection.x () * zprime;
274 } else {
275 fActualLightpointDirection = fRelativeLightpointDirection;
276 }
277}

Referenced by GetActualLightpointDirection(), SetLightpointDirection(), G4VisCommandsViewerSet::SetNewValue(), and G4OpenGLXmViewer::wobble_timer_callback().

◆ SetViewpointDirection()

◆ SetVisibleDensity()

void G4ViewParameters::SetVisibleDensity ( G4double  visibleDensity)

Definition at line 206 of file G4ViewParameters.cc.

206 {
207 const G4double reasonableMaximum = 10.0 * g / cm3;
208 if (visibleDensity < 0) {
209 G4warn << "G4ViewParameters::SetVisibleDensity: attempt to set negative "
210 "density - ignored." << G4endl;
211 }
212 else {
213 if (visibleDensity > reasonableMaximum) {
214 G4warn << "G4ViewParameters::SetVisibleDensity: density > "
215 << G4BestUnit (reasonableMaximum, "Volumic Mass")
216 << " - did you mean this?"
217 << G4endl;
218 }
219 fVisibleDensity = visibleDensity;
220 }
221}

Referenced by G4VisCommandsViewerSet::SetNewValue().

◆ SetWindowLocationHint()

void G4ViewParameters::SetWindowLocationHint ( G4int  xHint,
G4int  yHint 
)

◆ SetWindowSizeHint()

void G4ViewParameters::SetWindowSizeHint ( G4int  xHint,
G4int  yHint 
)

◆ SetXGeometryString()

void G4ViewParameters::SetXGeometryString ( const G4String geomString)

Definition at line 1211 of file G4ViewParameters.cc.

1212{
1213 const G4String delimiters("xX+-");
1214 G4String::size_type i = geomString.find_first_of(delimiters);
1215 if (i == G4String::npos) {
1216 // Does not contain "xX+-".
1217 // Is it a single number?
1218 std::istringstream iss(geomString);
1219 G4int size;
1220 iss >> size;
1221 if (iss) {
1222 // It is a number
1223 fWindowSizeHintX = size;
1224 fWindowSizeHintY = size;
1225 }
1226 // Accept other or all defaults (in G4ViewParameters constructor)
1227 // Reconstruct a geometry string coherent with the above
1228 char signX, signY;
1229 if (fWindowLocationHintXNegative) signX = '-'; else signX ='+';
1230 if (fWindowLocationHintYNegative) signY = '-'; else signY ='+';
1231 std::ostringstream oss;
1232 oss << fWindowSizeHintX << 'x' << fWindowSizeHintY
1233 << signX << fWindowLocationHintX << signY << fWindowLocationHintY;
1234 fXGeometryString = oss.str();
1235 return;
1236 }
1237
1238 // Assume it's a parseable X geometry string
1239 G4int x = 0, y = 0;
1240 unsigned int w = 0, h = 0;
1241 fGeometryMask = ParseGeometry( geomString, &x, &y, &w, &h );
1242
1243 // Handle special case :
1244 if ((fGeometryMask & fYValue) == 0)
1245 { // Using default
1246 y = fWindowLocationHintY;
1247 }
1248 if ((fGeometryMask & fXValue) == 0)
1249 { // Using default
1250 x = fWindowLocationHintX;
1251 }
1252
1253 // Check errors
1254 // if there is no Width and Height
1255 if ( ((fGeometryMask & fHeightValue) == 0 ) &&
1256 ((fGeometryMask & fWidthValue) == 0 )) {
1257 h = fWindowSizeHintY;
1258 w = fWindowSizeHintX;
1259 } else if ((fGeometryMask & fHeightValue) == 0 ) {
1260
1261 // if there is only Width. Special case to be backward compatible
1262 // We set Width and Height the same to obtain a square windows.
1263
1264 G4warn << "Unrecognised geometry string \""
1265 << geomString
1266 << "\". No Height found. Using Width value instead"
1267 << G4endl;
1268 h = w;
1269 }
1270 if ( ((fGeometryMask & fXValue) == 0 ) ||
1271 ((fGeometryMask & fYValue) == 0 )) {
1272 //Using defaults
1273 x = fWindowLocationHintX;
1274 y = fWindowLocationHintY;
1275 }
1276 // Set the string
1277 fXGeometryString = geomString;
1278
1279 // Set values
1280 fWindowSizeHintX = w;
1281 fWindowSizeHintY = h;
1282 fWindowLocationHintX = x;
1283 fWindowLocationHintY = y;
1284
1285 if ( ((fGeometryMask & fXValue)) &&
1286 ((fGeometryMask & fYValue))) {
1287
1288 if ( (fGeometryMask & fXNegative) ) {
1289 fWindowLocationHintXNegative = true;
1290 } else {
1291 fWindowLocationHintXNegative = false;
1292 }
1293 if ( (fGeometryMask & fYNegative) ) {
1294 fWindowLocationHintYNegative = true;
1295 } else {
1296 fWindowLocationHintYNegative = false;
1297 }
1298 }
1299}

Referenced by G4VisManager::CreateViewer(), and G4VisCommandViewerCreate::SetNewValue().

◆ SetZoomFactor()

◆ TimeWindowCommands()

G4String G4ViewParameters::TimeWindowCommands ( ) const

Definition at line 704 of file G4ViewParameters.cc.

705{
706 std::ostringstream oss;
707
708 oss << "#\n# Time window commands";
709
710 oss
711 << "\n/vis/viewer/set/timeWindow/startTime "
712 << fStartTime/ns << " ns ";
713
714 oss
715 << "\n/vis/viewer/set/timeWindow/endTime "
716 << fEndTime/ns << " ns ";
717
718 oss << "\n/vis/viewer/set/timeWindow/fadeFactor "
719 << fFadeFactor;
720
721 oss
722 << "\n/vis/viewer/set/timeWindow/displayHeadTime ";
723 if (!fDisplayHeadTime) {
724 oss << "false";
725 } else {
726 oss
727 << "true"
728 << ' ' << fDisplayHeadTimeX
729 << ' ' << fDisplayHeadTimeY
730 << ' ' << fDisplayHeadTimeSize
731 << ' ' << fDisplayHeadTimeRed
732 << ' ' << fDisplayHeadTimeGreen
733 << ' ' << fDisplayHeadTimeBlue;
734 }
735
736 oss
737 << "\n/vis/viewer/set/timeWindow/displayLightFront ";
738 if (!fDisplayLightFront) {
739 oss << "false";
740 } else {
741 oss
742 << "true"
743 << ' ' << fDisplayLightFrontX/mm
744 << ' ' << fDisplayLightFrontY/mm
745 << ' ' << fDisplayLightFrontZ/mm
746 << " mm"
747 << ' ' << fDisplayLightFrontT/ns
748 << " ns"
749 << ' ' << fDisplayLightFrontRed
750 << ' ' << fDisplayLightFrontGreen
751 << ' ' << fDisplayLightFrontBlue;
752 }
753
754 oss << std::endl;
755
756 return oss.str();
757}
#define ns(x)
Definition: xmltok.c:1649

◆ TouchableCommands()

G4String G4ViewParameters::TouchableCommands ( ) const

Definition at line 561 of file G4ViewParameters.cc.

562{
563 std::ostringstream oss;
564
565 oss << "#\n# Touchable commands";
566
567 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
568 fVisAttributesModifiers;
569
570 if (vams.empty()) {
571 oss
572 << "\n# None"
573 << "\n/vis/viewer/clearVisAttributesModifiers";
574 oss << std::endl;
575 return oss.str();
576 }
577
578 oss
579 << "\n/vis/viewer/clearVisAttributesModifiers";
580
582 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
583 iModifier;
584 for (iModifier = vams.begin();
585 iModifier != vams.end();
586 ++iModifier) {
588 iModifier->GetPVNameCopyNoPath();
589 if (vamPath != lastPath) {
590 lastPath = vamPath;
591 oss << "\n/vis/set/touchable";
593 for (iVAM = vamPath.begin();
594 iVAM != vamPath.end();
595 ++iVAM) {
596 oss << ' ' << iVAM->GetName() << ' ' << iVAM->GetCopyNo();
597 }
598 }
599 const G4VisAttributes& vamVisAtts = iModifier->GetVisAttributes();
600 const G4Colour& c = vamVisAtts.GetColour();
601 switch (iModifier->GetVisAttributesSignifier()) {
603 oss << "\n/vis/touchable/set/visibility ";
604 if (vamVisAtts.IsVisible()) {
605 oss << "true";
606 } else {
607 oss << "false";
608 }
609 break;
611 oss << "\n/vis/touchable/set/daughtersInvisible ";
612 if (vamVisAtts.IsDaughtersInvisible()) {
613 oss << "true";
614 } else {
615 oss << "false";
616 }
617 break;
619 oss << "\n/vis/touchable/set/colour "
620 << c.GetRed()
621 << ' ' << c.GetGreen()
622 << ' ' << c.GetBlue()
623 << ' ' << c.GetAlpha();
624 break;
626 oss << "\n/vis/touchable/set/lineStyle ";
627 switch (vamVisAtts.GetLineStyle()) {
629 oss << "unbroken";
630 break;
632 oss << "dashed";
633 break;
635 oss << "dotted";
636 }
637 break;
639 oss << "\n/vis/touchable/set/lineWidth "
640 << vamVisAtts.GetLineWidth();
641 break;
643 if (vamVisAtts.IsForceDrawingStyle()) {
645 oss << "\n/vis/touchable/set/forceWireframe ";
646 if (vamVisAtts.IsForceDrawingStyle()) {
647 oss << "true";
648 } else {
649 oss << "false";
650 }
651 }
652 }
653 break;
655 if (vamVisAtts.IsForceDrawingStyle()) {
656 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) {
657 oss << "\n/vis/touchable/set/forceSolid ";
658 if (vamVisAtts.IsForceDrawingStyle()) {
659 oss << "true";
660 } else {
661 oss << "false";
662 }
663 }
664 }
665 break;
667 if (vamVisAtts.IsForceDrawingStyle()) {
668 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::cloud) {
669 oss << "\n/vis/touchable/set/forceCloud ";
670 if (vamVisAtts.IsForceDrawingStyle()) {
671 oss << "true";
672 } else {
673 oss << "false";
674 }
675 }
676 }
677 break;
679 if (vamVisAtts.IsForceAuxEdgeVisible()) {
680 oss << "\n/vis/touchable/set/forceAuxEdgeVisible ";
681 if (vamVisAtts.IsForcedAuxEdgeVisible()) {
682 oss << "true";
683 } else {
684 oss << "false";
685 }
686 }
687 break;
689 oss << "\n/vis/touchable/set/lineSegmentsPerCircle "
690 << vamVisAtts.GetForcedLineSegmentsPerCircle();
691 break;
693 oss << "\n/vis/touchable/set/numberOfCloudPoints "
694 << vamVisAtts.GetForcedNumberOfCloudPoints();
695 break;
696 }
697 }
698
699 oss << std::endl;
700
701 return oss.str();
702}
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4int GetForcedNumberOfCloudPoints() const
G4double GetLineWidth() const
G4bool IsDaughtersInvisible() const
G4int GetForcedLineSegmentsPerCircle() const
LineStyle GetLineStyle() const
G4bool IsVisible() const
G4bool IsForceAuxEdgeVisible() const
G4bool IsForcedAuxEdgeVisible() const
ForcedDrawingStyle GetForcedDrawingStyle() const
G4bool IsForceDrawingStyle() const

◆ UnsetExplodeFactor()

void G4ViewParameters::UnsetExplodeFactor ( )

◆ UnsetSectionPlane()

void G4ViewParameters::UnsetSectionPlane ( )

Friends And Related Function Documentation

◆ operator<< [1/3]

std::ostream & operator<< ( std::ostream &  os,
const G4ViewParameters v 
)
friend

Definition at line 907 of file G4ViewParameters.cc.

907 {
908 os << "View parameters and options:";
909
910 os << "\n Drawing style: " << v.fDrawingStyle;
911
912 os << "\n Number of cloud points: " << v.fNumberOfCloudPoints;
913
914 os << "\n Auxiliary edges: ";
915 if (!v.fAuxEdgeVisible) os << "in";
916 os << "visible";
917
918 os << "\n Culling: ";
919 if (v.fCulling) os << "on";
920 else os << "off";
921
922 os << "\n Culling invisible objects: ";
923 if (v.fCullInvisible) os << "on";
924 else os << "off";
925
926 os << "\n Density culling: ";
927 if (v.fDensityCulling) {
928 os << "on - invisible if density less than "
929 << v.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
930 }
931 else os << "off";
932
933 os << "\n Culling daughters covered by opaque mothers: ";
934 if (v.fCullCovered) os << "on";
935 else os << "off";
936
937 os << "\n Colour by density: ";
938 if (v.fCBDAlgorithmNumber <= 0) {
939 os << "inactive";
940 } else {
941 os << "Algorithm " << v.fCBDAlgorithmNumber << ", Parameters:";
942 for (auto p: v.fCBDParameters) {
943 os << ' ' << G4BestUnit(p,"Volumic Mass");
944 }
945 }
946
947 os << "\n Section flag: ";
948 if (v.fSection) os << "true, section/cut plane: " << v.fSectionPlane;
949 else os << "false";
950
951 if (v.IsCutaway()) {
952 os << "\n Cutaway planes: ";
953 for (size_t i = 0; i < v.fCutawayPlanes.size (); i++) {
954 os << ' ' << v.fCutawayPlanes[i];
955 }
956 }
957 else {
958 os << "\n No cutaway planes";
959 }
960
961 os << "\n Explode factor: " << v.fExplodeFactor
962 << " about centre: " << v.fExplodeCentre;
963
964 os << "\n No. of sides used in circle polygon approximation: "
965 << v.fNoOfSides;
966
967 os << "\n Viewpoint direction: " << v.fViewpointDirection;
968
969 os << "\n Up vector: " << v.fUpVector;
970
971 os << "\n Field half angle: " << v.fFieldHalfAngle;
972
973 os << "\n Zoom factor: " << v.fZoomFactor;
974
975 os << "\n Scale factor: " << v.fScaleFactor;
976
977 os << "\n Current target point: " << v.fCurrentTargetPoint;
978
979 os << "\n Dolly distance: " << v.fDolly;
980
981 os << "\n Light ";
982 if (v.fLightsMoveWithCamera) os << "moves";
983 else os << "does not move";
984 os << " with camera";
985
986 os << "\n Relative lightpoint direction: "
987 << v.fRelativeLightpointDirection;
988
989 os << "\n Actual lightpoint direction: "
990 << v.fActualLightpointDirection;
991
992 os << "\n Derived parameters for standard view of object of unit radius:";
993 G4ViewParameters tempVP = v;
994 tempVP.fDolly = 0.;
995 tempVP.fZoomFactor = 1.;
996 const G4double radius = 1.;
997 const G4double cameraDistance = tempVP.GetCameraDistance (radius);
998 const G4double nearDistance =
999 tempVP.GetNearDistance (cameraDistance, radius);
1000 const G4double farDistance =
1001 tempVP.GetFarDistance (cameraDistance, nearDistance, radius);
1002 const G4double right = tempVP.GetFrontHalfHeight (nearDistance, radius);
1003 os << "\n Camera distance: " << cameraDistance;
1004 os << "\n Near distance: " << nearDistance;
1005 os << "\n Far distance: " << farDistance;
1006 os << "\n Front half height: " << right;
1007
1008 os << "\n Default VisAttributes:\n " << v.fDefaultVisAttributes;
1009
1010 os << "\n Default TextVisAttributes:\n " << v.fDefaultTextVisAttributes;
1011
1012 os << "\n Default marker: " << v.fDefaultMarker;
1013
1014 os << "\n Global marker scale: " << v.fGlobalMarkerScale;
1015
1016 os << "\n Global lineWidth scale: " << v.fGlobalLineWidthScale;
1017
1018 os << "\n Marker ";
1019 if (v.fMarkerNotHidden) os << "not ";
1020 os << "hidden by surfaces.";
1021
1022 os << "\n Window size hint: "
1023 << v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
1024
1025 os << "\n X geometry string: " << v.fXGeometryString;
1026 os << "\n X geometry mask: "
1027 << std::showbase << std::hex << v.fGeometryMask
1028 << std::noshowbase << std::dec;
1029
1030 os << "\n Auto refresh: ";
1031 if (v.fAutoRefresh) os << "true";
1032 else os << "false";
1033
1034 os << "\n Background colour: " << v.fBackgroundColour;
1035
1036 os << "\n Picking requested: ";
1037 if (v.fPicking) os << "true";
1038 else os << "false";
1039
1040 os << "\n Rotation style: ";
1041 switch (v.fRotationStyle) {
1043 os << "constrainUpDirection (conventional HEP view)"; break;
1045 os << "freeRotation (Google-like rotation, using mouse-grab)"; break;
1046 default: os << "unrecognised"; break;
1047 }
1048
1049 os << "\n Vis attributes modifiers: ";
1050 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
1051 v.fVisAttributesModifiers;
1052 if (vams.empty()) {
1053 os << "None";
1054 } else {
1055 os << vams;
1056 }
1057
1058 os << "\n Time window parameters:"
1059 << "\n Start time: " << v.fStartTime/ns << " ns"
1060 << "\n End time: " << v.fEndTime/ns << " ns"
1061 << "\n Fade factor: " << v.fFadeFactor;
1062 if (!v.fDisplayHeadTime) {
1063 os << "\n Head time display not requested.";
1064 } else {
1065 os
1066 << "\n Head time position: "
1067 << v.fDisplayHeadTimeX << ' ' << v.fDisplayHeadTimeY
1068 << "\n Head time size: " << v.fDisplayHeadTimeSize
1069 << "\n Head time colour: " << v.fDisplayHeadTimeRed
1070 << ' ' << v.fDisplayHeadTimeGreen << ' ' << v.fDisplayHeadTimeBlue;
1071 }
1072 if (!v.fDisplayLightFront) {
1073 os << "\n Light front display not requested.";
1074 } else {
1075 os
1076 << "\n Light front position: "
1077 << v.fDisplayLightFrontX/mm << ' ' << v.fDisplayLightFrontY/mm
1078 << ' ' << v.fDisplayLightFrontZ/mm << " mm"
1079 << "\n Light front time: " << v.fDisplayLightFrontT/ns << " ns"
1080 << "\n Light front colour: " << v.fDisplayLightFrontRed
1081 << ' ' << v.fDisplayLightFrontGreen << ' ' << v.fDisplayLightFrontBlue;
1082 }
1083
1084 os << "\n Special Mesh Rendering";
1085 if (v.fSpecialMeshRendering) {
1086 os << " requested with option \"" << v.fSpecialMeshRenderingOption;
1087 os << "\" for ";
1088 if (v.fSpecialMeshVolumes.empty()) {
1089 os << "any mesh";
1090 } else {
1091 os << "selected meshes";
1092 for (const auto& vol: v.fSpecialMeshVolumes) {
1093 os << "\n " << vol.GetName() << ':' << vol.GetCopyNo();
1094 }
1095 }
1096 } else os << ": off";
1097 return os;
1098}
G4double GetCameraDistance(G4double radius) const
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const

◆ operator<< [2/3]

std::ostream & operator<< ( std::ostream &  os,
G4ViewParameters::DrawingStyle  style 
)
friend

Definition at line 876 of file G4ViewParameters.cc.

878{
879 switch (style) {
881 os << "wireframe"; break;
883 os << "hlr - hidden lines removed"; break;
885 os << "hsr - hidden surfaces removed"; break;
887 os << "hlhsr - hidden line, hidden surface removed"; break;
889 os << "cloud - draw volume as a cloud of dots"; break;
890 default: os << "unrecognised"; break;
891 }
892 return os;
893}

◆ operator<< [3/3]

std::ostream & operator<< ( std::ostream &  os,
G4ViewParameters::SMROption  option 
)
friend

Definition at line 895 of file G4ViewParameters.cc.

897{
898 switch (option) {
900 os << "dots"; break;
902 os << "surfaces"; break;
903 }
904 return os;
905}

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