File indexing completed on 2026-09-14 09:16:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _XCAFDimTolObjects_DimensionObject_HeaderFile
0018 #define _XCAFDimTolObjects_DimensionObject_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022
0023 #include <XCAFDimTolObjects_DimensionType.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_HArray1.hxx>
0026 #include <XCAFDimTolObjects_DimensionQualifier.hxx>
0027 #include <XCAFDimTolObjects_DimensionFormVariance.hxx>
0028 #include <XCAFDimTolObjects_DimensionGrade.hxx>
0029 #include <Standard_Integer.hxx>
0030 #include <NCollection_Sequence.hxx>
0031 #include <XCAFDimTolObjects_DimensionModif.hxx>
0032 #include <TopoDS_Edge.hxx>
0033 #include <gp_Dir.hxx>
0034 #include <gp_Ax2.hxx>
0035 #include <gp_Pnt.hxx>
0036 #include <Standard_Transient.hxx>
0037 #include <Standard_Real.hxx>
0038 #include <TCollection_HAsciiString.hxx>
0039 #include <NCollection_DynamicArray.hxx>
0040 #include <XCAFDimTolObjects_AngularQualifier.hxx>
0041 class XCAFDimTolObjects_DimensionObject;
0042
0043
0044 class XCAFDimTolObjects_DimensionObject : public Standard_Transient
0045 {
0046
0047 public:
0048 Standard_EXPORT XCAFDimTolObjects_DimensionObject();
0049
0050 Standard_EXPORT XCAFDimTolObjects_DimensionObject(
0051 const occ::handle<XCAFDimTolObjects_DimensionObject>& theObj);
0052
0053
0054 Standard_EXPORT occ::handle<TCollection_HAsciiString> GetSemanticName() const;
0055
0056
0057 Standard_EXPORT void SetSemanticName(const occ::handle<TCollection_HAsciiString>& theName);
0058
0059
0060 Standard_EXPORT void SetQualifier(const XCAFDimTolObjects_DimensionQualifier theQualifier);
0061
0062
0063 Standard_EXPORT XCAFDimTolObjects_DimensionQualifier GetQualifier() const;
0064
0065
0066 Standard_EXPORT bool HasQualifier() const;
0067
0068
0069 Standard_EXPORT void SetAngularQualifier(
0070 const XCAFDimTolObjects_AngularQualifier theAngularQualifier);
0071
0072
0073 Standard_EXPORT XCAFDimTolObjects_AngularQualifier GetAngularQualifier() const;
0074
0075
0076 Standard_EXPORT bool HasAngularQualifier() const;
0077
0078
0079 Standard_EXPORT void SetType(const XCAFDimTolObjects_DimensionType theTyupe);
0080
0081
0082 Standard_EXPORT XCAFDimTolObjects_DimensionType GetType() const;
0083
0084
0085
0086 Standard_EXPORT double GetValue() const;
0087
0088
0089 Standard_EXPORT occ::handle<NCollection_HArray1<double>> GetValues() const;
0090
0091
0092
0093 Standard_EXPORT void SetValue(const double theValue);
0094
0095
0096 Standard_EXPORT void SetValues(const occ::handle<NCollection_HArray1<double>>& theValue);
0097
0098
0099
0100
0101 Standard_EXPORT bool IsDimWithRange() const;
0102
0103
0104
0105 Standard_EXPORT void SetUpperBound(const double theUpperBound);
0106
0107
0108
0109 Standard_EXPORT void SetLowerBound(const double theLowerBound);
0110
0111
0112 Standard_EXPORT double GetUpperBound() const;
0113
0114
0115 Standard_EXPORT double GetLowerBound() const;
0116
0117
0118
0119
0120 Standard_EXPORT bool IsDimWithPlusMinusTolerance() const;
0121
0122
0123
0124
0125 Standard_EXPORT bool SetUpperTolValue(const double theUperTolValue);
0126
0127
0128
0129
0130 Standard_EXPORT bool SetLowerTolValue(const double theLowerTolValue);
0131
0132
0133 Standard_EXPORT double GetUpperTolValue() const;
0134
0135
0136 Standard_EXPORT double GetLowerTolValue() const;
0137
0138
0139
0140 Standard_EXPORT bool IsDimWithClassOfTolerance() const;
0141
0142
0143
0144
0145
0146
0147 Standard_EXPORT void SetClassOfTolerance(
0148 const bool theHole,
0149 const XCAFDimTolObjects_DimensionFormVariance theFormVariance,
0150 const XCAFDimTolObjects_DimensionGrade theGrade);
0151
0152
0153
0154 Standard_EXPORT bool GetClassOfTolerance(bool& theHole,
0155 XCAFDimTolObjects_DimensionFormVariance& theFormVariance,
0156 XCAFDimTolObjects_DimensionGrade& theGrade) const;
0157
0158
0159 Standard_EXPORT void SetNbOfDecimalPlaces(const int theL, const int theR);
0160
0161
0162 Standard_EXPORT void GetNbOfDecimalPlaces(int& theL, int& theR) const;
0163
0164
0165 Standard_EXPORT NCollection_Sequence<XCAFDimTolObjects_DimensionModif> GetModifiers() const;
0166
0167
0168 Standard_EXPORT void SetModifiers(
0169 const NCollection_Sequence<XCAFDimTolObjects_DimensionModif>& theModifiers);
0170
0171
0172 Standard_EXPORT void AddModifier(const XCAFDimTolObjects_DimensionModif theModifier);
0173
0174
0175 Standard_EXPORT TopoDS_Edge GetPath() const;
0176
0177
0178 Standard_EXPORT void SetPath(const TopoDS_Edge& thePath);
0179
0180
0181 Standard_EXPORT bool GetDirection(gp_Dir& theDir) const;
0182
0183
0184 Standard_EXPORT bool SetDirection(const gp_Dir& theDir);
0185
0186
0187 void SetPointTextAttach(const gp_Pnt& thePntText)
0188 {
0189 myPntText = thePntText;
0190 myHasPntText = true;
0191 }
0192
0193
0194 const gp_Pnt& GetPointTextAttach() const { return myPntText; }
0195
0196
0197 bool HasTextPoint() const { return myHasPntText; }
0198
0199
0200 void SetPlane(const gp_Ax2& thePlane)
0201 {
0202 myPlane = thePlane;
0203 myHasPlane = true;
0204 }
0205
0206
0207 const gp_Ax2& GetPlane() const { return myPlane; }
0208
0209
0210 bool HasPlane() const { return myHasPlane; }
0211
0212
0213
0214 bool HasPoint() const { return myHasConnection1; }
0215
0216
0217 bool HasPoint2() const { return myHasConnection2; }
0218
0219
0220
0221 bool IsPointConnection() const { return myConnectionIsPoint1; }
0222
0223
0224
0225 bool IsPointConnection2() const { return myConnectionIsPoint2; }
0226
0227
0228
0229 void SetPoint(const gp_Pnt& thePnt)
0230 {
0231 myConnection1.SetLocation(thePnt);
0232 myHasConnection1 = true;
0233 myConnectionIsPoint1 = true;
0234 }
0235
0236
0237 void SetPoint2(const gp_Pnt& thePnt)
0238 {
0239 myConnection2.SetLocation(thePnt);
0240 myHasConnection2 = true;
0241 myConnectionIsPoint2 = true;
0242 }
0243
0244
0245
0246 void SetConnectionAxis(const gp_Ax2& theAxis)
0247 {
0248 myConnection1 = theAxis;
0249 myHasConnection1 = true;
0250 myConnectionIsPoint1 = false;
0251 }
0252
0253
0254
0255 void SetConnectionAxis2(const gp_Ax2& theAxis)
0256 {
0257 myConnection2 = theAxis;
0258 myHasConnection2 = true;
0259 myConnectionIsPoint2 = false;
0260 }
0261
0262
0263
0264 gp_Pnt GetPoint() const { return myConnection1.Location(); }
0265
0266
0267 gp_Pnt GetPoint2() const { return myConnection2.Location(); }
0268
0269
0270
0271 gp_Ax2 GetConnectionAxis() const { return myConnection1; }
0272
0273
0274
0275 gp_Ax2 GetConnectionAxis2() const { return myConnection2; }
0276
0277
0278 occ::handle<TCollection_HAsciiString> GetConnectionName() const { return myConnectionName1; }
0279
0280
0281 occ::handle<TCollection_HAsciiString> GetConnectionName2() const { return myConnectionName2; }
0282
0283
0284 void SetConnectionName(const occ::handle<TCollection_HAsciiString>& theName)
0285 {
0286 myConnectionName1 = theName;
0287 }
0288
0289
0290 void SetConnectionName2(const occ::handle<TCollection_HAsciiString>& theName)
0291 {
0292 myConnectionName2 = theName;
0293 }
0294
0295
0296 void SetPresentation(const TopoDS_Shape& thePresentation,
0297 const occ::handle<TCollection_HAsciiString>& thePresentationName)
0298 {
0299 myPresentation = thePresentation;
0300 myPresentationName = thePresentationName;
0301 }
0302
0303
0304 TopoDS_Shape GetPresentation() const { return myPresentation; }
0305
0306
0307 Standard_EXPORT occ::handle<TCollection_HAsciiString> GetPresentationName() const
0308 {
0309 return myPresentationName;
0310 }
0311
0312
0313 bool HasDescriptions() const { return (myDescriptions.Length() > 0); }
0314
0315
0316 int NbDescriptions() const { return myDescriptions.Length(); }
0317
0318
0319 occ::handle<TCollection_HAsciiString> GetDescription(const int theNumber) const
0320 {
0321 if (theNumber < myDescriptions.Lower() || theNumber > myDescriptions.Upper())
0322 return new TCollection_HAsciiString();
0323 return myDescriptions.Value(theNumber);
0324 }
0325
0326
0327 occ::handle<TCollection_HAsciiString> GetDescriptionName(const int theNumber) const
0328 {
0329 if (theNumber < myDescriptions.Lower() || theNumber > myDescriptions.Upper())
0330 return new TCollection_HAsciiString();
0331 return myDescriptionNames.Value(theNumber);
0332 }
0333
0334
0335 Standard_EXPORT void RemoveDescription(const int theNumber);
0336
0337
0338 void AddDescription(const occ::handle<TCollection_HAsciiString> theDescription,
0339 const occ::handle<TCollection_HAsciiString> theName)
0340 {
0341 myDescriptions.Append(theDescription);
0342 myDescriptionNames.Append(theName);
0343 }
0344
0345
0346 Standard_EXPORT static bool IsDimensionalLocation(const XCAFDimTolObjects_DimensionType theType);
0347
0348
0349 Standard_EXPORT static bool IsDimensionalSize(const XCAFDimTolObjects_DimensionType theType);
0350
0351
0352 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0353
0354 DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DimensionObject, Standard_Transient)
0355
0356 private:
0357 XCAFDimTolObjects_DimensionType myType;
0358 occ::handle<NCollection_HArray1<double>> myVal;
0359 XCAFDimTolObjects_DimensionQualifier myQualifier;
0360 XCAFDimTolObjects_AngularQualifier myAngularQualifier;
0361 bool myIsHole;
0362 XCAFDimTolObjects_DimensionFormVariance myFormVariance;
0363 XCAFDimTolObjects_DimensionGrade myGrade;
0364 int myL;
0365 int myR;
0366 NCollection_Sequence<XCAFDimTolObjects_DimensionModif> myModifiers;
0367 TopoDS_Edge myPath;
0368 gp_Dir myDir;
0369 gp_Ax2 myConnection1, myConnection2;
0370 bool myHasConnection1, myHasConnection2;
0371 bool myConnectionIsPoint1, myConnectionIsPoint2;
0372 occ::handle<TCollection_HAsciiString> myConnectionName1, myConnectionName2;
0373 gp_Ax2 myPlane;
0374 bool myHasPlane;
0375 bool myHasPntText;
0376 gp_Pnt myPntText;
0377 TopoDS_Shape myPresentation;
0378 occ::handle<TCollection_HAsciiString> mySemanticName;
0379 occ::handle<TCollection_HAsciiString> myPresentationName;
0380 NCollection_DynamicArray<occ::handle<TCollection_HAsciiString>> myDescriptions;
0381 NCollection_DynamicArray<occ::handle<TCollection_HAsciiString>> myDescriptionNames;
0382 };
0383
0384 #endif