Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1998-07-30
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_FreeBoundsProperties_HeaderFile
0018 #define _ShapeAnalysis_FreeBoundsProperties_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopoDS_Shape.hxx>
0025 #include <ShapeAnalysis_HSequenceOfFreeBounds.hxx>
0026 #include <Standard_Integer.hxx>
0027 class ShapeAnalysis_FreeBoundData;
0028 class TopoDS_Wire;
0029 
0030 
0031 //! This class is intended to calculate shape free bounds
0032 //! properties.
0033 //! This class provides the following functionalities:
0034 //! - calculates area of the contour,
0035 //! - calculates perimeter of the contour,
0036 //! - calculates ratio of average length to average width of the
0037 //! contour,
0038 //! - estimates average width of contour,
0039 //! - finds the notches (narrow 'V'-like sub-contour) on the
0040 //! contour.
0041 //!
0042 //! For getting free bounds this class uses
0043 //! ShapeAnalysis_FreeBounds class.
0044 //!
0045 //! For description of parameters used for initializing this
0046 //! class refer to CDL of ShapeAnalysis_FreeBounds.
0047 //!
0048 //! Properties of each contour are stored in the data structure
0049 //! ShapeAnalysis_FreeBoundData.
0050 class ShapeAnalysis_FreeBoundsProperties 
0051 {
0052 public:
0053 
0054   DEFINE_STANDARD_ALLOC
0055 
0056   
0057   //! Empty constructor
0058   Standard_EXPORT ShapeAnalysis_FreeBoundsProperties();
0059   
0060   //! Creates the object and calls corresponding Init.
0061   //! <shape> should be a compound of faces.
0062   Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
0063   
0064   //! Creates the object and calls corresponding Init.
0065   //! <shape> should be a compound of shells.
0066   Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
0067   
0068   //! Initializes the object with given parameters.
0069   //! <shape> should be a compound of faces.
0070   Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
0071   
0072   //! Initializes the object with given parameters.
0073   //! <shape> should be a compound of shells.
0074   Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
0075   
0076   //! Builds and analyzes free bounds of the shape.
0077   //! First calls ShapeAnalysis_FreeBounds for building free
0078   //! bounds.
0079   //! Then on each free bound computes its properties:
0080   //! - area of the contour,
0081   //! - perimeter of the contour,
0082   //! - ratio of average length to average width of the contour,
0083   //! - average width of contour,
0084   //! - notches on the contour and for each notch
0085   //! - maximum width of the notch.
0086   Standard_EXPORT Standard_Boolean Perform();
0087   
0088   //! Returns True if shape is loaded
0089     Standard_Boolean IsLoaded() const;
0090   
0091   //! Returns shape
0092     TopoDS_Shape Shape() const;
0093   
0094   //! Returns tolerance
0095     Standard_Real Tolerance() const;
0096   
0097   //! Returns number of free bounds
0098     Standard_Integer NbFreeBounds() const;
0099   
0100   //! Returns number of closed free bounds
0101     Standard_Integer NbClosedFreeBounds() const;
0102   
0103   //! Returns number of open free bounds
0104     Standard_Integer NbOpenFreeBounds() const;
0105   
0106   //! Returns all closed free bounds
0107     Handle(ShapeAnalysis_HSequenceOfFreeBounds) ClosedFreeBounds() const;
0108   
0109   //! Returns all open free bounds
0110     Handle(ShapeAnalysis_HSequenceOfFreeBounds) OpenFreeBounds() const;
0111   
0112   //! Returns properties of closed free bound specified by its rank
0113   //! number
0114     Handle(ShapeAnalysis_FreeBoundData) ClosedFreeBound (const Standard_Integer index) const;
0115   
0116   //! Returns properties of open free bound specified by its rank
0117   //! number
0118     Handle(ShapeAnalysis_FreeBoundData) OpenFreeBound (const Standard_Integer index) const;
0119   
0120   Standard_EXPORT Standard_Boolean DispatchBounds();
0121   
0122   Standard_EXPORT Standard_Boolean CheckContours (const Standard_Real prec = 0.0);
0123   
0124   Standard_EXPORT Standard_Boolean CheckNotches (const Standard_Real prec = 0.0);
0125   
0126   Standard_EXPORT Standard_Boolean CheckNotches (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
0127   
0128   Standard_EXPORT Standard_Boolean CheckNotches (const TopoDS_Wire& freebound, const Standard_Integer num, TopoDS_Wire& notch, Standard_Real& distMax, const Standard_Real prec = 0.0);
0129   
0130   Standard_EXPORT Standard_Boolean FillProperties (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
0131 
0132 
0133 
0134 
0135 protected:
0136 
0137 
0138 
0139 
0140 
0141 private:
0142 
0143 
0144 
0145   TopoDS_Shape myShape;
0146   Standard_Real myTolerance;
0147   Standard_Boolean mySplitClosed;
0148   Standard_Boolean mySplitOpen;
0149   Handle(ShapeAnalysis_HSequenceOfFreeBounds) myClosedFreeBounds;
0150   Handle(ShapeAnalysis_HSequenceOfFreeBounds) myOpenFreeBounds;
0151 
0152 
0153 };
0154 
0155 
0156 #include <ShapeAnalysis_FreeBoundsProperties.lxx>
0157 
0158 
0159 
0160 
0161 
0162 #endif // _ShapeAnalysis_FreeBoundsProperties_HeaderFile