Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-30 09:28:49

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 <TopoDS_Shape.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <NCollection_HSequence.hxx>
0027 #include <TopTools_ShapeMapHasher.hxx>
0028 #include <NCollection_DataMap.hxx>
0029 #include <Standard_Transient.hxx>
0030 #include <Standard_Integer.hxx>
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 double area);
0067 
0068   //! Sets perimeter of the contour
0069   void SetPerimeter(const double perimeter);
0070 
0071   //! Sets ratio of average length to average width of the contour
0072   void SetRatio(const double ratio);
0073 
0074   //! Sets average width of the contour
0075   void SetWidth(const double width);
0076 
0077   //! Adds notch on the contour with its maximum width
0078   Standard_EXPORT void AddNotch(const TopoDS_Wire& notch, const double width);
0079 
0080   //! Returns contour
0081   TopoDS_Wire FreeBound() const;
0082 
0083   //! Returns area of the contour
0084   double Area() const;
0085 
0086   //! Returns perimeter of the contour
0087   double Perimeter() const;
0088 
0089   //! Returns ratio of average length to average width of the contour
0090   double Ratio() const;
0091 
0092   //! Returns average width of the contour
0093   double Width() const;
0094 
0095   //! Returns number of notches on the contour
0096   int NbNotches() const;
0097 
0098   //! Returns sequence of notches on the contour
0099   occ::handle<NCollection_HSequence<TopoDS_Shape>> Notches() const;
0100 
0101   //! Returns notch on the contour
0102   TopoDS_Wire Notch(const int index) const;
0103 
0104   //! Returns maximum width of notch specified by its rank number
0105   //! on the contour
0106   Standard_EXPORT double NotchWidth(const int index) const;
0107 
0108   //! Returns maximum width of notch specified as TopoDS_Wire
0109   //! on the contour
0110   Standard_EXPORT double NotchWidth(const TopoDS_Wire& notch) const;
0111 
0112   DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_FreeBoundData, Standard_Transient)
0113 
0114 private:
0115   TopoDS_Wire                                                        myBound;
0116   double                                                             myArea;
0117   double                                                             myPerimeter;
0118   double                                                             myRatio;
0119   double                                                             myWidth;
0120   occ::handle<NCollection_HSequence<TopoDS_Shape>>                   myNotches;
0121   NCollection_DataMap<TopoDS_Shape, double, TopTools_ShapeMapHasher> myNotchesParams;
0122 };
0123 
0124 #include <ShapeAnalysis_FreeBoundData.lxx>
0125 
0126 #endif // _ShapeAnalysis_FreeBoundData_HeaderFile