Geant4 11.4.0
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 { meshAsDefault , 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
const G4ModelingParameters::TimeParametersGetTimeParameters () const
G4bool IsSpecialMeshRendering () const
SMROption GetSpecialMeshRenderingOption () const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes () const
G4double GetTransparencyByDepth () const
G4int GetTransparencyByDepthOption () const
G4bool IsZoomToCursor () const
G4bool IsDotsSmooth () const
G4double GetDotsSize () 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 SetTimeParameters (const G4ModelingParameters::TimeParameters &)
void SetSpecialMeshRendering (G4bool)
void SetSpecialMeshRenderingOption (SMROption)
void SetSpecialMeshVolumes (const std::vector< G4ModelingParameters::PVNameCopyNo > &)
void SetTransparencyByDepth (G4double)
void SetTransparencyByDepthOption (G4int)
void SetZoomToCursor (G4bool)
void SetDotsSmooth (G4bool)
void SetDotsSize (G4double)
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 &os, G4ViewParameters::DrawingStyle style)
std::ostream & operator<< (std::ostream &os, G4ViewParameters::SMROption option)
std::ostream & operator<< (std::ostream &os, const G4ViewParameters &v)

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
meshAsDefault 
meshAsDots 
meshAsSurfaces 

Definition at line 112 of file G4ViewParameters.hh.

112 { // Special Mesh Rendering Option
116 };

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),
88 fSpecialMeshRendering(false),
89 fSpecialMeshRenderingOption(meshAsDefault),
90 fTransparencyByDepth(0.),
91 fTransparencyByDepthOption(1),
92 fZoomToCursor(false),
93 fDotsSmooth(true),
94 fDotsSize(1.)
95{
96 // Pick up default no of sides from G4Polyhedron.
97 // Note that this parameter is variously called:
98 // No of sides
99 // NumberOfRotationSteps
100 // Line segments per circle
101 // It refers to the approximation of a circle by a polygon of
102 // stated number of sides.
104
105 fDefaultMarker.SetScreenSize (5.);
106 // Markers are 5 pixels "overall" size, i.e., diameter.
107}
HepGeom::Vector3D< G4double > G4Vector3D
Definition G4Vector3D.hh:34
static G4int GetNumberOfRotationSteps()

Referenced by CatmullRomCubicSplineInterpolation(), operator!=(), operator<<, PrintDifferences(), and SetDotsSize().

◆ ~G4ViewParameters()

G4ViewParameters::~G4ViewParameters ( )

Definition at line 109 of file G4ViewParameters.cc.

109{}

Member Function Documentation

◆ AddCutawayPlane()

void G4ViewParameters::AddCutawayPlane ( const G4Plane3D & cutawayPlane)

Definition at line 171 of file G4ViewParameters.cc.

171 {
172 if (fCutawayPlanes.size () < 3 ) {
173 fCutawayPlanes.push_back (cutawayPlane);
174 }
175 else {
176 G4warn <<
177 "ERROR: G4ViewParameters::AddCutawayPlane:"
178 "\n A maximum of 3 cutaway planes supported." << G4endl;
179 }
180}
#define G4warn
Definition G4Scene.cc:41
#define G4endl
Definition G4ios.hh:67

Referenced by G4VisCommandViewerAddCutawayPlane::SetNewValue().

◆ AddVisAttributesModifier()

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

Definition at line 288 of file G4ViewParameters.cc.

289 {
290 // If target exists with same signifier just change vis attributes.
291 G4bool duplicateTarget = false;
292 auto i = fVisAttributesModifiers.begin();
293 for (; i < fVisAttributesModifiers.end(); ++i) {
294 if (vam.GetPVNameCopyNoPath() == (*i).GetPVNameCopyNoPath() &&
295 vam.GetVisAttributesSignifier() == (*i).GetVisAttributesSignifier()) {
296 duplicateTarget = true;
297 break;
298 }
299 }
300 if (duplicateTarget) (*i).SetVisAttributes(vam.GetVisAttributes());
301 else fVisAttributesModifiers.push_back(vam);
302}
bool G4bool
Definition G4Types.hh:86
const PVNameCopyNoPath & GetPVNameCopyNoPath() const
VisAttributesSignifier GetVisAttributesSignifier() const
const G4VisAttributes & GetVisAttributes() const

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

◆ CameraAndLightingCommands()

G4String G4ViewParameters::CameraAndLightingCommands ( const G4Point3D standardTargetPoint) const

Definition at line 304 of file G4ViewParameters.cc.

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

◆ CatmullRomCubicSplineInterpolation()

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

Definition at line 1477 of file G4ViewParameters.cc.

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

183 {
184 if (index >= fCutawayPlanes.size()) {
185 G4warn <<
186 "ERROR: G4ViewParameters::ChangeCutawayPlane:"
187 "\n Plane " << index << " does not exist." << G4endl;
188 } else {
189 fCutawayPlanes[index] = cutawayPlane;
190 }
191}

Referenced by G4VisCommandViewerChangeCutawayPlane::SetNewValue().

◆ ClearCutawayPlanes()

void G4ViewParameters::ClearCutawayPlanes ( )

◆ ClearVisAttributesModifiers()

void G4ViewParameters::ClearVisAttributesModifiers ( )

◆ DrawingStyleCommands()

G4String G4ViewParameters::DrawingStyleCommands ( ) const

Definition at line 394 of file G4ViewParameters.cc.

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

◆ GetActualLightpointDirection()

G4Vector3D & G4ViewParameters::GetActualLightpointDirection ( )

Definition at line 118 of file G4ViewParameters.cc.

118 {
119 SetViewAndLights (fViewpointDirection);
120 return fActualLightpointDirection;
121}
void SetViewAndLights(const G4Vector3D &viewpointDirection)

Referenced by G4VisCommandsViewerSet::SetNewValue().

◆ GetBackgroundColour()

◆ GetCameraDistance()

G4double G4ViewParameters::GetCameraDistance ( G4double radius) const

Definition at line 131 of file G4ViewParameters.cc.

131 {
132 G4double cameraDistance;
133 if (fFieldHalfAngle == 0.) {
134 cameraDistance = radius;
135 }
136 else {
137 cameraDistance = radius / std::sin (fFieldHalfAngle) - fDolly;
138 }
139 return cameraDistance;
140}

Referenced by operator<<.

◆ GetCBDAlgorithmNumber()

◆ GetCBDParameters()

◆ GetCurrentTargetPoint()

const G4Point3D & G4ViewParameters::GetCurrentTargetPoint ( ) const

◆ GetCutawayMode()

◆ GetCutawayPlanes()

◆ GetDefaultMarker()

const G4VMarker & G4ViewParameters::GetDefaultMarker ( ) const

◆ GetDefaultTextVisAttributes()

◆ GetDefaultVisAttributes()

◆ GetDolly()

◆ GetDotsSize()

◆ GetDrawingStyle()

◆ GetExplodeCentre()

const G4Point3D & G4ViewParameters::GetExplodeCentre ( ) const

◆ GetExplodeFactor()

◆ GetFarDistance()

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

Definition at line 150 of file G4ViewParameters.cc.

152 {
153 G4double farDistance = cameraDistance + radius;
154 if (farDistance < nearDistance) farDistance = nearDistance;
155 return farDistance;
156}

Referenced by operator<<.

◆ GetFieldHalfAngle()

G4double G4ViewParameters::GetFieldHalfAngle ( ) const

◆ GetFrontHalfHeight()

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

Definition at line 158 of file G4ViewParameters.cc.

159 {
160 G4double frontHalfHeight;
161 if (fFieldHalfAngle == 0.) {
162 frontHalfHeight = radius / fZoomFactor;
163 }
164 else {
165 frontHalfHeight = nearDistance * std::tan (fFieldHalfAngle) / fZoomFactor;
166 }
167 return frontHalfHeight;
168}

Referenced by operator<<.

◆ GetGlobalLineWidthScale()

◆ GetGlobalMarkerScale()

◆ GetLightpointDirection()

const G4Vector3D & G4ViewParameters::GetLightpointDirection ( ) const

◆ GetLightsMoveWithCamera()

G4bool G4ViewParameters::GetLightsMoveWithCamera ( ) const

◆ GetNearDistance()

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

Definition at line 142 of file G4ViewParameters.cc.

143 {
144 const G4double small = 1.e-6 * radius;
145 G4double nearDistance = cameraDistance - radius;
146 if (nearDistance < small) nearDistance = small;
147 return nearDistance;
148}

Referenced by operator<<.

◆ GetNoOfSides()

◆ GetNumberOfCloudPoints()

◆ GetRotationStyle()

RotationStyle G4ViewParameters::GetRotationStyle ( ) const

◆ GetScaleFactor()

◆ GetSectionPlane()

◆ GetSpecialMeshRenderingOption()

◆ GetSpecialMeshVolumes()

◆ GetTimeParameters()

◆ GetTransparencyByDepth()

◆ GetTransparencyByDepthOption()

◆ GetUpVector()

◆ GetViewpointDirection()

◆ GetVisAttributesModifiers()

◆ GetVisibleDensity()

◆ GetWindowAbsoluteLocationHintX()

G4int G4ViewParameters::GetWindowAbsoluteLocationHintX ( G4int sizeX) const

Definition at line 1333 of file G4ViewParameters.cc.

1333 {
1334 if ( fWindowLocationHintXNegative ) {
1335 return sizeX + fWindowLocationHintX - fWindowSizeHintX;
1336 }
1337 return fWindowLocationHintX;
1338}

◆ GetWindowAbsoluteLocationHintY()

G4int G4ViewParameters::GetWindowAbsoluteLocationHintY ( G4int sizeY) const

Definition at line 1340 of file G4ViewParameters.cc.

1340 {
1341 if ( fWindowLocationHintYNegative ) {
1342 return sizeY + fWindowLocationHintY - fWindowSizeHintY;
1343 }
1344 return fWindowLocationHintY;
1345}

◆ GetWindowLocationHintX()

G4int G4ViewParameters::GetWindowLocationHintX ( ) const

◆ GetWindowLocationHintY()

G4int G4ViewParameters::GetWindowLocationHintY ( ) const

◆ GetWindowSizeHintX()

unsigned int G4ViewParameters::GetWindowSizeHintX ( ) const

◆ GetWindowSizeHintY()

unsigned int G4ViewParameters::GetWindowSizeHintY ( ) const

◆ GetXGeometryString()

const G4String & G4ViewParameters::GetXGeometryString ( ) const

◆ GetZoomFactor()

◆ IncrementDolly()

void G4ViewParameters::IncrementDolly ( G4double dollyIncrement)

◆ IncrementPan() [1/2]

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

Definition at line 278 of file G4ViewParameters.cc.

278 {
279 IncrementPan (right,up, 0);
280}
void IncrementPan(G4double right, G4double up)

Referenced by IncrementPan(), and G4VisCommandViewerPan::SetNewValue().

◆ IncrementPan() [2/2]

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

Definition at line 282 of file G4ViewParameters.cc.

282 {
283 G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
284 G4Vector3D unitUp = (fViewpointDirection.cross (unitRight)).unit();
285 fCurrentTargetPoint += right * unitRight + up * unitUp + distance * fViewpointDirection;
286}

◆ IsAutoRefresh()

◆ IsAuxEdgeVisible()

◆ IsCulling()

◆ IsCullingCovered()

◆ IsCullingInvisible()

◆ IsCutaway()

◆ IsDensityCulling()

◆ IsDotsSmooth()

◆ IsExplode()

◆ IsMarkerNotHidden()

◆ IsPicking()

◆ IsSection()

◆ IsSpecialMeshRendering()

◆ IsWindowLocationHintX()

bool G4ViewParameters::IsWindowLocationHintX ( ) const

◆ IsWindowLocationHintXNegative()

G4bool G4ViewParameters::IsWindowLocationHintXNegative ( ) const

◆ IsWindowLocationHintY()

bool G4ViewParameters::IsWindowLocationHintY ( ) const

◆ IsWindowLocationHintYNegative()

G4bool G4ViewParameters::IsWindowLocationHintYNegative ( ) const

◆ IsWindowSizeHintX()

bool G4ViewParameters::IsWindowSizeHintX ( ) const

◆ IsWindowSizeHintY()

bool G4ViewParameters::IsWindowSizeHintY ( ) const

◆ IsZoomToCursor()

G4bool G4ViewParameters::IsZoomToCursor ( ) const

◆ MultiplyScaleFactor()

void G4ViewParameters::MultiplyScaleFactor ( const G4Vector3D & scaleFactorMultiplier)

Definition at line 111 of file G4ViewParameters.cc.

112 {
113 fScaleFactor.setX(fScaleFactor.x() * scaleFactorMultiplier.x());
114 fScaleFactor.setY(fScaleFactor.y() * scaleFactorMultiplier.y());
115 fScaleFactor.setZ(fScaleFactor.z() * scaleFactorMultiplier.z());
116}

Referenced by G4VisCommandViewerScale::SetNewValue().

◆ MultiplyZoomFactor()

void G4ViewParameters::MultiplyZoomFactor ( G4double zoomFactorMultiplier)

◆ operator!=()

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

Definition at line 1127 of file G4ViewParameters.cc.

1127 {
1128
1129 // Put performance-sensitive parameters first.
1130 if (
1131 // This first to optimise spin, etc.
1132 (fViewpointDirection != v.fViewpointDirection) ||
1133
1134 // No particular order from here on.
1135 (fDrawingStyle != v.fDrawingStyle) ||
1136 (fNumberOfCloudPoints != v.fNumberOfCloudPoints) ||
1137 (fAuxEdgeVisible != v.fAuxEdgeVisible) ||
1138 (fCulling != v.fCulling) ||
1139 (fCullInvisible != v.fCullInvisible) ||
1140 (fDensityCulling != v.fDensityCulling) ||
1141 (fCullCovered != v.fCullCovered) ||
1142 (fCBDAlgorithmNumber != v.fCBDAlgorithmNumber) ||
1143 (fSection != v.fSection) ||
1144 (IsCutaway() != v.IsCutaway()) ||
1145 (IsExplode() != v.IsExplode()) ||
1146 (fNoOfSides != v.fNoOfSides) ||
1147 (fUpVector != v.fUpVector) ||
1148 (fFieldHalfAngle != v.fFieldHalfAngle) ||
1149 (fZoomFactor != v.fZoomFactor) ||
1150 (fScaleFactor != v.fScaleFactor) ||
1151 (fCurrentTargetPoint != v.fCurrentTargetPoint) ||
1152 (fDolly != v.fDolly) ||
1153 (fRelativeLightpointDirection != v.fRelativeLightpointDirection) ||
1154 (fLightsMoveWithCamera != v.fLightsMoveWithCamera) ||
1155 (fDefaultVisAttributes != v.fDefaultVisAttributes) ||
1156 (fDefaultTextVisAttributes != v.fDefaultTextVisAttributes) ||
1157 (fDefaultMarker != v.fDefaultMarker) ||
1158 (fGlobalMarkerScale != v.fGlobalMarkerScale) ||
1159 (fGlobalLineWidthScale != v.fGlobalLineWidthScale) ||
1160 (fMarkerNotHidden != v.fMarkerNotHidden) ||
1161 (fWindowSizeHintX != v.fWindowSizeHintX) ||
1162 (fWindowSizeHintY != v.fWindowSizeHintY) ||
1163 (fXGeometryString != v.fXGeometryString) ||
1164 (fGeometryMask != v.fGeometryMask) ||
1165 (fAutoRefresh != v.fAutoRefresh) ||
1166 (fBackgroundColour != v.fBackgroundColour) ||
1167 (fPicking != v.fPicking) ||
1168 (fRotationStyle != v.fRotationStyle) ||
1169 (fSpecialMeshRendering != v.fSpecialMeshRendering) ||
1170 (fSpecialMeshRenderingOption != v.fSpecialMeshRenderingOption) ||
1171 (fTransparencyByDepth != v.fTransparencyByDepth) ||
1172 (fTransparencyByDepthOption != v.fTransparencyByDepthOption) ||
1173 (fZoomToCursor != v.fZoomToCursor) ||
1174 (fDotsSmooth != v.fDotsSmooth) ||
1175 (fDotsSize != v.fDotsSize)
1176 )
1177 return true;
1178
1179 if (fDensityCulling &&
1180 (fVisibleDensity != v.fVisibleDensity)) return true;
1181
1182 if (fCBDAlgorithmNumber > 0) {
1183 if (fCBDParameters.size() != v.fCBDParameters.size()) return true;
1184 else if (fCBDParameters != v.fCBDParameters) return true;
1185 }
1186
1187 if (fSection &&
1188 (!(fSectionPlane == v.fSectionPlane))) return true;
1189
1190 if (IsCutaway()) {
1191 if (fCutawayPlanes.size () != v.fCutawayPlanes.size ())
1192 return true;
1193 else {
1194 for (size_t i = 0; i < fCutawayPlanes.size (); i++) {
1195 if (!(fCutawayPlanes[i] == v.fCutawayPlanes[i])) return true;
1196 }
1197 }
1198 }
1199
1200 if (IsExplode() &&
1201 ((fExplodeFactor != v.fExplodeFactor) ||
1202 (fExplodeCentre != v.fExplodeCentre))) return true;
1203
1204 if (fVisAttributesModifiers != v.fVisAttributesModifiers) return true;
1205
1206 if (fTimeParameters.fStartTime != v.fTimeParameters.fStartTime ||
1207 fTimeParameters.fEndTime != v.fTimeParameters.fEndTime ||
1208 fTimeParameters.fFadeFactor != v.fTimeParameters.fFadeFactor) return true;
1209
1210 if (fTimeParameters.fDisplayHeadTime != v.fTimeParameters.fDisplayHeadTime) return true;
1211 if (fTimeParameters.fDisplayHeadTime) {
1212 if (fTimeParameters.fDisplayHeadTimeX != v.fTimeParameters.fDisplayHeadTimeX ||
1213 fTimeParameters.fDisplayHeadTimeY != v.fTimeParameters.fDisplayHeadTimeY ||
1214 fTimeParameters.fDisplayHeadTimeSize != v.fTimeParameters.fDisplayHeadTimeSize ||
1215 fTimeParameters.fDisplayHeadTimeRed != v.fTimeParameters.fDisplayHeadTimeRed ||
1216 fTimeParameters.fDisplayHeadTimeGreen != v.fTimeParameters.fDisplayHeadTimeGreen ||
1217 fTimeParameters.fDisplayHeadTimeBlue != v.fTimeParameters.fDisplayHeadTimeBlue) {
1218 return true;
1219 }
1220 }
1221
1222 if (fTimeParameters.fDisplayLightFront != v.fTimeParameters.fDisplayLightFront) return true;
1223 if (fTimeParameters.fDisplayLightFront) {
1224 if (fTimeParameters.fDisplayLightFrontX != v.fTimeParameters.fDisplayLightFrontX ||
1225 fTimeParameters.fDisplayLightFrontY != v.fTimeParameters.fDisplayLightFrontY ||
1226 fTimeParameters.fDisplayLightFrontZ != v.fTimeParameters.fDisplayLightFrontZ ||
1227 fTimeParameters.fDisplayLightFrontT != v.fTimeParameters.fDisplayLightFrontT ||
1228 fTimeParameters.fDisplayLightFrontRed != v.fTimeParameters.fDisplayLightFrontRed ||
1229 fTimeParameters.fDisplayLightFrontGreen != v.fTimeParameters.fDisplayLightFrontGreen ||
1230 fTimeParameters.fDisplayLightFrontBlue != v.fTimeParameters.fDisplayLightFrontBlue) {
1231 return true;
1232 }
1233 }
1234
1235 if (fSpecialMeshRendering) {
1236 if (fSpecialMeshVolumes != v.fSpecialMeshVolumes)
1237 return true;;
1238 }
1239
1240 return false;
1241}
G4bool IsCutaway() const
G4bool IsExplode() const

◆ PrintDifferences()

void G4ViewParameters::PrintDifferences ( const G4ViewParameters & v) const

Definition at line 765 of file G4ViewParameters.cc.

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

◆ SceneModifyingCommands()

G4String G4ViewParameters::SceneModifyingCommands ( ) const

Definition at line 481 of file G4ViewParameters.cc.

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

◆ SetAutoRefresh()

◆ SetAuxEdgeVisible()

◆ SetBackgroundColour()

void G4ViewParameters::SetBackgroundColour ( const G4Colour & )

◆ SetCBDAlgorithmNumber()

void G4ViewParameters::SetCBDAlgorithmNumber ( G4int )

◆ SetCBDParameters()

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

◆ SetCulling()

void G4ViewParameters::SetCulling ( G4bool )

◆ 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 )

◆ SetDolly()

◆ SetDotsSize()

void G4ViewParameters::SetDotsSize ( G4double )

◆ SetDotsSmooth()

void G4ViewParameters::SetDotsSmooth ( G4bool )

◆ SetDrawingStyle()

◆ SetExplodeCentre()

void G4ViewParameters::SetExplodeCentre ( const G4Point3D & explodeCentre)

◆ SetExplodeFactor()

void G4ViewParameters::SetExplodeFactor ( G4double explodeFactor)

◆ SetFieldHalfAngle()

void G4ViewParameters::SetFieldHalfAngle ( G4double fieldHalfAngle)

◆ SetGlobalLineWidthScale()

void G4ViewParameters::SetGlobalLineWidthScale ( G4double globalLineWidthScale)

◆ SetGlobalMarkerScale()

void G4ViewParameters::SetGlobalMarkerScale ( G4double globalMarkerScale)

◆ SetLightpointDirection()

void G4ViewParameters::SetLightpointDirection ( const G4Vector3D & lightpointDirection)

Definition at line 266 of file G4ViewParameters.cc.

267 {
268 fRelativeLightpointDirection = lightpointDirection;
269 SetViewAndLights (fViewpointDirection);
270}

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

◆ SetLightsMoveWithCamera()

◆ SetMarkerHidden()

void G4ViewParameters::SetMarkerHidden ( )

◆ SetMarkerNotHidden()

void G4ViewParameters::SetMarkerNotHidden ( )

◆ SetNoOfSides()

G4int G4ViewParameters::SetNoOfSides ( G4int nSides)

Definition at line 210 of file G4ViewParameters.cc.

210 {
211 const G4int nSidesMin = fDefaultVisAttributes.GetMinLineSegmentsPerCircle();
212 if (nSides < nSidesMin) {
213 nSides = nSidesMin;
214 G4warn << "G4ViewParameters::SetNoOfSides: attempt to set the"
215 "\nnumber of sides per circle < " << nSidesMin
216 << "; forced to " << nSides << G4endl;
217 }
218 fNoOfSides = nSides;
219 return fNoOfSides;
220}

Referenced by G4VisCommandsViewerSet::SetNewValue().

◆ SetNumberOfCloudPoints()

G4int G4ViewParameters::SetNumberOfCloudPoints ( G4int nPoints)

Definition at line 222 of file G4ViewParameters.cc.

222 {
223 const G4int nPointsMin = 100;
224 if (nPoints < nPointsMin) {
225 nPoints = nPointsMin;
226 G4warn << "G4ViewParameters::SetNumberOfCloudPoints:"
227 "\nnumber of points per cloud set to minimum " << nPoints
228 << G4endl;
229 }
230 fNumberOfCloudPoints = nPoints;
231 return fNumberOfCloudPoints;
232}

Referenced by G4VisCommandsViewerSet::SetNewValue().

◆ SetOrthogonalProjection()

void G4ViewParameters::SetOrthogonalProjection ( )

◆ SetPan()

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

Definition at line 272 of file G4ViewParameters.cc.

272 {
273 G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
274 G4Vector3D unitUp = (fViewpointDirection.cross (unitRight)).unit();
275 fCurrentTargetPoint = right * unitRight + up * unitUp;
276}

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 > & )

◆ SetTimeParameters()

void G4ViewParameters::SetTimeParameters ( const G4ModelingParameters::TimeParameters & )

◆ SetTransparencyByDepth()

void G4ViewParameters::SetTransparencyByDepth ( G4double )

◆ SetTransparencyByDepthOption()

void G4ViewParameters::SetTransparencyByDepthOption ( G4int )

◆ SetUpVector()

void G4ViewParameters::SetUpVector ( const G4Vector3D & upVector)

◆ SetViewAndLights()

void G4ViewParameters::SetViewAndLights ( const G4Vector3D & viewpointDirection)

Definition at line 234 of file G4ViewParameters.cc.

235 {
236
237 fViewpointDirection = viewpointDirection;
238
239 // If the requested viewpoint direction is parallel to the up
240 // vector, the orientation of the view is undefined...
241 if (fViewpointDirection.unit() * fUpVector.unit() > .9999) {
242 static G4bool firstTime = true;
243 if (firstTime) {
244 firstTime = false;
245 G4warn <<
246 "WARNING: Viewpoint direction is very close to the up vector direction."
247 "\n Change the up vector or \"/vis/viewer/set/rotationStyle freeRotation\"."
248 << G4endl;
249 }
250 }
251
252 // Move the lights too if requested...
253 if (fLightsMoveWithCamera) {
254 G4Vector3D zprime = fViewpointDirection.unit ();
255 G4Vector3D xprime = (fUpVector.cross (zprime)).unit ();
256 G4Vector3D yprime = zprime.cross (xprime);
257 fActualLightpointDirection =
258 fRelativeLightpointDirection.x () * xprime +
259 fRelativeLightpointDirection.y () * yprime +
260 fRelativeLightpointDirection.z () * zprime;
261 } else {
262 fActualLightpointDirection = fRelativeLightpointDirection;
263 }
264}
BasicVector3D< T > cross(const BasicVector3D< T > &v) const

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

◆ SetViewpointDirection()

void G4ViewParameters::SetViewpointDirection ( const G4Vector3D & viewpointDirection)

◆ SetVisibleDensity()

void G4ViewParameters::SetVisibleDensity ( G4double visibleDensity)

Definition at line 193 of file G4ViewParameters.cc.

193 {
194 const G4double reasonableMaximum = 10.0 * g / cm3;
195 if (visibleDensity < 0) {
196 G4warn << "G4ViewParameters::SetVisibleDensity: attempt to set negative "
197 "density - ignored." << G4endl;
198 }
199 else {
200 if (visibleDensity > reasonableMaximum) {
201 G4warn << "G4ViewParameters::SetVisibleDensity: density > "
202 << G4BestUnit (reasonableMaximum, "Volumic Mass")
203 << " - did you mean this?"
204 << G4endl;
205 }
206 fVisibleDensity = visibleDensity;
207 }
208}

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 1243 of file G4ViewParameters.cc.

1244{
1245 const G4String delimiters("xX+-");
1246 G4String::size_type i = geomString.find_first_of(delimiters);
1247 if (i == G4String::npos) {
1248 // Does not contain "xX+-".
1249 // Is it a single number?
1250 std::istringstream iss(geomString);
1251 G4int size;
1252 iss >> size;
1253 if (iss) {
1254 // It is a number
1255 fWindowSizeHintX = size;
1256 fWindowSizeHintY = size;
1257 }
1258 // Accept other or all defaults (in G4ViewParameters constructor)
1259 // Reconstruct a geometry string coherent with the above
1260 char signX, signY;
1261 if (fWindowLocationHintXNegative) signX = '-'; else signX ='+';
1262 if (fWindowLocationHintYNegative) signY = '-'; else signY ='+';
1263 std::ostringstream oss;
1264 oss << fWindowSizeHintX << 'x' << fWindowSizeHintY
1265 << signX << fWindowLocationHintX << signY << fWindowLocationHintY;
1266 fXGeometryString = oss.str();
1267 return;
1268 }
1269
1270 // Assume it's a parseable X geometry string
1271 G4int x = 0, y = 0;
1272 unsigned int w = 0, h = 0;
1273 fGeometryMask = ParseGeometry( geomString, &x, &y, &w, &h );
1274
1275 // Handle special case :
1276 if ((fGeometryMask & fYValue) == 0)
1277 { // Using default
1278 y = fWindowLocationHintY;
1279 }
1280 if ((fGeometryMask & fXValue) == 0)
1281 { // Using default
1282 x = fWindowLocationHintX;
1283 }
1284
1285 // Check errors
1286 // if there is no Width and Height
1287 if ( ((fGeometryMask & fHeightValue) == 0 ) &&
1288 ((fGeometryMask & fWidthValue) == 0 )) {
1289 h = fWindowSizeHintY;
1290 w = fWindowSizeHintX;
1291 } else if ((fGeometryMask & fHeightValue) == 0 ) {
1292
1293 // if there is only Width. Special case to be backward compatible
1294 // We set Width and Height the same to obtain a square windows.
1295
1296 G4warn << "Unrecognised geometry string \""
1297 << geomString
1298 << "\". No Height found. Using Width value instead"
1299 << G4endl;
1300 h = w;
1301 }
1302 if ( ((fGeometryMask & fXValue) == 0 ) ||
1303 ((fGeometryMask & fYValue) == 0 )) {
1304 //Using defaults
1305 x = fWindowLocationHintX;
1306 y = fWindowLocationHintY;
1307 }
1308 // Set the string
1309 fXGeometryString = geomString;
1310
1311 // Set values
1312 fWindowSizeHintX = w;
1313 fWindowSizeHintY = h;
1314 fWindowLocationHintX = x;
1315 fWindowLocationHintY = y;
1316
1317 if ( ((fGeometryMask & fXValue)) &&
1318 ((fGeometryMask & fYValue))) {
1319
1320 if ( (fGeometryMask & fXNegative) ) {
1321 fWindowLocationHintXNegative = true;
1322 } else {
1323 fWindowLocationHintXNegative = false;
1324 }
1325 if ( (fGeometryMask & fYNegative) ) {
1326 fWindowLocationHintYNegative = true;
1327 } else {
1328 fWindowLocationHintYNegative = false;
1329 }
1330 }
1331}

Referenced by G4VisManager::CreateViewer().

◆ SetZoomFactor()

◆ SetZoomToCursor()

void G4ViewParameters::SetZoomToCursor ( G4bool )

◆ TimeWindowCommands()

G4String G4ViewParameters::TimeWindowCommands ( ) const

Definition at line 710 of file G4ViewParameters.cc.

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

◆ TouchableCommands()

G4String G4ViewParameters::TouchableCommands ( ) const

Definition at line 567 of file G4ViewParameters.cc.

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

◆ UnsetExplodeFactor()

void G4ViewParameters::UnsetExplodeFactor ( )

◆ UnsetSectionPlane()

void G4ViewParameters::UnsetSectionPlane ( )

◆ operator<< [1/3]

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

Definition at line 920 of file G4ViewParameters.cc.

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

889{
890 switch (style) {
892 os << "wireframe"; break;
894 os << "hlr - hidden lines removed"; break;
896 os << "hsr - hidden surfaces removed"; break;
898 os << "hlhsr - hidden line, hidden surface removed"; break;
900 os << "cloud - draw volume as a cloud of dots"; break;
901 default: os << "unrecognised"; break;
902 }
903 return os;
904}

◆ operator<< [3/3]

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

Definition at line 906 of file G4ViewParameters.cc.

908{
909 switch (option) {
911 os << "default"; break;
913 os << "dots"; break;
915 os << "surfaces"; break;
916 }
917 return os;
918}

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