File indexing completed on 2025-01-18 09:59:22
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 G4double GetStartTime () const;
0198 G4double GetEndTime () const;
0199 G4double GetFadeFactor () const;
0200 G4bool IsDisplayHeadTime () const;
0201 G4double GetDisplayHeadTimeX () const;
0202 G4double GetDisplayHeadTimeY () const;
0203 G4double GetDisplayHeadTimeSize () const;
0204 G4double GetDisplayHeadTimeRed () const;
0205 G4double GetDisplayHeadTimeGreen () const;
0206 G4double GetDisplayHeadTimeBlue () const;
0207 G4bool IsDisplayLightFront () const;
0208 G4double GetDisplayLightFrontX () const;
0209 G4double GetDisplayLightFrontY () const;
0210 G4double GetDisplayLightFrontZ () const;
0211 G4double GetDisplayLightFrontT () const;
0212 G4double GetDisplayLightFrontRed () const;
0213 G4double GetDisplayLightFrontGreen () const;
0214 G4double GetDisplayLightFrontBlue () const;
0215 G4bool IsSpecialMeshRendering () const;
0216 SMROption GetSpecialMeshRenderingOption () const;
0217 const std::vector<G4ModelingParameters::PVNameCopyNo>& GetSpecialMeshVolumes() const;
0218
0219
0220
0221
0222
0223
0224
0225 G4double GetCameraDistance (G4double radius) const;
0226 G4double GetNearDistance (G4double cameraDistance, G4double radius) const;
0227 G4double GetFarDistance (G4double cameraDistance,
0228 G4double nearDistance, G4double radius) const;
0229 G4double GetFrontHalfHeight (G4double nearDistance, G4double radius) const;
0230
0231
0232 void SetDrawingStyle (G4ViewParameters::DrawingStyle style);
0233 G4int SetNumberOfCloudPoints (G4int);
0234 void SetAuxEdgeVisible (G4bool);
0235 void SetCulling (G4bool);
0236 void SetCullingInvisible (G4bool);
0237 void SetDensityCulling (G4bool);
0238 void SetVisibleDensity (G4double visibleDensity);
0239 void SetCullingCovered (G4bool);
0240 void SetCBDAlgorithmNumber (G4int);
0241 void SetCBDParameters (const std::vector<G4double>&);
0242 void SetSectionPlane (const G4Plane3D& sectionPlane);
0243 void UnsetSectionPlane ();
0244 void SetCutawayMode (CutawayMode);
0245 void AddCutawayPlane (const G4Plane3D& cutawayPlane);
0246 void ChangeCutawayPlane (size_t index, const G4Plane3D& cutawayPlane);
0247 void ClearCutawayPlanes ();
0248 void SetExplodeFactor (G4double explodeFactor);
0249 void UnsetExplodeFactor ();
0250 void SetExplodeCentre (const G4Point3D& explodeCentre);
0251 G4int SetNoOfSides (G4int nSides);
0252 void SetViewpointDirection (const G4Vector3D& viewpointDirection);
0253
0254 void SetViewAndLights (const G4Vector3D& viewpointDirection);
0255
0256 void SetUpVector (const G4Vector3D& upVector);
0257 void SetFieldHalfAngle (G4double fieldHalfAngle);
0258 void SetOrthogonalProjection ();
0259 void SetPerspectiveProjection(G4double fieldHalfAngle = 30. * CLHEP::deg);
0260 void SetZoomFactor (G4double zoomFactor);
0261 void MultiplyZoomFactor (G4double zoomFactorMultiplier);
0262 void SetScaleFactor (const G4Vector3D& scaleFactor);
0263 void MultiplyScaleFactor (const G4Vector3D& scaleFactorMultiplier);
0264 void SetCurrentTargetPoint (const G4Point3D& currentTargetPoint);
0265 void SetDolly (G4double dolly);
0266 void IncrementDolly (G4double dollyIncrement);
0267 void SetLightpointDirection (const G4Vector3D& lightpointDirection);
0268 void SetLightsMoveWithCamera (G4bool moves);
0269 void SetPan (G4double right, G4double up);
0270 void IncrementPan (G4double right, G4double up);
0271
0272 void IncrementPan (G4double right, G4double up, G4double forward);
0273
0274 void SetDefaultVisAttributes (const G4VisAttributes&);
0275 void SetDefaultColour (const G4Colour&);
0276 void SetDefaultTextVisAttributes (const G4VisAttributes&);
0277 void SetDefaultTextColour (const G4Colour&);
0278 void SetDefaultMarker (const G4VMarker& defaultMarker);
0279 void SetGlobalMarkerScale (G4double globalMarkerScale);
0280 void SetGlobalLineWidthScale (G4double globalLineWidthScale);
0281 void SetMarkerHidden ();
0282 void SetMarkerNotHidden ();
0283 void SetWindowSizeHint (G4int xHint, G4int yHint);
0284 void SetWindowLocationHint (G4int xHint, G4int yHint);
0285 void SetXGeometryString (const G4String&);
0286 void SetAutoRefresh (G4bool);
0287 void SetBackgroundColour (const G4Colour&);
0288 void SetPicking (G4bool);
0289 void SetRotationStyle (RotationStyle);
0290 void ClearVisAttributesModifiers ();
0291 void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier&);
0292 void SetStartTime (G4double);
0293 void SetEndTime (G4double);
0294 void SetFadeFactor (G4double);
0295 void SetDisplayHeadTime (G4bool);
0296 void SetDisplayHeadTimeX (G4double);
0297 void SetDisplayHeadTimeY (G4double);
0298 void SetDisplayHeadTimeSize (G4double);
0299 void SetDisplayHeadTimeRed (G4double);
0300 void SetDisplayHeadTimeGreen (G4double);
0301 void SetDisplayHeadTimeBlue (G4double);
0302 void SetDisplayLightFront (G4bool);
0303 void SetDisplayLightFrontX (G4double);
0304 void SetDisplayLightFrontY (G4double);
0305 void SetDisplayLightFrontZ (G4double);
0306 void SetDisplayLightFrontT (G4double);
0307 void SetDisplayLightFrontRed (G4double);
0308 void SetDisplayLightFrontGreen (G4double);
0309 void SetDisplayLightFrontBlue (G4double);
0310 void SetSpecialMeshRendering (G4bool);
0311 void SetSpecialMeshRenderingOption (SMROption);
0312 void SetSpecialMeshVolumes (const std::vector<G4ModelingParameters::PVNameCopyNo>&);
0313
0314
0315
0316
0317 G4String CameraAndLightingCommands(const G4Point3D standardTargetPoint) const;
0318 G4String DrawingStyleCommands () const;
0319 G4String SceneModifyingCommands() const;
0320 G4String TouchableCommands () const;
0321 G4String TimeWindowCommands () const;
0322
0323
0324 void PrintDifferences (const G4ViewParameters& v) const;
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335 static G4ViewParameters* CatmullRomCubicSplineInterpolation
0336 (const std::vector<G4ViewParameters>& views,
0337 G4int nInterpolationPoints = 50);
0338
0339 private:
0340
0341 G4int ParseGeometry ( const char *string, G4int *x, G4int *y, unsigned int *width, unsigned int *height);
0342 G4int ReadInteger(char *string, char **NextString);
0343
0344 DrawingStyle fDrawingStyle;
0345 G4int fNumberOfCloudPoints;
0346
0347 G4bool fAuxEdgeVisible;
0348 G4bool fCulling;
0349 G4bool fCullInvisible;
0350 G4bool fDensityCulling;
0351 G4double fVisibleDensity;
0352 G4bool fCullCovered;
0353 G4int fCBDAlgorithmNumber;
0354 std::vector<G4double> fCBDParameters;
0355 G4bool fSection;
0356 G4Plane3D fSectionPlane;
0357 CutawayMode fCutawayMode;
0358 G4Planes fCutawayPlanes;
0359 G4double fExplodeFactor;
0360 G4Point3D fExplodeCentre;
0361 G4int fNoOfSides;
0362 G4Vector3D fViewpointDirection;
0363 G4Vector3D fUpVector;
0364
0365 G4double fFieldHalfAngle;
0366 G4double fZoomFactor;
0367 G4Vector3D fScaleFactor;
0368 G4Point3D fCurrentTargetPoint;
0369 G4double fDolly;
0370 G4bool fLightsMoveWithCamera;
0371 G4Vector3D fRelativeLightpointDirection;
0372
0373 G4Vector3D fActualLightpointDirection;
0374 G4VisAttributes fDefaultVisAttributes;
0375 G4VisAttributes fDefaultTextVisAttributes;
0376 G4VMarker fDefaultMarker;
0377 G4double fGlobalMarkerScale;
0378 G4double fGlobalLineWidthScale;
0379 G4bool fMarkerNotHidden;
0380
0381
0382
0383
0384 G4int fWindowSizeHintX;
0385 G4int fWindowSizeHintY;
0386 G4int fWindowLocationHintX;
0387 G4int fWindowLocationHintY;
0388 G4bool fWindowLocationHintXNegative;
0389 G4bool fWindowLocationHintYNegative;
0390 G4String fXGeometryString;
0391 G4int fGeometryMask;
0392 G4bool fAutoRefresh;
0393 G4Colour fBackgroundColour;
0394 G4bool fPicking;
0395 RotationStyle fRotationStyle;
0396 std::vector<G4ModelingParameters::VisAttributesModifier> fVisAttributesModifiers;
0397 G4double fStartTime, fEndTime;
0398 G4double fFadeFactor;
0399 G4bool fDisplayHeadTime;
0400 G4double fDisplayHeadTimeX, fDisplayHeadTimeY;
0401 G4double fDisplayHeadTimeSize;
0402 G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
0403 G4bool fDisplayLightFront;
0404 G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
0405 fDisplayLightFrontT;
0406 G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
0407 G4bool fSpecialMeshRendering;
0408 SMROption fSpecialMeshRenderingOption;
0409 std::vector<G4ModelingParameters::PVNameCopyNo> fSpecialMeshVolumes;
0410
0411 enum {
0412 fNoValue = 0,
0413 fXValue = 0x0001,
0414 fYValue = 0x0002,
0415 fWidthValue = 0x0004,
0416 fHeightValue = 0x0008,
0417 fAllValues = 0x000F,
0418 fXNegative = 0x0010,
0419 fYNegative = 0x0020
0420 };
0421 };
0422
0423 #include "G4ViewParameters.icc"
0424
0425 #endif