summaryrefslogtreecommitdiff
path: root/inc/TopExp_Explorer.hxx
blob: ad4299ce8b47c9e494302de053d906c9265cb827 (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
// 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 _TopExp_Explorer_HeaderFile
#define _TopExp_Explorer_HeaderFile

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

#ifndef _TopExp_Stack_HeaderFile
#include <TopExp_Stack.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
class Standard_NoMoreObject;
class Standard_NoSuchObject;
class TopoDS_Shape;


//! An Explorer is a Tool to visit  a Topological Data <br>
//!          Structure form the TopoDS package. <br>
//! <br>
//!          An Explorer is built with : <br>
//! <br>
//!            * The Shape to explore. <br>
//! <br>
//!            * The type of Shapes to find : e.g VERTEX, EDGE. <br>
//!            This type cannot be SHAPE. <br>
//! <br>
//!            * The type of Shapes to avoid. e.g  SHELL, EDGE. <br>
//!            By default   this type is  SHAPE which  means no <br>
//!            restriction on the exploration. <br>
//! <br>
//! <br>
//!          The Explorer  visits  all the  structure   to find <br>
//!          shapes of the   requested  type  which   are   not <br>
//!          contained in the type to avoid. <br>
//! <br>
//!          Example to find all the Faces in the Shape S : <br>
//! <br>
//!          TopExp_Explorer Ex; <br>
//!          for (Ex.Init(S,TopAbs_FACE); Ex.More(); Ex.Next()) { <br>
//!            ProcessFace(Ex.Current()); <br>
//!            } <br>
//! <br>
//!          // an other way <br>
//!          TopExp_Explorer Ex(S,TopAbs_FACE); <br>
//!          while (Ex.More()) { <br>
//!            ProcessFace(Ex.Current()); <br>
//!            Ex.Next(); <br>
//!            } <br>
//! <br>
//!          To find all the vertices which are not in an edge : <br>
//! <br>
//!          for (Ex.Init(S,TopAbs_VERTEX,TopAbs_EDGE); ...) <br>
//! <br>
//! <br>
//!          To  find all the faces  in   a SHELL, then all the <br>
//!          faces not in a SHELL : <br>
//! <br>
//!          TopExp_Explorer Ex1, Ex2; <br>
//! <br>
//!          for (Ex1.Init(S,TopAbs_SHELL),...) { <br>
//!            // visit all shells <br>
//!            for (Ex2.Init(Ex1.Current(),TopAbs_FACE),...) { <br>
//!              // visit all the faces of the current shell <br>
//!              } <br>
//!            } <br>
//! <br>
//!          for (Ex1.Init(S,TopAbs_FACE,TopAbs_SHELL),...) { <br>
//!            // visit all faces not in a shell <br>
//!            } <br>
//! <br>
//! <br>
//!          If   the type  to avoid  is   the same  or is less <br>
//!          complex than the type to find it has no effect. <br>
//! <br>
//!          For example searching edges  not in a vertex  does <br>
//!          not make a difference. <br>
//! <br>
class TopExp_Explorer  {
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); 
  }

  //! Creates an empty explorer, becomes usefull after Init. <br>
  Standard_EXPORT   TopExp_Explorer();
  //! Creates an Explorer on the Shape <S>. <br>
//! <br>
//!          <ToFind> is the type of shapes to search. <br>
//!              TopAbs_VERTEX, TopAbs_EDGE, ... <br>
//! <br>
//!          <ToAvoid>   is the type   of shape to  skip in the <br>
//!          exploration.   If   <ToAvoid>  is  equal  or  less <br>
//!          complex than <ToFind> or if  <ToAVoid> is SHAPE it <br>
//!          has no effect on the exploration. <br>
//! <br>
  Standard_EXPORT   TopExp_Explorer(const TopoDS_Shape& S,const TopAbs_ShapeEnum ToFind,const TopAbs_ShapeEnum ToAvoid = TopAbs_SHAPE);
  //! Resets this explorer on the shape S. It is initialized to <br>
//! search the shape S, for shapes of type ToFind, that <br>
//! are not part of a shape ToAvoid. <br>
//! If the shape ToAvoid is equal to TopAbs_SHAPE, or <br>
//! if it is the same as, or less complex than, the shape <br>
//! ToFind it has no effect on the search. <br>
  Standard_EXPORT     void Init(const TopoDS_Shape& S,const TopAbs_ShapeEnum ToFind,const TopAbs_ShapeEnum ToAvoid = TopAbs_SHAPE) ;
  //! Returns  True if  there are   more  shapes in  the <br>
//!          exploration. <br>
        Standard_Boolean More() const;
  //! Moves to the next Shape in the exploration. <br>
//! Exceptions <br>
//! Standard_NoMoreObject if there are no more shapes to explore. <br>
  Standard_EXPORT     void Next() ;
  //! Returns the current shape in the exploration. <br>
//! Exceptions <br>
//! Standard_NoSuchObject if this explorer has no more shapes to explore. <br>
  Standard_EXPORT    const TopoDS_Shape& Current() const;
  //! Reinitialize  the    exploration with the original <br>
//!          arguments. <br>
  Standard_EXPORT     void ReInit() ;
  //! Returns the current depth of the exploration. 0 is <br>
//!          the shape to explore itself. <br>
        Standard_Integer Depth() const;
  //! Clears the content of the explorer. It will return <br>
//!          False on More(). <br>
        void Clear() ;
  
  Standard_EXPORT     void Destroy() ;
~TopExp_Explorer()
{
  Destroy();
}





protected:





private:



TopExp_Stack myStack;
Standard_Integer myTop;
Standard_Integer mySizeOfStack;
TopoDS_Shape myShape;
Standard_Boolean hasMore;
TopAbs_ShapeEnum toFind;
TopAbs_ShapeEnum toAvoid;


};


#include <TopExp_Explorer.lxx>



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


#endif