00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 #ifndef G4VIEWPARAMETERS_HH
00075 #define G4VIEWPARAMETERS_HH
00076
00077 #include <CLHEP/Units/SystemOfUnits.h>
00078 #include "G4Vector3D.hh"
00079 #include "G4Point3D.hh"
00080 #include "G4Plane3D.hh"
00081 #include "G4VisAttributes.hh"
00082 #include "G4VMarker.hh"
00083 #include "G4ModelingParameters.hh"
00084
00085 #include <vector>
00086 #include <utility>
00087
00088 typedef std::vector<G4Plane3D> G4Planes;
00089
00090 class G4ViewParameters {
00091
00092 public:
00093
00094 enum DrawingStyle {
00095 wireframe,
00096 hlr,
00097 hsr,
00098 hlhsr
00099 };
00100
00101 enum RepStyle {
00102 polyhedron,
00103 nurbs
00104 };
00105
00106 enum CutawayMode {
00107 cutawayUnion,
00108 cutawayIntersection
00109 };
00110
00111 enum RotationStyle {
00112 constrainUpDirection,
00113 freeRotation
00114 };
00115
00116 friend std::ostream& operator << (std::ostream&,
00117 const DrawingStyle&);
00118
00119 friend std::ostream& operator << (std::ostream&,
00120 const G4ViewParameters&);
00121
00122 G4ViewParameters ();
00123 ~G4ViewParameters ();
00124
00125
00126
00127 G4bool operator != (const G4ViewParameters&) const;
00128
00129
00130 DrawingStyle GetDrawingStyle () const;
00131 G4bool IsAuxEdgeVisible () const;
00132 RepStyle GetRepStyle () const;
00133 G4bool IsCulling () const;
00134 G4bool IsCullingInvisible () const;
00135 G4bool IsDensityCulling () const;
00136 G4double GetVisibleDensity () const;
00137 G4bool IsCullingCovered () const;
00138 G4bool IsSection () const;
00139 const G4Plane3D& GetSectionPlane () const;
00140 G4bool IsCutaway () const;
00141 CutawayMode GetCutawayMode () const;
00142 const G4Planes& GetCutawayPlanes () const;
00143 G4bool IsExplode () const;
00144 G4double GetExplodeFactor () const;
00145 const G4Point3D& GetExplodeCentre () const;
00146 G4int GetNoOfSides () const;
00147 const G4Vector3D& GetViewpointDirection () const;
00148 const G4Vector3D& GetUpVector () const;
00149 G4double GetFieldHalfAngle () const;
00150 G4double GetZoomFactor () const;
00151 const G4Vector3D& GetScaleFactor () const;
00152 const G4Point3D& GetCurrentTargetPoint () const;
00153 G4double GetDolly () const;
00154 G4bool GetLightsMoveWithCamera () const;
00155 const G4Vector3D& GetLightpointDirection () const;
00156 G4Vector3D& GetActualLightpointDirection ();
00157
00158 const G4VisAttributes* GetDefaultVisAttributes () const;
00159 const G4VisAttributes* GetDefaultTextVisAttributes () const;
00160 const G4VMarker& GetDefaultMarker () const;
00161 G4double GetGlobalMarkerScale () const;
00162 G4double GetGlobalLineWidthScale () const;
00163 G4bool IsMarkerNotHidden () const;
00164 unsigned int GetWindowSizeHintX () const;
00165 unsigned int GetWindowSizeHintY () const;
00166 G4int GetWindowAbsoluteLocationHintX (G4int) const;
00167 G4int GetWindowAbsoluteLocationHintY (G4int) const;
00168 G4int GetWindowLocationHintX () const;
00169 G4int GetWindowLocationHintY () const;
00170 const G4String& GetXGeometryString () const;
00171
00172
00173
00174
00175
00176
00177
00178 bool IsWindowSizeHintX () const;
00179 bool IsWindowSizeHintY () const;
00180 bool IsWindowLocationHintX () const;
00181 bool IsWindowLocationHintY () const;
00182 G4bool IsAutoRefresh () const;
00183 const G4Colour& GetBackgroundColour () const;
00184 G4bool IsPicking () const;
00185 RotationStyle GetRotationStyle () const;
00186 const std::vector<G4ModelingParameters::VisAttributesModifier>&
00187 GetVisAttributesModifiers () const;
00188
00189
00190
00191
00192
00193
00194
00195 G4double GetCameraDistance (G4double radius) const;
00196 G4double GetNearDistance (G4double cameraDistance, G4double radius) const;
00197 G4double GetFarDistance (G4double cameraDistance,
00198 G4double nearDistance, G4double radius) const;
00199 G4double GetFrontHalfHeight (G4double nearDistance, G4double radius) const;
00200
00201
00202 void SetDrawingStyle (G4ViewParameters::DrawingStyle style);
00203 void SetAuxEdgeVisible (G4bool);
00204 void SetRepStyle (G4ViewParameters::RepStyle style);
00205 void SetCulling (G4bool);
00206 void SetCullingInvisible (G4bool);
00207 void SetDensityCulling (G4bool);
00208 void SetVisibleDensity (G4double visibleDensity);
00209 void SetCullingCovered (G4bool);
00210 void SetSectionPlane (const G4Plane3D& sectionPlane);
00211 void UnsetSectionPlane ();
00212 void SetCutawayMode (CutawayMode);
00213 void AddCutawayPlane (const G4Plane3D& cutawayPlane);
00214 void ChangeCutawayPlane (size_t index, const G4Plane3D& cutawayPlane);
00215 void ClearCutawayPlanes ();
00216 void SetExplodeFactor (G4double explodeFactor);
00217 void UnsetExplodeFactor ();
00218 void SetExplodeCentre (const G4Point3D& explodeCentre);
00219 G4int SetNoOfSides (G4int nSides);
00220 void SetViewpointDirection (const G4Vector3D& viewpointDirection);
00221
00222 void SetViewAndLights (const G4Vector3D& viewpointDirection);
00223
00224 void SetUpVector (const G4Vector3D& upVector);
00225 void SetFieldHalfAngle (G4double fieldHalfAngle);
00226 void SetOrthogonalProjection ();
00227 void SetPerspectiveProjection(G4double fieldHalfAngle = 30. * CLHEP::deg);
00228 void SetZoomFactor (G4double zoomFactor);
00229 void MultiplyZoomFactor (G4double zoomFactorMultiplier);
00230 void SetScaleFactor (const G4Vector3D& scaleFactor);
00231 void MultiplyScaleFactor (const G4Vector3D& scaleFactorMultiplier);
00232 void SetCurrentTargetPoint (const G4Point3D& currentTargetPoint);
00233 void SetDolly (G4double dolly);
00234 void IncrementDolly (G4double dollyIncrement);
00235 void SetLightpointDirection (const G4Vector3D& lightpointDirection);
00236 void SetLightsMoveWithCamera (G4bool moves);
00237 void SetPan (G4double right, G4double up);
00238 void IncrementPan (G4double right, G4double up);
00239
00240 void IncrementPan (G4double right, G4double up, G4double forward);
00241
00242 void SetDefaultVisAttributes (const G4VisAttributes&);
00243 void SetDefaultColour (const G4Colour&);
00244 void SetDefaultTextVisAttributes (const G4VisAttributes&);
00245 void SetDefaultTextColour (const G4Colour&);
00246 void SetDefaultMarker (const G4VMarker& defaultMarker);
00247 void SetGlobalMarkerScale (G4double globalMarkerScale);
00248 void SetGlobalLineWidthScale (G4double globalLineWidthScale);
00249 void SetMarkerHidden ();
00250 void SetMarkerNotHidden ();
00251 void SetWindowSizeHint (G4int xHint, G4int yHint);
00252 void SetWindowLocationHint (G4int xHint, G4int yHint);
00253 void SetXGeometryString (const G4String&);
00254 void SetAutoRefresh (G4bool);
00255 void SetBackgroundColour (const G4Colour&);
00256 void SetPicking (G4bool);
00257 void SetRotationStyle (RotationStyle);
00258 void AddVisAttributesModifier
00259 (const G4ModelingParameters::VisAttributesModifier&);
00260
00261
00262
00263
00264 G4String CameraAndLightingCommands(const G4Point3D standardTargetPoint) const;
00265 G4String DrawingStyleCommands () const;
00266 G4String SceneModifyingCommands() const;
00267 G4String TouchableCommands () const;
00268
00269
00270 void PrintDifferences (const G4ViewParameters& v) const;
00271
00272 private:
00273
00274 G4int ParseGeometry ( const char *string, G4int *x, G4int *y, unsigned int *width, unsigned int *height);
00275 G4int ReadInteger(char *string, char **NextString);
00276
00277 DrawingStyle fDrawingStyle;
00278 G4bool fAuxEdgeVisible;
00279 RepStyle fRepStyle;
00280 G4bool fCulling;
00281 G4bool fCullInvisible;
00282 G4bool fDensityCulling;
00283 G4double fVisibleDensity;
00284 G4bool fCullCovered;
00285 G4bool fSection;
00286 G4Plane3D fSectionPlane;
00287 CutawayMode fCutawayMode;
00288 G4Planes fCutawayPlanes;
00289 G4double fExplodeFactor;
00290 G4Point3D fExplodeCentre;
00291 G4int fNoOfSides;
00292 G4Vector3D fViewpointDirection;
00293 G4Vector3D fUpVector;
00294
00295 G4double fFieldHalfAngle;
00296 G4double fZoomFactor;
00297 G4Vector3D fScaleFactor;
00298 G4Point3D fCurrentTargetPoint;
00299 G4double fDolly;
00300 G4bool fLightsMoveWithCamera;
00301 G4Vector3D fRelativeLightpointDirection;
00302
00303 G4Vector3D fActualLightpointDirection;
00304 G4VisAttributes fDefaultVisAttributes;
00305 G4VisAttributes fDefaultTextVisAttributes;
00306 G4VMarker fDefaultMarker;
00307 G4double fGlobalMarkerScale;
00308 G4double fGlobalLineWidthScale;
00309 G4bool fMarkerNotHidden;
00310
00311
00312
00313
00314 G4int fWindowSizeHintX;
00315 G4int fWindowSizeHintY;
00316 G4int fWindowLocationHintX;
00317 G4int fWindowLocationHintY;
00318 G4bool fWindowLocationHintXNegative;
00319 G4bool fWindowLocationHintYNegative;
00320 G4String fXGeometryString;
00321 G4int fGeometryMask;
00322 G4bool fAutoRefresh;
00323 G4Colour fBackgroundColour;
00324 G4bool fPicking;
00325 RotationStyle fRotationStyle;
00326 std::vector<G4ModelingParameters::VisAttributesModifier>
00327 fVisAttributesModifiers;
00328
00329 enum {
00330 fNoValue = 0,
00331 fXValue = 0x0001,
00332 fYValue = 0x0002,
00333 fWidthValue = 0x0004,
00334 fHeightValue = 0x0008,
00335 fAllValues = 0x000F,
00336 fXNegative = 0x0010,
00337 fYNegative = 0x0020
00338 };
00339 };
00340
00341 #include "G4ViewParameters.icc"
00342
00343 #endif