File indexing completed on 2026-09-22 08:52:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 #ifndef G4VIEWPARAMETERS_HH
0075 #define G4VIEWPARAMETERS_HH
0076
0077 #include <CLHEP/Units/SystemOfUnits.h>
0078 #include "G4Vector3D.hh"
0079 #include "G4Point3D.hh"
0080 #include "G4Plane3D.hh"
0081 #include "G4VisAttributes.hh"
0082 #include "G4VMarker.hh"
0083 #include "G4ModelingParameters.hh"
0084
0085 #include <vector>
0086 #include <utility>
0087
0088 typedef std::vector<G4Plane3D> G4Planes;
0089
0090 class G4ViewParameters {
0091
0092 public:
0093
0094 enum DrawingStyle {
0095 wireframe,
0096 hlr,
0097 hsr,
0098 hlhsr,
0099 cloud
0100 };
0101
0102 enum CutawayMode {
0103 cutawayUnion,
0104 cutawayIntersection
0105 };
0106
0107 enum RotationStyle {
0108 constrainUpDirection,
0109 freeRotation
0110 };
0111
0112 enum SMROption {
0113 meshAsDefault,
0114 meshAsDots,
0115 meshAsSurfaces
0116 };
0117
0118 friend std::ostream& operator <<
0119 (std::ostream&, DrawingStyle);
0120
0121 friend std::ostream& operator <<
0122 (std::ostream&, SMROption);
0123
0124 friend std::ostream& operator <<
0125 (std::ostream&, const G4ViewParameters&);
0126
0127 G4ViewParameters ();
0128 ~G4ViewParameters ();
0129
0130
0131
0132 G4bool operator != (const G4ViewParameters&) const;
0133
0134
0135 DrawingStyle GetDrawingStyle () const;
0136 G4int GetNumberOfCloudPoints () const;
0137 G4bool IsAuxEdgeVisible () const;
0138 G4bool IsCulling () const;
0139 G4bool IsCullingInvisible () const;
0140 G4bool IsDensityCulling () const;
0141 G4double GetVisibleDensity () const;
0142 G4bool IsCullingCovered () const;
0143 G4int GetCBDAlgorithmNumber () const;
0144 const std::vector<G4double>& GetCBDParameters () const;
0145 G4bool IsSection () const;
0146 const G4Plane3D& GetSectionPlane () const;
0147 G4bool IsCutaway () const;
0148 CutawayMode GetCutawayMode () const;
0149 const G4Planes& GetCutawayPlanes () const;
0150 G4bool IsExplode () const;
0151 G4double GetExplodeFactor () const;
0152 const G4Point3D& GetExplodeCentre () const;
0153 G4int GetNoOfSides () const;
0154 const G4Vector3D& GetViewpointDirection () const;
0155 const G4Vector3D& GetUpVector () const;
0156 G4double GetFieldHalfAngle () const;
0157 G4double GetZoomFactor () const;
0158 const G4Vector3D& GetScaleFactor () const;
0159 const G4Point3D& GetCurrentTargetPoint () const;
0160 G4double GetDolly () const;
0161 G4bool GetLightsMoveWithCamera () const;
0162 const G4Vector3D& GetLightpointDirection () const;
0163 G4Vector3D& GetActualLightpointDirection ();
0164
0165 const G4VisAttributes* GetDefaultVisAttributes () const;
0166 const G4VisAttributes* GetDefaultTextVisAttributes () const;
0167 const G4VMarker& GetDefaultMarker () const;
0168 G4double GetGlobalMarkerScale () const;
0169 G4double GetGlobalLineWidthScale () const;
0170 G4bool IsMarkerNotHidden () const;
0171 unsigned int GetWindowSizeHintX () const;
0172 unsigned int GetWindowSizeHintY () const;
0173 G4int GetWindowAbsoluteLocationHintX (G4int) const;
0174 G4int GetWindowAbsoluteLocationHintY (G4int) const;
0175 G4int GetWindowLocationHintX () const;
0176 G4int GetWindowLocationHintY () const;
0177 G4bool IsWindowLocationHintXNegative () const;
0178 G4bool IsWindowLocationHintYNegative () const;
0179 const G4String& GetXGeometryString () const;
0180
0181
0182
0183
0184
0185
0186
0187 bool IsWindowSizeHintX () const;
0188 bool IsWindowSizeHintY () const;
0189 bool IsWindowLocationHintX () const;
0190 bool IsWindowLocationHintY () const;
0191 G4bool IsAutoRefresh () const;
0192 const G4Colour& GetBackgroundColour () const;
0193 G4bool IsPicking () const;
0194 RotationStyle GetRotationStyle () const;
0195 const std::vector<G4ModelingParameters::VisAttributesModifier>&
0196 GetVisAttributesModifiers () const;
0197 const G4ModelingParameters::TimeParameters&
0198 GetTimeParameters () const;
0199 G4bool IsSpecialMeshRendering () const;
0200 SMROption GetSpecialMeshRenderingOption () const;
0201 const std::vector<G4ModelingParameters::PVNameCopyNo>& GetSpecialMeshVolumes () const;
0202 G4double GetTransparencyByDepth () const;
0203 G4int GetTransparencyByDepthOption () const;
0204 G4bool IsZoomToCursor () const;
0205 G4bool IsDotsSmooth () const;
0206 G4double GetDotsSize () const;
0207
0208
0209
0210
0211
0212
0213
0214 G4double GetCameraDistance (G4double radius) const;
0215 G4double GetNearDistance (G4double cameraDistance, G4double radius) const;
0216 G4double GetFarDistance (G4double cameraDistance,
0217 G4double nearDistance, G4double radius) const;
0218 G4double GetFrontHalfHeight (G4double nearDistance, G4double radius) const;
0219
0220
0221 void SetDrawingStyle (G4ViewParameters::DrawingStyle style);
0222 G4int SetNumberOfCloudPoints (G4int);
0223 void SetAuxEdgeVisible (G4bool);
0224 void SetCulling (G4bool);
0225 void SetCullingInvisible (G4bool);
0226 void SetDensityCulling (G4bool);
0227 void SetVisibleDensity (G4double visibleDensity);
0228 void SetCullingCovered (G4bool);
0229 void SetCBDAlgorithmNumber (G4int);
0230 void SetCBDParameters (const std::vector<G4double>&);
0231 void SetSectionPlane (const G4Plane3D& sectionPlane);
0232 void UnsetSectionPlane ();
0233 void SetCutawayMode (CutawayMode);
0234 void AddCutawayPlane (const G4Plane3D& cutawayPlane);
0235 void ChangeCutawayPlane (size_t index, const G4Plane3D& cutawayPlane);
0236 void ClearCutawayPlanes ();
0237 void SetExplodeFactor (G4double explodeFactor);
0238 void UnsetExplodeFactor ();
0239 void SetExplodeCentre (const G4Point3D& explodeCentre);
0240 G4int SetNoOfSides (G4int nSides);
0241 void SetViewpointDirection (const G4Vector3D& viewpointDirection);
0242
0243 void SetViewAndLights (const G4Vector3D& viewpointDirection);
0244
0245 void SetUpVector (const G4Vector3D& upVector);
0246 void SetFieldHalfAngle (G4double fieldHalfAngle);
0247 void SetOrthogonalProjection ();
0248 void SetPerspectiveProjection(G4double fieldHalfAngle = 30. * CLHEP::deg);
0249 void SetZoomFactor (G4double zoomFactor);
0250 void MultiplyZoomFactor (G4double zoomFactorMultiplier);
0251 void SetScaleFactor (const G4Vector3D& scaleFactor);
0252 void MultiplyScaleFactor (const G4Vector3D& scaleFactorMultiplier);
0253 void SetCurrentTargetPoint (const G4Point3D& currentTargetPoint);
0254 void SetDolly (G4double dolly);
0255 void IncrementDolly (G4double dollyIncrement);
0256 void SetLightpointDirection (const G4Vector3D& lightpointDirection);
0257 void SetLightsMoveWithCamera (G4bool moves);
0258 void SetPan (G4double right, G4double up);
0259 void IncrementPan (G4double right, G4double up);
0260
0261 void IncrementPan (G4double right, G4double up, G4double forward);
0262
0263 void SetDefaultVisAttributes (const G4VisAttributes&);
0264 void SetDefaultColour (const G4Colour&);
0265 void SetDefaultTextVisAttributes (const G4VisAttributes&);
0266 void SetDefaultTextColour (const G4Colour&);
0267 void SetDefaultMarker (const G4VMarker& defaultMarker);
0268 void SetGlobalMarkerScale (G4double globalMarkerScale);
0269 void SetGlobalLineWidthScale (G4double globalLineWidthScale);
0270 void SetMarkerHidden ();
0271 void SetMarkerNotHidden ();
0272 void SetWindowSizeHint (G4int xHint, G4int yHint);
0273 void SetWindowLocationHint (G4int xHint, G4int yHint);
0274 void SetXGeometryString (const G4String&);
0275 void SetAutoRefresh (G4bool);
0276 void SetBackgroundColour (const G4Colour&);
0277 void SetPicking (G4bool);
0278 void SetRotationStyle (RotationStyle);
0279 void ClearVisAttributesModifiers ();
0280 void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier&);
0281 void SetTimeParameters (const G4ModelingParameters::TimeParameters&);
0282 void SetSpecialMeshRendering (G4bool);
0283 void SetSpecialMeshRenderingOption (SMROption);
0284 void SetSpecialMeshVolumes (const std::vector<G4ModelingParameters::PVNameCopyNo>&);
0285 void SetTransparencyByDepth (G4double);
0286 void SetTransparencyByDepthOption (G4int);
0287 void SetZoomToCursor (G4bool);
0288 void SetDotsSmooth (G4bool);
0289 void SetDotsSize (G4double);
0290
0291
0292
0293
0294 G4String CameraAndLightingCommands(const G4Point3D standardTargetPoint) const;
0295 G4String DrawingStyleCommands () const;
0296 G4String SceneModifyingCommands() const;
0297 G4String TouchableCommands () const;
0298 G4String TimeWindowCommands () const;
0299
0300
0301 void PrintDifferences (const G4ViewParameters& v) const;
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312 static G4ViewParameters* CatmullRomCubicSplineInterpolation
0313 (const std::vector<G4ViewParameters>& views,
0314 G4int nInterpolationPoints = 50);
0315
0316 private:
0317
0318 G4int ParseGeometry ( const char *string, G4int *x, G4int *y, unsigned int *width, unsigned int *height);
0319 G4int ReadInteger(char *string, char **NextString);
0320
0321 DrawingStyle fDrawingStyle;
0322 G4int fNumberOfCloudPoints;
0323
0324 G4bool fAuxEdgeVisible;
0325 G4bool fCulling;
0326 G4bool fCullInvisible;
0327 G4bool fDensityCulling;
0328 G4double fVisibleDensity;
0329 G4bool fCullCovered;
0330 G4int fCBDAlgorithmNumber;
0331 std::vector<G4double> fCBDParameters;
0332 G4bool fSection;
0333 G4Plane3D fSectionPlane;
0334 CutawayMode fCutawayMode;
0335 G4Planes fCutawayPlanes;
0336 G4double fExplodeFactor;
0337 G4Point3D fExplodeCentre;
0338 G4int fNoOfSides;
0339 G4Vector3D fViewpointDirection;
0340 G4Vector3D fUpVector;
0341
0342 G4double fFieldHalfAngle;
0343 G4double fZoomFactor;
0344 G4Vector3D fScaleFactor;
0345 G4Point3D fCurrentTargetPoint;
0346 G4double fDolly;
0347 G4bool fLightsMoveWithCamera;
0348 G4Vector3D fRelativeLightpointDirection;
0349
0350 G4Vector3D fActualLightpointDirection;
0351 G4VisAttributes fDefaultVisAttributes;
0352 G4VisAttributes fDefaultTextVisAttributes;
0353 G4VMarker fDefaultMarker;
0354 G4double fGlobalMarkerScale;
0355 G4double fGlobalLineWidthScale;
0356 G4bool fMarkerNotHidden;
0357
0358
0359
0360
0361 G4int fWindowSizeHintX;
0362 G4int fWindowSizeHintY;
0363 G4int fWindowLocationHintX;
0364 G4int fWindowLocationHintY;
0365 G4bool fWindowLocationHintXNegative;
0366 G4bool fWindowLocationHintYNegative;
0367 G4String fXGeometryString;
0368 G4int fGeometryMask;
0369 G4bool fAutoRefresh;
0370 G4Colour fBackgroundColour;
0371 G4bool fPicking;
0372 RotationStyle fRotationStyle;
0373 std::vector<G4ModelingParameters::VisAttributesModifier> fVisAttributesModifiers;
0374 G4ModelingParameters::TimeParameters fTimeParameters;
0375 G4bool fSpecialMeshRendering;
0376 SMROption fSpecialMeshRenderingOption;
0377 std::vector<G4ModelingParameters::PVNameCopyNo> fSpecialMeshVolumes;
0378 G4double fTransparencyByDepth;
0379 G4int fTransparencyByDepthOption;
0380 G4bool fZoomToCursor;
0381 G4bool fDotsSmooth;
0382 G4double fDotsSize;
0383
0384 enum {
0385 fNoValue = 0,
0386 fXValue = 0x0001,
0387 fYValue = 0x0002,
0388 fWidthValue = 0x0004,
0389 fHeightValue = 0x0008,
0390 fAllValues = 0x000F,
0391 fXNegative = 0x0010,
0392 fYNegative = 0x0020
0393 };
0394 };
0395
0396 #include "G4ViewParameters.icc"
0397
0398 #endif