0033018: Coding - get rid of unused headers [Plugin to ShapeAnalysis]
[occt.git] / src / ShapeAnalysis / ShapeAnalysis_FreeBoundsProperties.hxx
1 // Created on: 1998-07-30
2 // Created by: Pavel DURANDIN <pdn@nnov.matra-dtv.fr>
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _ShapeAnalysis_FreeBoundsProperties_HeaderFile
18 #define _ShapeAnalysis_FreeBoundsProperties_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TopoDS_Shape.hxx>
25 #include <ShapeAnalysis_HSequenceOfFreeBounds.hxx>
26 #include <Standard_Integer.hxx>
27 class ShapeAnalysis_FreeBoundData;
28 class TopoDS_Wire;
29
30
31 //! This class is intended to calculate shape free bounds
32 //! properties.
33 //! This class provides the following functionalities:
34 //! - calculates area of the contour,
35 //! - calculates perimeter of the contour,
36 //! - calculates ratio of average length to average width of the
37 //! contour,
38 //! - estimates average width of contour,
39 //! - finds the notches (narrow 'V'-like sub-contour) on the
40 //! contour.
41 //!
42 //! For getting free bounds this class uses
43 //! ShapeAnalysis_FreeBounds class.
44 //!
45 //! For description of parameters used for initializing this
46 //! class refer to CDL of ShapeAnalysis_FreeBounds.
47 //!
48 //! Properties of each contour are stored in the data structure
49 //! ShapeAnalysis_FreeBoundData.
50 class ShapeAnalysis_FreeBoundsProperties 
51 {
52 public:
53
54   DEFINE_STANDARD_ALLOC
55
56   
57   //! Empty constructor
58   Standard_EXPORT ShapeAnalysis_FreeBoundsProperties();
59   
60   //! Creates the object and calls corresponding Init.
61   //! <shape> should be a compound of faces.
62   Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
63   
64   //! Creates the object and calls corresponding Init.
65   //! <shape> should be a compound of shells.
66   Standard_EXPORT ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
67   
68   //! Initializes the object with given parameters.
69   //! <shape> should be a compound of faces.
70   Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Real tolerance, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
71   
72   //! Initializes the object with given parameters.
73   //! <shape> should be a compound of shells.
74   Standard_EXPORT void Init (const TopoDS_Shape& shape, const Standard_Boolean splitclosed = Standard_False, const Standard_Boolean splitopen = Standard_False);
75   
76   //! Builds and analyzes free bounds of the shape.
77   //! First calls ShapeAnalysis_FreeBounds for building free
78   //! bounds.
79   //! Then on each free bound computes its properties:
80   //! - area of the contour,
81   //! - perimeter of the contour,
82   //! - ratio of average length to average width of the contour,
83   //! - average width of contour,
84   //! - notches on the contour and for each notch
85   //! - maximum width of the notch.
86   Standard_EXPORT Standard_Boolean Perform();
87   
88   //! Returns True if shape is loaded
89     Standard_Boolean IsLoaded() const;
90   
91   //! Returns shape
92     TopoDS_Shape Shape() const;
93   
94   //! Returns tolerance
95     Standard_Real Tolerance() const;
96   
97   //! Returns number of free bounds
98     Standard_Integer NbFreeBounds() const;
99   
100   //! Returns number of closed free bounds
101     Standard_Integer NbClosedFreeBounds() const;
102   
103   //! Returns number of open free bounds
104     Standard_Integer NbOpenFreeBounds() const;
105   
106   //! Returns all closed free bounds
107     Handle(ShapeAnalysis_HSequenceOfFreeBounds) ClosedFreeBounds() const;
108   
109   //! Returns all open free bounds
110     Handle(ShapeAnalysis_HSequenceOfFreeBounds) OpenFreeBounds() const;
111   
112   //! Returns properties of closed free bound specified by its rank
113   //! number
114     Handle(ShapeAnalysis_FreeBoundData) ClosedFreeBound (const Standard_Integer index) const;
115   
116   //! Returns properties of open free bound specified by its rank
117   //! number
118     Handle(ShapeAnalysis_FreeBoundData) OpenFreeBound (const Standard_Integer index) const;
119   
120   Standard_EXPORT Standard_Boolean DispatchBounds();
121   
122   Standard_EXPORT Standard_Boolean CheckContours (const Standard_Real prec = 0.0);
123   
124   Standard_EXPORT Standard_Boolean CheckNotches (const Standard_Real prec = 0.0);
125   
126   Standard_EXPORT Standard_Boolean CheckNotches (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
127   
128   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);
129   
130   Standard_EXPORT Standard_Boolean FillProperties (Handle(ShapeAnalysis_FreeBoundData)& fbData, const Standard_Real prec = 0.0);
131
132
133
134
135 protected:
136
137
138
139
140
141 private:
142
143
144
145   TopoDS_Shape myShape;
146   Standard_Real myTolerance;
147   Standard_Boolean mySplitClosed;
148   Standard_Boolean mySplitOpen;
149   Handle(ShapeAnalysis_HSequenceOfFreeBounds) myClosedFreeBounds;
150   Handle(ShapeAnalysis_HSequenceOfFreeBounds) myOpenFreeBounds;
151
152
153 };
154
155
156 #include <ShapeAnalysis_FreeBoundsProperties.lxx>
157
158
159
160
161
162 #endif // _ShapeAnalysis_FreeBoundsProperties_HeaderFile