Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:25:50

0001 // Created on: 1998-08-25
0002 // Created by: Pavel DURANDIN <pdn@nnov.matra-dtv.fr>
0003 // Copyright (c) 1998-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _ShapeAnalysis_FreeBoundData_HeaderFile
0018 #define _ShapeAnalysis_FreeBoundData_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <TopoDS_Wire.hxx>
0023 #include <Standard_Real.hxx>
0024 #include <TopTools_HSequenceOfShape.hxx>
0025 #include <TopTools_DataMapOfShapeReal.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <Standard_Integer.hxx>
0028 
0029 class ShapeAnalysis_FreeBoundData;
0030 DEFINE_STANDARD_HANDLE(ShapeAnalysis_FreeBoundData, Standard_Transient)
0031 
0032 //! This class is intended to represent free bound and to store
0033 //! its properties.
0034 //!
0035 //! This class is used by ShapeAnalysis_FreeBoundsProperties
0036 //! class when storing each free bound and its properties.
0037 //!
0038 //! The properties stored in this class are the following:
0039 //! - area of the contour,
0040 //! - perimeter of the contour,
0041 //! - ratio of average length to average width of the contour,
0042 //! - average width of contour,
0043 //! - notches (narrow 'V'-like sub-contours) on the contour and
0044 //! their maximum width.
0045 //!
0046 //! This class provides methods for setting and getting fields
0047 //! only.
0048 class ShapeAnalysis_FreeBoundData : public Standard_Transient
0049 {
0050 
0051 public:
0052   //! Empty constructor
0053   Standard_EXPORT ShapeAnalysis_FreeBoundData();
0054 
0055   //! Creates object with contour given in the form of TopoDS_Wire
0056   Standard_EXPORT ShapeAnalysis_FreeBoundData(const TopoDS_Wire& freebound);
0057 
0058   //! Clears all properties of the contour.
0059   //! Contour bound itself is not cleared.
0060   Standard_EXPORT void Clear();
0061 
0062   //! Sets contour
0063   void SetFreeBound(const TopoDS_Wire& freebound);
0064 
0065   //! Sets area of the contour
0066   void SetArea(const Standard_Real area);
0067 
0068   //! Sets perimeter of the contour
0069   void SetPerimeter(const Standard_Real perimeter);
0070 
0071   //! Sets ratio of average length to average width of the contour
0072   void SetRatio(const Standard_Real ratio);
0073 
0074   //! Sets average width of the contour
0075   void SetWidth(const Standard_Real width);
0076 
0077   //! Adds notch on the contour with its maximum width
0078   Standard_EXPORT void AddNotch(const TopoDS_Wire& notch, const Standard_Real width);
0079 
0080   //! Returns contour
0081   TopoDS_Wire FreeBound() const;
0082 
0083   //! Returns area of the contour
0084   Standard_Real Area() const;
0085 
0086   //! Returns perimeter of the contour
0087   Standard_Real Perimeter() const;
0088 
0089   //! Returns ratio of average length to average width of the contour
0090   Standard_Real Ratio() const;
0091 
0092   //! Returns average width of the contour
0093   Standard_Real Width() const;
0094 
0095   //! Returns number of notches on the contour
0096   Standard_Integer NbNotches() const;
0097 
0098   //! Returns sequence of notches on the contour
0099   Handle(TopTools_HSequenceOfShape) Notches() const;
0100 
0101   //! Returns notch on the contour
0102   TopoDS_Wire Notch(const Standard_Integer index) const;
0103 
0104   //! Returns maximum width of notch specified by its rank number
0105   //! on the contour
0106   Standard_EXPORT Standard_Real NotchWidth(const Standard_Integer index) const;
0107 
0108   //! Returns maximum width of notch specified as TopoDS_Wire
0109   //! on the contour
0110   Standard_EXPORT Standard_Real NotchWidth(const TopoDS_Wire& notch) const;
0111 
0112   DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_FreeBoundData, Standard_Transient)
0113 
0114 protected:
0115 private:
0116   TopoDS_Wire                       myBound;
0117   Standard_Real                     myArea;
0118   Standard_Real                     myPerimeter;
0119   Standard_Real                     myRatio;
0120   Standard_Real                     myWidth;
0121   Handle(TopTools_HSequenceOfShape) myNotches;
0122   TopTools_DataMapOfShapeReal       myNotchesParams;
0123 };
0124 
0125 #include <ShapeAnalysis_FreeBoundData.lxx>
0126 
0127 #endif // _ShapeAnalysis_FreeBoundData_HeaderFile