43 fDrawingStyle (wireframe),
44 fAuxEdgeVisible (false),
46 fCullInvisible (true),
47 fDensityCulling (false),
48 fVisibleDensity (0.01 *
g /
cm3),
52 fCutawayMode (cutawayUnion),
61 fCurrentTargetPoint (),
63 fLightsMoveWithCamera (false),
64 fRelativeLightpointDirection (
G4Vector3D (1., 1., 1.)),
65 fActualLightpointDirection (
G4Vector3D (1., 1., 1.)),
66 fDefaultVisAttributes (),
67 fDefaultTextVisAttributes (
G4Colour (0., 0., 1.)),
69 fGlobalMarkerScale (1.),
70 fGlobalLineWidthScale (1.),
71 fMarkerNotHidden (true),
72 fWindowSizeHintX (600),
73 fWindowSizeHintY (600),
74 fWindowLocationHintX(0),
75 fWindowLocationHintY(0),
76 fWindowLocationHintXNegative(true),
77 fWindowLocationHintYNegative(false),
80 fBackgroundColour (
G4Colour(0.,0.,0.)),
82 fRotationStyle (constrainUpDirection)
92 fScaleFactor.setX(fScaleFactor.x() * scaleFactorMultiplier.x());
93 fScaleFactor.setY(fScaleFactor.y() * scaleFactorMultiplier.y());
94 fScaleFactor.setZ(fScaleFactor.z() * scaleFactorMultiplier.z());
113 cameraDistance = radius;
118 return cameraDistance;
123 const G4double small = 1.e-6 * radius;
124 G4double nearDistance = cameraDistance - radius;
125 if (nearDistance < small) nearDistance = small;
132 G4double farDistance = cameraDistance + radius;
133 if (farDistance < nearDistance) farDistance = nearDistance;
146 return frontHalfHeight;
156 "ERROR: G4ViewParameters::AddCutawayPlane:"
157 "\n A maximum of 3 cutaway planes supported." <<
G4endl;
163 if (index >= fCutawayPlanes.size()) {
165 "ERROR: G4ViewParameters::ChangeCutawayPlane:"
166 "\n Plane " << index <<
" does not exist." <<
G4endl;
168 fCutawayPlanes[index] = cutawayPlane;
174 if (visibleDensity < 0) {
175 G4cout <<
"G4ViewParameters::SetVisibleDensity: attempt to set negative "
176 "density - ignored." <<
G4endl;
179 if (visibleDensity > reasonableMaximum) {
180 G4cout <<
"G4ViewParameters::SetVisibleDensity: density > "
181 <<
G4BestUnit (reasonableMaximum,
"Volumic Mass")
182 <<
" - did you mean this?"
191 if (nSides < nSidesMin) {
193 G4cout <<
"G4ViewParameters::SetNoOfSides: attempt to set the"
194 "\nnumber of sides per circle < " << nSidesMin
195 <<
"; forced to " << nSides <<
G4endl;
204 fViewpointDirection = viewpointDirection;
208 if (fViewpointDirection.unit() * fUpVector.unit() > .9999) {
210 "WARNING: Viewpoint direction is very close to the up vector direction."
211 "\n Consider setting the up vector to obtain definable behaviour."
216 if (fLightsMoveWithCamera) {
217 G4Vector3D zprime = fViewpointDirection.unit ();
218 G4Vector3D xprime = (fUpVector.cross (zprime)).unit ();
220 fActualLightpointDirection =
221 fRelativeLightpointDirection.x () * xprime +
222 fRelativeLightpointDirection.y () * yprime +
223 fRelativeLightpointDirection.x () * zprime;
225 fActualLightpointDirection = fRelativeLightpointDirection;
231 fRelativeLightpointDirection = lightpointDirection;
232 SetViewAndLights (fViewpointDirection);
254 std::ostringstream oss;
256 oss <<
"#\n# Camera and lights commands";
258 oss <<
"\n/vis/viewer/set/viewpointVector "
259 << fViewpointDirection.x()
260 <<
' ' << fViewpointDirection.y()
261 <<
' ' << fViewpointDirection.z();
263 oss <<
"\n/vis/viewer/set/upVector "
265 <<
' ' << fUpVector.y()
266 <<
' ' << fUpVector.z();
268 oss <<
"\n/vis/viewer/set/projection ";
269 if (fFieldHalfAngle == 0.) {
275 << fFieldHalfAngle/
deg
279 oss <<
"\n/vis/viewer/zoomTo "
282 oss <<
"\n/vis/viewer/scaleTo "
284 <<
' ' << fScaleFactor.y()
285 <<
' ' << fScaleFactor.z();
287 oss <<
"\n/vis/viewer/set/targetPoint "
288 <<
G4BestUnit(standardTargetPoint+fCurrentTargetPoint,
"Length")
289 <<
"\n# Note that if you have not set a target point, the vis system sets"
290 <<
"\n# a target point based on the scene - plus any panning and dollying -"
291 <<
"\n# so don't be alarmed by strange coordinates here.";
293 oss <<
"\n/vis/viewer/dollyTo "
296 oss <<
"\n/vis/viewer/set/lightsMove ";
297 if (fLightsMoveWithCamera) {
303 oss <<
"\n/vis/viewer/set/lightsVector "
304 << fRelativeLightpointDirection.x()
305 <<
' ' << fRelativeLightpointDirection.y()
306 <<
' ' << fRelativeLightpointDirection.z();
308 oss <<
"\n/vis/viewer/set/rotationStyle ";
309 if (fRotationStyle == constrainUpDirection) {
310 oss <<
"constrainUpDirection";
312 oss <<
"freeRotation";
316 oss <<
"\n/vis/viewer/set/background "
323 oss <<
"\n/vis/viewer/set/defaultColour "
329 c = fDefaultTextVisAttributes.
GetColour();
330 oss <<
"\n/vis/viewer/set/defaultTextColour "
343 std::ostringstream oss;
345 oss <<
"#\n# Drawing style commands";
347 oss <<
"\n/vis/viewer/set/style ";
354 oss <<
"\n/vis/viewer/set/hiddenEdge ";
361 oss <<
"\n/vis/viewer/set/auxiliaryEdge ";
368 oss <<
"\n/vis/viewer/set/hiddenMarker ";
375 oss <<
"\n/vis/viewer/set/globalLineWidthScale "
378 oss <<
"\n/vis/viewer/set/globalMarkerScale "
388 std::ostringstream oss;
390 oss <<
"#\n# Scene-modifying commands";
392 oss <<
"\n/vis/viewer/set/culling global ";
399 oss <<
"\n/vis/viewer/set/culling invisible ";
406 oss <<
"\n/vis/viewer/set/culling density ";
413 oss <<
"\n/vis/viewer/set/culling coveredDaughters ";
420 oss <<
"\n/vis/viewer/set/sectionPlane ";
431 oss <<
"\n/vis/viewer/set/cutawayMode ";
435 oss <<
"intersection";
438 oss <<
"\n/vis/viewer/clearCutawayPlanes";
441 oss <<
"\n/vis/viewer/addCutawayPlane "
448 oss <<
"\n# No cutaway planes defined.";
451 oss <<
"\n/vis/viewer/set/explodeFactor "
455 oss <<
"\n/vis/viewer/set/lineSegmentsPerCircle "
465 std::ostringstream oss;
467 oss <<
"#\n# Touchable commands";
469 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
478 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
480 for (iModifier = vams.begin();
481 iModifier != vams.end();
485 iModifier->GetPVNameCopyNoPath();
486 if (vamPath != lastPath) {
488 oss <<
"\n/vis/set/touchable";
490 for (iVAM = vamPath.begin();
491 iVAM != vamPath.end();
493 oss <<
' ' << iVAM->GetName() <<
' ' << iVAM->GetCopyNo();
498 switch (iModifier->GetVisAttributesSignifier()) {
500 oss <<
"\n/vis/touchable/set/visibility ";
508 oss <<
"\n/vis/touchable/set/daughtersInvisible ";
516 oss <<
"\n/vis/touchable/set/colour "
523 oss <<
"\n/vis/touchable/set/lineStyle ";
536 oss <<
"\n/vis/touchable/set/lineWidth "
541 oss <<
"\n/vis/touchable/set/forceWireframe ";
551 oss <<
"\n/vis/touchable/set/forceSolid ";
560 oss <<
"\n/vis/touchable/set/forceAuxEdgeVisible ";
568 oss <<
"\n/vis/touchable/set/lineSegmentsPerCircle "
623 G4cout <<
"Difference in section planes batch." <<
G4endl;
628 G4cout <<
"Difference in no of cutaway planes." <<
G4endl;
633 G4cout <<
"Difference in cutaway plane no. " << i << G4endl;
650 os <<
"wireframe";
break;
652 os <<
"hlr - hidden lines removed";
break;
654 os <<
"hsr - hidden surfaces removed";
break;
656 os <<
"hlhsr - hidden line, hidden surface removed";
break;
657 default: os <<
"unrecognised";
break;
663 os <<
"View parameters and options:";
665 os <<
"\n Drawing style: ";
668 os <<
"edges, wireframe";
break;
670 os <<
"edges, hidden line removal";
break;
672 os <<
"surfaces, hidden surface removal";
break;
674 os <<
"surfaces and edges, hidden line and surface removal";
break;
675 default: os <<
"unrecognised";
break;
678 os <<
"\n Auxiliary edges: ";
682 os <<
"\n Culling: ";
686 os <<
"\n Culling invisible objects: ";
690 os <<
"\n Density culling: ";
692 os <<
"on - invisible if density less than "
697 os <<
"\n Culling daughters covered by opaque mothers: ";
701 os <<
"\n Section flag: ";
706 os <<
"\n Cutaway planes: ";
712 os <<
"\n No cutaway planes";
718 os <<
"\n No. of sides used in circle polygon approximation: "
733 os <<
"\n Dolly distance: " << v.
fDolly;
737 else os <<
"does not move";
738 os <<
" with camera";
740 os <<
"\n Relative lightpoint direction: "
743 os <<
"\n Actual lightpoint direction: "
746 os <<
"\n Derived parameters for standard view of object of unit radius:";
757 os <<
"\n Camera distance: " << cameraDistance;
758 os <<
"\n Near distance: " << nearDistance;
759 os <<
"\n Far distance: " << farDistance;
760 os <<
"\n Front half height: " <<
right;
774 os <<
"hidden by surfaces.";
776 os <<
"\n Window size hint: "
780 os <<
"\n X geometry mask: "
782 << std::noshowbase << std::dec;
784 os <<
"\n Auto refresh: ";
790 os <<
"\n Picking requested: ";
794 os <<
"\n Rotation style: ";
797 os <<
"constrainUpDirection (conventional HEP view)";
break;
799 os <<
"freeRotation (Google-like rotation, using mouse-grab)";
break;
800 default: os <<
"unrecognised";
break;
803 os <<
"\n Vis attributes modifiers: ";
804 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
887 unsigned int w,h = 0;
888 G4String geomString = geomStringArg;
891 G4String::size_type i = geomString.find_first_of(delimiters);
892 if (i == G4String::npos) {
893 std::istringstream iss(geomString);
898 G4cout <<
"Unrecognised windowSizeHint string: \""
900 <<
"\". Asuuming " << size <<
G4endl;
902 std::ostringstream oss;
903 oss << size <<
'x' << size;
904 geomString = oss.str();
930 G4cout <<
"Unrecognised geometry string \""
932 <<
"\". No Height found. Using Width value instead"
1000 unsigned int *height)
1005 unsigned int tempWidth = 0;
1006 unsigned int tempHeight = 0;
1009 char *nextCharacter;
1010 if ( (
string == NULL) || (*
string ==
'\0')) {
1015 strind = (
char *)
string;
1016 if (*strind !=
'+' && *strind !=
'-' && *strind !=
'x') {
1018 if (strind == nextCharacter)
1020 strind = nextCharacter;
1023 if (*strind ==
'x' || *strind ==
'X') {
1026 if (strind == nextCharacter)
1028 strind = nextCharacter;
1032 if ((*strind ==
'+') || (*strind ==
'-')) {
1033 if (*strind ==
'-') {
1036 if (strind == nextCharacter)
1038 strind = nextCharacter;
1045 if (strind == nextCharacter)
1047 strind = nextCharacter;
1050 if ((*strind ==
'+') || (*strind ==
'-')) {
1051 if (*strind ==
'-') {
1054 if (strind == nextCharacter)
1056 strind = nextCharacter;
1063 if (strind == nextCharacter)
1065 strind = nextCharacter;
1072 if (*strind !=
'\0')
return (0);
1080 *height = tempHeight;
1095 else if (*
string ==
'-')
1100 for (; (*
string >=
'0') && (*
string <=
'9');
string++)
1102 Result = (Result * 10) + (*
string -
'0');
1104 *NextString = string;
G4Colour fBackgroundColour
G4bool IsForceAuxEdgeVisible() const
G4String TouchableCommands() const
void IncrementPan(G4double right, G4double up)
G4Vector3D & GetActualLightpointDirection()
G4double GetAlpha() const
void AddCutawayPlane(const G4Plane3D &cutawayPlane)
void SetLightpointDirection(const G4Vector3D &lightpointDirection)
void SetPan(G4double right, G4double up)
G4int SetNoOfSides(G4int nSides)
G4int GetWindowAbsoluteLocationHintX(G4int) const
G4double GetLineWidth() const
G4bool fLightsMoveWithCamera
G4double fGlobalMarkerScale
G4bool operator!=(const G4ViewParameters &) const
std::ostream & operator<<(std::ostream &os, const G4ViewParameters::DrawingStyle &style)
G4int GetWindowAbsoluteLocationHintY(G4int) const
static G4bool GetColour(const G4String &key, G4Colour &result)
const G4Colour & GetColour() const
G4String SceneModifyingCommands() const
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
G4int ReadInteger(char *string, char **NextString)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
void SetVisibleDensity(G4double visibleDensity)
G4String fXGeometryString
LineStyle GetLineStyle() const
G4double GetCameraDistance(G4double radius) const
void SetViewAndLights(const G4Vector3D &viewpointDirection)
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
G4int fWindowLocationHintX
G4GLOB_DLL std::ostream G4cout
static G4int GetMinLineSegmentsPerCircle()
void ChangeCutawayPlane(size_t index, const G4Plane3D &cutawayPlane)
G4Point3D fCurrentTargetPoint
G4bool IsDaughtersInvisible() const
G4double GetGreen() const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
void SetXGeometryString(const G4String &)
G4VisAttributes fDefaultVisAttributes
G4String DrawingStyleCommands() const
G4int GetForcedLineSegmentsPerCircle() const
G4double fGlobalLineWidthScale
void PrintDifferences(const G4ViewParameters &v) const
G4int fWindowLocationHintY
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4Vector3D fRelativeLightpointDirection
G4bool IsForceDrawingStyle() const
G4bool fWindowLocationHintYNegative
RotationStyle fRotationStyle
HepGeom::Plane3D< G4double > G4Plane3D
G4String CameraAndLightingCommands(const G4Point3D standardTargetPoint) const
G4Vector3D fViewpointDirection
void MultiplyScaleFactor(const G4Vector3D &scaleFactorMultiplier)
G4bool fWindowLocationHintXNegative
G4VisAttributes fDefaultTextVisAttributes
short Sign(short a, short b)
G4int ParseGeometry(const char *string, G4int *x, G4int *y, unsigned int *width, unsigned int *height)
ForcedDrawingStyle GetForcedDrawingStyle() const
G4Vector3D fActualLightpointDirection
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
std::vector< G4ModelingParameters::VisAttributesModifier > fVisAttributesModifiers
DrawingStyle fDrawingStyle
G4GLOB_DLL std::ostream G4cerr
void SetScreenSize(G4double)