Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:33

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