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
|
// File: TopOpeBRepTool_ShapeExplorer.cxx
// Created: Thu Jul 13 17:26:39 1995
// Author: Jean Yves LEBEY
// <jyl@meteox>
#include <TopOpeBRepTool_ShapeExplorer.ixx>
#include <TopAbs.hxx>
#include <Standard_NoMoreObject.hxx>
#include <Standard_NoSuchObject.hxx>
//=======================================================================
//function : TopOpeBRepTool_ShapeExplorer
//purpose :
//=======================================================================
TopOpeBRepTool_ShapeExplorer::TopOpeBRepTool_ShapeExplorer() :
myIndex(0),
myNbShapes(0)
{
}
//=======================================================================
//function : TopOpeBRepTool_ShapeExplorer
//purpose :
//=======================================================================
TopOpeBRepTool_ShapeExplorer::TopOpeBRepTool_ShapeExplorer
(const TopoDS_Shape& S,
const TopAbs_ShapeEnum ToFind,
const TopAbs_ShapeEnum ToAvoid)
{
Init(S,ToFind,ToAvoid);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void TopOpeBRepTool_ShapeExplorer::Init(const TopoDS_Shape& S,
const TopAbs_ShapeEnum ToFind,
const TopAbs_ShapeEnum ToAvoid)
{
myExplorer.Init(S,ToFind,ToAvoid);
#ifdef DEB
myIndex = myNbShapes = 0;
for (;More();Next()) myNbShapes++;
myExplorer.ReInit();
if (More()) myIndex = 1;
#endif
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean TopOpeBRepTool_ShapeExplorer::More()const
{
Standard_Boolean b = myExplorer.More();
return b;
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void TopOpeBRepTool_ShapeExplorer::Next()
{
myExplorer.Next();
#ifdef DEB
myIndex++;
#endif
}
//=======================================================================
//function : Current
//purpose :
//=======================================================================
const TopoDS_Shape& TopOpeBRepTool_ShapeExplorer::Current()const
{
const TopoDS_Shape& S = myExplorer.Current();
return S;
}
//=======================================================================
//function : NbShapes
//purpose :
//=======================================================================
Standard_Integer TopOpeBRepTool_ShapeExplorer::NbShapes()const
{
Standard_Integer n = 0;
#ifdef DEB
n = myNbShapes;
#endif
return n;
}
//=======================================================================
//function : Index
//purpose :
//=======================================================================
Standard_Integer TopOpeBRepTool_ShapeExplorer::Index()const
{
Standard_Integer n = 0;
#ifdef DEB
n = myIndex;
#endif
return n;
}
//=======================================================================
//function : DumpCurrent
//purpose :
//=======================================================================
Standard_OStream& TopOpeBRepTool_ShapeExplorer::DumpCurrent
(Standard_OStream& OS)const
{
#ifdef DEB
if ( More() ) {
const TopoDS_Shape& S = Current();
TopAbs_ShapeEnum T = S.ShapeType();
TopAbs_Orientation O = S.Orientation();
Standard_Integer I = Index();
TopAbs::Print(T,cout);
cout<<"("<<I<<","; TopAbs::Print(O,cout); cout<<") ";
}
#endif
return OS;
}
|