Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:54

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 
0030 class ShapeAnalysis_FreeBoundData;
0031 DEFINE_STANDARD_HANDLE(ShapeAnalysis_FreeBoundData, Standard_Transient)
0032 
0033 //! This class is intended to represent free bound and to store
0034 //! its properties.
0035 //!
0036 //! This class is used by ShapeAnalysis_FreeBoundsProperties
0037 //! class when storing each free bound and its properties.
0038 //!
0039 //! The properties stored in this class are the following:
0040 //! - area of the contour,
0041 //! - perimeter of the contour,
0042 //! - ratio of average length to average width of the contour,
0043 //! - average width of contour,
0044 //! - notches (narrow 'V'-like sub-contours) on the contour and
0045 //! their maximum width.
0046 //!
0047 //! This class provides methods for setting and getting fields
0048 //! only.
0049 class ShapeAnalysis_FreeBoundData : public Standard_Transient
0050 {
0051 
0052 public:
0053 
0054   
0055   //! Empty constructor
0056   Standard_EXPORT ShapeAnalysis_FreeBoundData();
0057   
0058   //! Creates object with contour given in the form of TopoDS_Wire
0059   Standard_EXPORT ShapeAnalysis_FreeBoundData(const TopoDS_Wire& freebound);
0060   
0061   //! Clears all properties of the contour.
0062   //! Contour bound itself is not cleared.
0063   Standard_EXPORT void Clear();
0064   
0065   //! Sets contour
0066     void SetFreeBound (const TopoDS_Wire& freebound);
0067   
0068   //! Sets area of the contour
0069     void SetArea (const Standard_Real area);
0070   
0071   //! Sets perimeter of the contour
0072     void SetPerimeter (const Standard_Real perimeter);
0073   
0074   //! Sets ratio of average length to average width of the contour
0075     void SetRatio (const Standard_Real ratio);
0076   
0077   //! Sets average width of the contour
0078     void SetWidth (const Standard_Real width);
0079   
0080   //! Adds notch on the contour with its maximum width
0081   Standard_EXPORT void AddNotch (const TopoDS_Wire& notch, const Standard_Real width);
0082   
0083   //! Returns contour
0084     TopoDS_Wire FreeBound() const;
0085   
0086   //! Returns area of the contour
0087     Standard_Real Area() const;
0088   
0089   //! Returns perimeter of the contour
0090     Standard_Real Perimeter() const;
0091   
0092   //! Returns ratio of average length to average width of the contour
0093     Standard_Real Ratio() const;
0094   
0095   //! Returns average width of the contour
0096     Standard_Real Width() const;
0097   
0098   //! Returns number of notches on the contour
0099     Standard_Integer NbNotches() const;
0100   
0101   //! Returns sequence of notches on the contour
0102     Handle(TopTools_HSequenceOfShape) Notches() const;
0103   
0104   //! Returns notch on the contour
0105     TopoDS_Wire Notch (const Standard_Integer index) const;
0106   
0107   //! Returns maximum width of notch specified by its rank number
0108   //! on the contour
0109   Standard_EXPORT Standard_Real NotchWidth (const Standard_Integer index) const;
0110   
0111   //! Returns maximum width of notch specified as TopoDS_Wire
0112   //! on the contour
0113   Standard_EXPORT Standard_Real NotchWidth (const TopoDS_Wire& notch) const;
0114 
0115 
0116 
0117 
0118   DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_FreeBoundData,Standard_Transient)
0119 
0120 protected:
0121 
0122 
0123 
0124 
0125 private:
0126 
0127 
0128   TopoDS_Wire myBound;
0129   Standard_Real myArea;
0130   Standard_Real myPerimeter;
0131   Standard_Real myRatio;
0132   Standard_Real myWidth;
0133   Handle(TopTools_HSequenceOfShape) myNotches;
0134   TopTools_DataMapOfShapeReal myNotchesParams;
0135 
0136 
0137 };
0138 
0139 
0140 #include <ShapeAnalysis_FreeBoundData.lxx>
0141 
0142 
0143 
0144 
0145 
0146 #endif // _ShapeAnalysis_FreeBoundData_HeaderFile