File indexing completed on 2026-09-13 09:15:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Aspect_GridParams_HeaderFile
0015 #define _Aspect_GridParams_HeaderFile
0016
0017 #include <Standard.hxx>
0018 #include <Standard_DefineAlloc.hxx>
0019 #include <Standard_NegativeValue.hxx>
0020
0021 #include <Aspect_GridDrawMode.hxx>
0022 #include <Quantity_Color.hxx>
0023 #include <gp_Pnt.hxx>
0024
0025
0026
0027 class Aspect_GridParams
0028 {
0029 public:
0030 DEFINE_STANDARD_ALLOC
0031
0032
0033
0034
0035 Aspect_GridParams()
0036 : myColor(Quantity_NOC_GRAY70),
0037 myAccentColor(Quantity_NOC_GRAY50),
0038 myOrigin(0.0, 0.0, 0.0),
0039 myScale(0.01),
0040 myScaleY(0.0),
0041 myAccentScaleX(0.0),
0042 myAccentScaleY(0.0),
0043 myAccentAngularScale(0.0),
0044 myLineThickness(0.01),
0045 myRotationAngle(0.0),
0046 mySizeX(0.0),
0047 mySizeY(0.0),
0048 myRadius(0.0),
0049 myZOffset(0.0),
0050 myAngleStart(0.0),
0051 myAngleEnd(0.0),
0052 myAngularDivisions(0),
0053 myDrawMode(Aspect_GDM_Lines),
0054 myIsBackground(false),
0055 myIsDrawAxis(true),
0056 myIsViewAdaptive(false)
0057 {
0058 }
0059
0060
0061 const Quantity_Color& Color() const { return myColor; }
0062
0063
0064 void SetColor(const Quantity_Color& theColor) { myColor = theColor; }
0065
0066
0067 const gp_Pnt& Origin() const { return myOrigin; }
0068
0069
0070 void SetOrigin(const gp_Pnt& theOrigin) { myOrigin = theOrigin; }
0071
0072
0073 const Quantity_Color& AccentColor() const { return myAccentColor; }
0074
0075
0076 void SetAccentColor(const Quantity_Color& theColor) { myAccentColor = theColor; }
0077
0078
0079
0080 double AccentScaleX() const { return myAccentScaleX; }
0081
0082
0083 void SetAccentScaleX(const double theScale) { myAccentScaleX = theScale; }
0084
0085
0086
0087 double AccentScaleY() const { return myAccentScaleY; }
0088
0089
0090 void SetAccentScaleY(const double theScale) { myAccentScaleY = theScale; }
0091
0092
0093
0094 double AccentAngularScale() const { return myAccentAngularScale; }
0095
0096
0097 void SetAccentAngularScale(const double theScale) { myAccentAngularScale = theScale; }
0098
0099
0100 double Scale() const { return myScale; }
0101
0102
0103
0104 void SetScale(const double theScale)
0105 {
0106 Standard_NegativeValue_Raise_if(theScale < 0.0, "invalid grid scale");
0107 myScale = theScale;
0108 }
0109
0110
0111 double ScaleY() const { return myScaleY; }
0112
0113
0114 void SetScaleY(const double theScaleY)
0115 {
0116 Standard_NegativeValue_Raise_if(theScaleY < 0.0, "invalid grid Y-scale");
0117 myScaleY = theScaleY;
0118 }
0119
0120
0121 double EffectiveScaleY() const { return myScaleY > 0.0 ? myScaleY : myScale; }
0122
0123
0124 double LineThickness() const { return myLineThickness; }
0125
0126
0127 void SetLineThickness(const double theThickness)
0128 {
0129 Standard_NegativeValue_Raise_if(theThickness < 0.0, "invalid grid line thickness");
0130 myLineThickness = theThickness;
0131 }
0132
0133
0134 double RotationAngle() const { return myRotationAngle; }
0135
0136
0137 void SetRotationAngle(const double theAngle) { myRotationAngle = theAngle; }
0138
0139
0140
0141
0142 int AngularDivisions() const { return myAngularDivisions; }
0143
0144
0145
0146 void SetAngularDivisions(const int theDivisions) { myAngularDivisions = theDivisions; }
0147
0148
0149 bool IsCircular() const { return myAngularDivisions > 0; }
0150
0151
0152 double SizeX() const { return mySizeX; }
0153
0154
0155 void SetSizeX(const double theSize)
0156 {
0157 Standard_NegativeValue_Raise_if(theSize < 0.0, "invalid grid X-size");
0158 mySizeX = theSize;
0159 }
0160
0161
0162 double SizeY() const { return mySizeY; }
0163
0164
0165 void SetSizeY(const double theSize)
0166 {
0167 Standard_NegativeValue_Raise_if(theSize < 0.0, "invalid grid Y-size");
0168 mySizeY = theSize;
0169 }
0170
0171
0172 double Radius() const { return myRadius; }
0173
0174
0175 void SetRadius(const double theRadius)
0176 {
0177 Standard_NegativeValue_Raise_if(theRadius < 0.0, "invalid grid radius");
0178 myRadius = theRadius;
0179 }
0180
0181
0182 double ZOffset() const { return myZOffset; }
0183
0184
0185 void SetZOffset(const double theOffset) { myZOffset = theOffset; }
0186
0187
0188 double AngleStart() const { return myAngleStart; }
0189
0190
0191 double AngleEnd() const { return myAngleEnd; }
0192
0193
0194
0195 void SetArcRange(const double theStart, const double theEnd)
0196 {
0197 myAngleStart = theStart;
0198 myAngleEnd = theEnd;
0199 }
0200
0201
0202 bool IsBounded() const { return mySizeX > 0.0 || mySizeY > 0.0 || myRadius > 0.0; }
0203
0204
0205 bool IsArc() const { return myAngleStart != myAngleEnd; }
0206
0207
0208 Aspect_GridDrawMode DrawMode() const { return myDrawMode; }
0209
0210
0211
0212 void SetDrawMode(const Aspect_GridDrawMode theMode) { myDrawMode = theMode; }
0213
0214
0215 bool IsBackground() const { return myIsBackground; }
0216
0217
0218 void SetIsBackground(const bool theIsBackground) { myIsBackground = theIsBackground; }
0219
0220
0221 bool IsDrawAxis() const { return myIsDrawAxis; }
0222
0223
0224 void SetIsDrawAxis(const bool theIsDrawAxis) { myIsDrawAxis = theIsDrawAxis; }
0225
0226
0227 bool IsViewAdaptive() const { return myIsViewAdaptive; }
0228
0229
0230
0231 void SetIsViewAdaptive(const bool theIsViewAdaptive) { myIsViewAdaptive = theIsViewAdaptive; }
0232
0233 private:
0234 Quantity_Color myColor;
0235 Quantity_Color myAccentColor;
0236 gp_Pnt myOrigin;
0237 double myScale;
0238 double myScaleY;
0239 double myAccentScaleX;
0240 double myAccentScaleY;
0241 double myAccentAngularScale;
0242 double myLineThickness;
0243 double myRotationAngle;
0244 double mySizeX;
0245 double mySizeY;
0246 double myRadius;
0247 double myZOffset;
0248 double myAngleStart;
0249 double myAngleEnd;
0250 int myAngularDivisions;
0251 Aspect_GridDrawMode myDrawMode;
0252 bool myIsBackground;
0253 bool myIsDrawAxis;
0254 bool myIsViewAdaptive;
0255 };
0256
0257 #endif