summaryrefslogtreecommitdiff
path: root/inc/ShapeAnalysis_FreeBoundsProperties.hxx
blob: 516a7aefcd4c93a7b53222369ee11919abc5cf89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _ShapeAnalysis_FreeBoundsProperties_HeaderFile
#define _ShapeAnalysis_FreeBoundsProperties_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_ShapeAnalysis_HSequenceOfFreeBounds_HeaderFile
#include <Handle_ShapeAnalysis_HSequenceOfFreeBounds.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Handle_ShapeAnalysis_FreeBoundData_HeaderFile
#include <Handle_ShapeAnalysis_FreeBoundData.hxx>
#endif
class ShapeAnalysis_HSequenceOfFreeBounds;
class TopoDS_Shape;
class ShapeAnalysis_FreeBoundData;
class TopoDS_Wire;


//! This class is intended to calculate shape free bounds <br>
//!          properties. <br>
//!          This class provides the following functionalities: <br>
//!          - calculates area of the contour, <br>
//!          - calculates perimeter of the contour, <br>
//!          - calculates ratio of average length to average width of the <br>
//!            contour, <br>
//!          - estimates average width of contour, <br>
//!          - finds the notches (narrow 'V'-like sub-contour) on the <br>
//!            contour. <br>
class ShapeAnalysis_FreeBoundsProperties  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! Empty constructor <br>
  Standard_EXPORT   ShapeAnalysis_FreeBoundsProperties();
  //! Creates the object and calls corresponding Init. <br>
//!          <shape> should be a compound of faces. <br>
  Standard_EXPORT   ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape,const Standard_Real tolerance,const Standard_Boolean splitclosed = Standard_False,const Standard_Boolean splitopen = Standard_False);
  //! Creates the object and calls corresponding Init. <br>
//!          <shape> should be a compound of shells. <br>
  Standard_EXPORT   ShapeAnalysis_FreeBoundsProperties(const TopoDS_Shape& shape,const Standard_Boolean splitclosed = Standard_False,const Standard_Boolean splitopen = Standard_False);
  //! Initializes the object with given parameters. <br>
//!          <shape> should be a compound of faces. <br>
  Standard_EXPORT     void Init(const TopoDS_Shape& shape,const Standard_Real tolerance,const Standard_Boolean splitclosed = Standard_False,const Standard_Boolean splitopen = Standard_False) ;
  //! Initializes the object with given parameters. <br>
//!          <shape> should be a compound of shells. <br>
  Standard_EXPORT     void Init(const TopoDS_Shape& shape,const Standard_Boolean splitclosed = Standard_False,const Standard_Boolean splitopen = Standard_False) ;
  //! Builds and analyzes free bounds of the shape. <br>
//!          First calls ShapeAnalysis_FreeBounds for building free <br>
//!          bounds. <br>
//!          Then on each free bound computes its properties: <br>
//!          - area of the contour, <br>
//!          - perimeter of the contour, <br>
//!          - ratio of average length to average width of the contour, <br>
//!          - average width of contour, <br>
//!          - notches on the contour and for each notch <br>
//!            - maximum width of the notch. <br>
  Standard_EXPORT     Standard_Boolean Perform() ;
  //! Returns True if shape is loaded <br>
        Standard_Boolean IsLoaded() const;
  //! Returns shape <br>
        TopoDS_Shape Shape() const;
  //! Returns tolerance <br>
        Standard_Real Tolerance() const;
  //! Returns number of free bounds <br>
        Standard_Integer NbFreeBounds() const;
  //! Returns number of closed free bounds <br>
        Standard_Integer NbClosedFreeBounds() const;
  //! Returns number of open free bounds <br>
        Standard_Integer NbOpenFreeBounds() const;
  //! Returns all closed free bounds <br>
        Handle_ShapeAnalysis_HSequenceOfFreeBounds ClosedFreeBounds() const;
  //! Returns all open free bounds <br>
        Handle_ShapeAnalysis_HSequenceOfFreeBounds OpenFreeBounds() const;
  //! Returns properties of closed free bound specified by its rank <br>
//!          number <br>
        Handle_ShapeAnalysis_FreeBoundData ClosedFreeBound(const Standard_Integer index) const;
  //! Returns properties of open free bound specified by its rank <br>
//!          number <br>
        Handle_ShapeAnalysis_FreeBoundData OpenFreeBound(const Standard_Integer index) const;
  
  Standard_EXPORT     Standard_Boolean DispatchBounds() ;
  
  Standard_EXPORT     Standard_Boolean CheckContours(const Standard_Real prec = 0.0) ;
  
  Standard_EXPORT     Standard_Boolean CheckNotches(const Standard_Real prec = 0.0) ;
  
  Standard_EXPORT     Standard_Boolean CheckNotches(Handle(ShapeAnalysis_FreeBoundData)& fbData,const Standard_Real prec = 0.0) ;
  
  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) ;
  
  Standard_EXPORT     Standard_Boolean FillProperties(Handle(ShapeAnalysis_FreeBoundData)& fbData,const Standard_Real prec = 0.0) ;





protected:





private:



TopoDS_Shape myShape;
Standard_Real myTolerance;
Standard_Boolean mySplitClosed;
Standard_Boolean mySplitOpen;
Handle_ShapeAnalysis_HSequenceOfFreeBounds myClosedFreeBounds;
Handle_ShapeAnalysis_HSequenceOfFreeBounds myOpenFreeBounds;


};


#include <ShapeAnalysis_FreeBoundsProperties.lxx>



// other Inline functions and methods (like "C++: function call" methods)


#endif