Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:22:24

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_DatumObject_HeaderFile
0017 #define _XCAFDimTolObjects_DatumObject_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <XCAFDimTolObjects_DatumTargetType.hxx>
0022 #include <TCollection_HAsciiString.hxx>
0023 #include <NCollection_Sequence.hxx>
0024 #include <XCAFDimTolObjects_DatumSingleModif.hxx>
0025 #include <XCAFDimTolObjects_DatumModifWithValue.hxx>
0026 #include <Standard_Real.hxx>
0027 #include <TopoDS_Shape.hxx>
0028 #include <Standard_Transient.hxx>
0029 #include <gp_Ax2.hxx>
0030 class XCAFDimTolObjects_DatumObject;
0031 
0032 //! Access object to store datum
0033 class XCAFDimTolObjects_DatumObject : public Standard_Transient
0034 {
0035 
0036 public:
0037   Standard_EXPORT XCAFDimTolObjects_DatumObject();
0038 
0039   Standard_EXPORT XCAFDimTolObjects_DatumObject(
0040     const occ::handle<XCAFDimTolObjects_DatumObject>& theObj);
0041 
0042   //! Returns semantic name
0043   Standard_EXPORT occ::handle<TCollection_HAsciiString> GetSemanticName() const;
0044 
0045   //! Sets semantic name
0046   Standard_EXPORT void SetSemanticName(const occ::handle<TCollection_HAsciiString>& theName);
0047 
0048   //! Returns datum name.
0049   Standard_EXPORT occ::handle<TCollection_HAsciiString> GetName() const;
0050 
0051   //! Sets datum name.
0052   Standard_EXPORT void SetName(const occ::handle<TCollection_HAsciiString>& theTag);
0053 
0054   //! Returns a sequence of modifiers of the datum.
0055   Standard_EXPORT NCollection_Sequence<XCAFDimTolObjects_DatumSingleModif> GetModifiers() const;
0056 
0057   //! Sets new sequence of datum modifiers.
0058   Standard_EXPORT void SetModifiers(
0059     const NCollection_Sequence<XCAFDimTolObjects_DatumSingleModif>& theModifiers);
0060 
0061   //! Retrieves datum modifier with value.
0062   Standard_EXPORT void GetModifierWithValue(XCAFDimTolObjects_DatumModifWithValue& theModifier,
0063                                             double&                                theValue) const;
0064 
0065   //! Sets datum modifier with value.
0066   Standard_EXPORT void SetModifierWithValue(const XCAFDimTolObjects_DatumModifWithValue theModifier,
0067                                             const double                                theValue);
0068 
0069   //! Adds a modifier to the datum sequence of modifiers.
0070   Standard_EXPORT void AddModifier(const XCAFDimTolObjects_DatumSingleModif theModifier);
0071 
0072   //! Returns datum target shape.
0073   Standard_EXPORT TopoDS_Shape GetDatumTarget() const;
0074 
0075   //! Sets datum target shape.
0076   Standard_EXPORT void SetDatumTarget(const TopoDS_Shape& theShape);
0077 
0078   //! Returns datum position in the related geometric tolerance object.
0079   Standard_EXPORT int GetPosition() const;
0080 
0081   //! Sets datum position in the related geometric tolerance object.
0082   Standard_EXPORT void SetPosition(const int thePosition);
0083 
0084   //! Returns True if the datum target is specified.
0085   Standard_EXPORT bool IsDatumTarget() const;
0086 
0087   //! Sets or drops the datum target indicator.
0088   Standard_EXPORT void IsDatumTarget(const bool theIsDT);
0089 
0090   //! Returns datum target type
0091   Standard_EXPORT XCAFDimTolObjects_DatumTargetType GetDatumTargetType() const;
0092 
0093   //! Sets datum target to point, line, rectangle, circle or area type.
0094   Standard_EXPORT void SetDatumTargetType(const XCAFDimTolObjects_DatumTargetType theType);
0095 
0096   //! Returns datum target axis.
0097   //! The Z axis of the datum placement denotes the normal of the surface
0098   //! pointing away from the material.
0099   Standard_EXPORT gp_Ax2 GetDatumTargetAxis() const;
0100 
0101   //! Sets datum target axis.
0102   Standard_EXPORT void SetDatumTargetAxis(const gp_Ax2& theAxis);
0103 
0104   //! Returns datum target length for line and rectangle types.
0105   //! The length along the X axis of the datum placement.
0106   Standard_EXPORT double GetDatumTargetLength() const;
0107 
0108   //! Sets datum target length.
0109   Standard_EXPORT void SetDatumTargetLength(const double theLength);
0110 
0111   //! Returns datum target width for rectangle type.
0112   //! The width along the derived Y axis, with the placement itself positioned
0113   //! at the centre of the rectangle.
0114   Standard_EXPORT double GetDatumTargetWidth() const;
0115 
0116   //! Sets datum target width.
0117   Standard_EXPORT void SetDatumTargetWidth(const double theWidth);
0118 
0119   //! Returns datum target number.
0120   Standard_EXPORT int GetDatumTargetNumber() const;
0121 
0122   //! Sets datum target number.
0123   Standard_EXPORT void SetDatumTargetNumber(const int theNumber);
0124 
0125   //! Sets annotation plane.
0126   void SetPlane(const gp_Ax2& thePlane)
0127   {
0128     myPlane    = thePlane;
0129     myHasPlane = true;
0130   }
0131 
0132   //! Returns annotation plane.
0133   const gp_Ax2& GetPlane() const { return myPlane; }
0134 
0135   //! Sets a point on the datum target shape.
0136   void SetPoint(const gp_Pnt& thePnt)
0137   {
0138     myPnt    = thePnt;
0139     myHasPnt = true;
0140   }
0141 
0142   //! Gets point on the datum shape.
0143   const gp_Pnt& GetPoint() const { return myPnt; }
0144 
0145   //! Sets a position of the datum text.
0146   void SetPointTextAttach(const gp_Pnt& thePntText)
0147   {
0148     myPntText    = thePntText;
0149     myHasPntText = true;
0150   }
0151 
0152   //! Gets datum text position.
0153   const gp_Pnt& GetPointTextAttach() const { return myPntText; }
0154 
0155   //! Returns True if the datum has annotation plane.
0156   bool HasPlane() const { return myHasPlane; }
0157 
0158   //! Returns True if point on the datum target is specified.
0159   bool HasPoint() const { return myHasPnt; }
0160 
0161   //! Returns True if the datum text position is specified.
0162   bool HasPointText() const { return myHasPntText; }
0163 
0164   //! Set graphical presentation for object.
0165   void SetPresentation(const TopoDS_Shape&                          thePresentation,
0166                        const occ::handle<TCollection_HAsciiString>& thePresentationName)
0167   {
0168     myPresentation     = thePresentation;
0169     myPresentationName = thePresentationName;
0170   }
0171 
0172   //! Returns graphical presentation of the object.
0173   TopoDS_Shape GetPresentation() const { return myPresentation; }
0174 
0175   //! Returns graphical presentation of the object.
0176   occ::handle<TCollection_HAsciiString> GetPresentationName() const { return myPresentationName; }
0177 
0178   //! Returns True if the datum has valid parameters for datum target (width, length, circle radius
0179   //! etc)
0180   bool HasDatumTargetParams() { return myIsValidDT; }
0181 
0182   //! Dumps the content of me into the stream
0183   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const;
0184 
0185   DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DatumObject, Standard_Transient)
0186 
0187 private:
0188   occ::handle<TCollection_HAsciiString>                    myName;
0189   NCollection_Sequence<XCAFDimTolObjects_DatumSingleModif> myModifiers;
0190   XCAFDimTolObjects_DatumModifWithValue                    myModifierWithValue;
0191   double                                                   myValueOfModifier;
0192   TopoDS_Shape                                             myDatumTarget;
0193   int                                                      myPosition;
0194   bool                                                     myIsDTarget;
0195   bool                                                     myIsValidDT;
0196   XCAFDimTolObjects_DatumTargetType                        myDTargetType;
0197   double                                                   myLength;
0198   double                                                   myWidth;
0199   int                                                      myDatumTargetNumber;
0200   gp_Ax2                                                   myAxis;
0201   gp_Ax2                                                   myPlane;
0202   gp_Pnt                                                   myPnt;
0203   gp_Pnt                                                   myPntText;
0204   bool                                                     myHasPlane;
0205   bool                                                     myHasPnt;
0206   bool                                                     myHasPntText;
0207   TopoDS_Shape                                             myPresentation;
0208   occ::handle<TCollection_HAsciiString>                    mySemanticName;
0209   occ::handle<TCollection_HAsciiString>                    myPresentationName;
0210 };
0211 
0212 #endif // _XCAFDimTolObjects_DatumObject_HeaderFile