Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:19:31

0001 // Created on: 2015-08-06
0002 // Created by: Ilya Novikov
0003 // Copyright (c) 2004-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
0017 #define _XCAFDimTolObjects_GeomToleranceObject_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <XCAFDimTolObjects_GeomToleranceType.hxx>
0022 #include <XCAFDimTolObjects_GeomToleranceTypeValue.hxx>
0023 #include <Standard_Real.hxx>
0024 #include <XCAFDimTolObjects_GeomToleranceMatReqModif.hxx>
0025 #include <XCAFDimTolObjects_GeomToleranceZoneModif.hxx>
0026 #include <NCollection_Sequence.hxx>
0027 #include <XCAFDimTolObjects_GeomToleranceModif.hxx>
0028 #include <Standard_Transient.hxx>
0029 #include <XCAFDimTolObjects_ToleranceZoneAffectedPlane.hxx>
0030 #include <gp_Pln.hxx>
0031 #include <TopoDS_Shape.hxx>
0032 #include <TCollection_HAsciiString.hxx>
0033 
0034 //! Access object to store dimension and tolerance
0035 class XCAFDimTolObjects_GeomToleranceObject : public Standard_Transient
0036 {
0037 
0038 public:
0039   Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject();
0040 
0041   Standard_EXPORT XCAFDimTolObjects_GeomToleranceObject(
0042     const occ::handle<XCAFDimTolObjects_GeomToleranceObject>& theObj);
0043 
0044   //! Returns semantic name
0045   Standard_EXPORT occ::handle<TCollection_HAsciiString> GetSemanticName() const;
0046 
0047   //! Sets semantic name
0048   Standard_EXPORT void SetSemanticName(const occ::handle<TCollection_HAsciiString>& theName);
0049 
0050   //! Sets type of the object.
0051   Standard_EXPORT void SetType(const XCAFDimTolObjects_GeomToleranceType theType);
0052 
0053   //! Returns type of the object.
0054   Standard_EXPORT XCAFDimTolObjects_GeomToleranceType GetType() const;
0055 
0056   //! Sets type of tolerance value.
0057   Standard_EXPORT void SetTypeOfValue(
0058     const XCAFDimTolObjects_GeomToleranceTypeValue theTypeOfValue);
0059 
0060   //! Returns type of tolerance value.
0061   Standard_EXPORT XCAFDimTolObjects_GeomToleranceTypeValue GetTypeOfValue() const;
0062 
0063   //! Sets tolerance value.
0064   Standard_EXPORT void SetValue(const double theValue);
0065 
0066   //! Returns tolerance value.
0067   Standard_EXPORT double GetValue() const;
0068 
0069   //! Sets material requirement of the tolerance.
0070   Standard_EXPORT void SetMaterialRequirementModifier(
0071     const XCAFDimTolObjects_GeomToleranceMatReqModif theMatReqModif);
0072 
0073   //! Returns material requirement of the tolerance.
0074   Standard_EXPORT XCAFDimTolObjects_GeomToleranceMatReqModif GetMaterialRequirementModifier() const;
0075 
0076   //! Sets tolerance zone.
0077   Standard_EXPORT void SetZoneModifier(const XCAFDimTolObjects_GeomToleranceZoneModif theZoneModif);
0078 
0079   //! Returns tolerance zone.
0080   Standard_EXPORT XCAFDimTolObjects_GeomToleranceZoneModif GetZoneModifier() const;
0081 
0082   //! Sets value associated with tolerance zone.
0083   Standard_EXPORT void SetValueOfZoneModifier(const double theValue);
0084 
0085   //! Returns value associated with tolerance zone.
0086   Standard_EXPORT double GetValueOfZoneModifier() const;
0087 
0088   //! Sets new sequence of tolerance modifiers.
0089   Standard_EXPORT void SetModifiers(
0090     const NCollection_Sequence<XCAFDimTolObjects_GeomToleranceModif>& theModifiers);
0091 
0092   //! Adds a tolerance modifier to the sequence of modifiers.
0093   Standard_EXPORT void AddModifier(const XCAFDimTolObjects_GeomToleranceModif theModifier);
0094 
0095   //! Returns a sequence of modifiers of the tolerance.
0096   Standard_EXPORT NCollection_Sequence<XCAFDimTolObjects_GeomToleranceModif> GetModifiers() const;
0097 
0098   //! Sets the maximal upper tolerance value for tolerance with modifiers.
0099   Standard_EXPORT void SetMaxValueModifier(const double theModifier);
0100 
0101   //! Returns the maximal upper tolerance.
0102   Standard_EXPORT double GetMaxValueModifier() const;
0103 
0104   Standard_EXPORT void SetAxis(const gp_Ax2& theAxis);
0105 
0106   Standard_EXPORT gp_Ax2 GetAxis() const;
0107 
0108   Standard_EXPORT bool HasAxis() const;
0109 
0110   //! Sets annotation plane.
0111   void SetPlane(const gp_Ax2& thePlane)
0112   {
0113     myPlane    = thePlane;
0114     myHasPlane = true;
0115   }
0116 
0117   //! Returns annotation plane.
0118   const gp_Ax2& GetPlane() const { return myPlane; }
0119 
0120   //! Sets reference point.
0121   void SetPoint(const gp_Pnt& thePnt)
0122   {
0123     myPnt    = thePnt;
0124     myHasPnt = true;
0125   }
0126 
0127   //! Returns reference point.
0128   const gp_Pnt& GetPoint() const { return myPnt; }
0129 
0130   //! Sets text position.
0131   void SetPointTextAttach(const gp_Pnt& thePntText)
0132   {
0133     myPntText    = thePntText;
0134     myHasPntText = true;
0135   }
0136 
0137   //! Returns the text position.
0138   const gp_Pnt& GetPointTextAttach() const { return myPntText; }
0139 
0140   //! Returns True if the object has annotation plane.
0141   bool HasPlane() const { return myHasPlane; }
0142 
0143   //! Returns True if reference point is specified.
0144   bool HasPoint() const { return myHasPnt; }
0145 
0146   //! Returns True if text position is specified.
0147   bool HasPointText() const { return myHasPntText; }
0148 
0149   //! Set graphical presentation for object.
0150   void SetPresentation(const TopoDS_Shape&                          thePresentation,
0151                        const occ::handle<TCollection_HAsciiString>& thePresentationName)
0152   {
0153     myPresentation     = thePresentation;
0154     myPresentationName = thePresentationName;
0155   }
0156 
0157   //! Returns graphical presentation of the object.
0158   TopoDS_Shape GetPresentation() const { return myPresentation; }
0159 
0160   //! Returns graphical presentation of the object.
0161   occ::handle<TCollection_HAsciiString> GetPresentationName() const { return myPresentationName; }
0162 
0163   // Returns true, if affected plane is specified.
0164   bool HasAffectedPlane() const
0165   {
0166     return (myAffectedPlaneType != XCAFDimTolObjects_ToleranceZoneAffectedPlane_None);
0167   }
0168 
0169   // Returns type of affected plane.
0170   XCAFDimTolObjects_ToleranceZoneAffectedPlane GetAffectedPlaneType() const
0171   {
0172     return myAffectedPlaneType;
0173   }
0174 
0175   // Sets affected plane type.
0176   void SetAffectedPlaneType(const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
0177   {
0178     myAffectedPlaneType = theType;
0179   }
0180 
0181   //! Sets affected plane.
0182   void SetAffectedPlane(const gp_Pln& thePlane) { myAffectedPlane = thePlane; }
0183 
0184   //! Sets affected plane.
0185   void SetAffectedPlane(const gp_Pln&                                      thePlane,
0186                         const XCAFDimTolObjects_ToleranceZoneAffectedPlane theType)
0187   {
0188     myAffectedPlaneType = theType;
0189     myAffectedPlane     = thePlane;
0190   }
0191 
0192   //! Returns affected plane.
0193   const gp_Pln& GetAffectedPlane() const { return myAffectedPlane; }
0194 
0195   //! Dumps the content of me into the stream
0196   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0197 
0198   DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject, Standard_Transient)
0199 
0200 private:
0201   XCAFDimTolObjects_GeomToleranceType                        myType;
0202   XCAFDimTolObjects_GeomToleranceTypeValue                   myTypeOfValue;
0203   double                                                     myValue;
0204   XCAFDimTolObjects_GeomToleranceMatReqModif                 myMatReqModif;
0205   XCAFDimTolObjects_GeomToleranceZoneModif                   myZoneModif;
0206   double                                                     myValueOfZoneModif;
0207   NCollection_Sequence<XCAFDimTolObjects_GeomToleranceModif> myModifiers;
0208   double                                                     myMaxValueModif;
0209   gp_Ax2                                                     myAxis;
0210   bool                                                       myHasAxis;
0211   gp_Ax2                                                     myPlane;
0212   gp_Pnt                                                     myPnt;
0213   gp_Pnt                                                     myPntText;
0214   bool                                                       myHasPlane;
0215   bool                                                       myHasPnt;
0216   bool                                                       myHasPntText;
0217   TopoDS_Shape                                               myPresentation;
0218   occ::handle<TCollection_HAsciiString>                      mySemanticName;
0219   occ::handle<TCollection_HAsciiString>                      myPresentationName;
0220   XCAFDimTolObjects_ToleranceZoneAffectedPlane               myAffectedPlaneType;
0221   gp_Pln                                                     myAffectedPlane;
0222 };
0223 
0224 #endif // _XCAFDimTolObjects_GeomToleranceObject_HeaderFile