0022627: Change OCCT memory management defaults
[occt.git] / src / TopOpeBRep / TopOpeBRep_ShapeScanner.cxx
1 // File:        TopOpeBRep_ShapeScanner.cxx
2 // Created:     Wed Jul  7 20:10:58 1993
3 // Author:      Jean Yves LEBEY
4 //              <jyl@zerox>
5
6 #include <TopOpeBRep_ShapeScanner.ixx>
7 #include <TopOpeBRepTool_define.hxx>
8 #include <TopAbs.hxx>
9
10 //=======================================================================
11 //function : TopOpeBRep_ShapeScanner
12 //purpose  : 
13 //=======================================================================
14 TopOpeBRep_ShapeScanner::TopOpeBRep_ShapeScanner()
15 {
16 }    
17
18 //=======================================================================
19 //function : Clear
20 //purpose  : 
21 //=======================================================================
22 void TopOpeBRep_ShapeScanner::Clear()
23 {
24   myBoxSort.Clear();
25 }    
26
27 //=======================================================================
28 //function : AddBoxesMakeCOB
29 //purpose  : 
30 //=======================================================================
31 void TopOpeBRep_ShapeScanner::AddBoxesMakeCOB(const TopoDS_Shape& S,const TopAbs_ShapeEnum TS,const TopAbs_ShapeEnum TA)
32 {
33   myBoxSort.AddBoxesMakeCOB(S,TS,TA);
34 }
35
36 //=======================================================================
37 //function : Init
38 //purpose  : 
39 //=======================================================================
40 void TopOpeBRep_ShapeScanner::Init(TopOpeBRepTool_ShapeExplorer &E)
41 {
42   TColStd_ListOfInteger anEmptyList;
43
44   myListIterator.Initialize(anEmptyList);
45
46   for (; E.More(); E.Next() )  {
47     const TopoDS_Shape& cur = E.Current();
48 //    TopAbs_ShapeEnum t = cur.ShapeType();
49     Init(cur);
50     Standard_Boolean b = More();
51     if ( b ) break;
52   }
53 }
54
55 //=======================================================================
56 //function : Init
57 //purpose  : 
58 //=======================================================================
59 void TopOpeBRep_ShapeScanner::Init(const TopoDS_Shape &E)
60 {
61   myListIterator = myBoxSort.Compare(E);
62 }
63
64 //=======================================================================
65 //function : More
66 //purpose  : 
67 //=======================================================================
68 Standard_Boolean TopOpeBRep_ShapeScanner::More() const
69 {
70   Standard_Boolean b = myListIterator.More();
71   return b;
72 }
73
74 //=======================================================================
75 //function : Next
76 //purpose  : 
77 //=======================================================================
78 void TopOpeBRep_ShapeScanner::Next()
79 {
80   myListIterator.Next();
81 }
82
83 //=======================================================================
84 //function : Current
85 //purpose  : 
86 //=======================================================================
87 const TopoDS_Shape& TopOpeBRep_ShapeScanner::Current() const
88 {
89   const TopoDS_Shape& E = myBoxSort.TouchedShape(myListIterator);
90   return E;
91 }
92
93 //=======================================================================
94 //function : BoxSort
95 //purpose  : 
96 //=======================================================================
97 const TopOpeBRepTool_BoxSort& TopOpeBRep_ShapeScanner::BoxSort() const
98 {
99   return myBoxSort;
100 }
101
102 //=======================================================================
103 //function : BoxSort
104 //purpose  : 
105 //=======================================================================
106 TopOpeBRepTool_BoxSort& TopOpeBRep_ShapeScanner::ChangeBoxSort()
107 {
108   return myBoxSort;
109 }
110
111 //=======================================================================
112 //function : Index
113 //purpose  : 
114 //=======================================================================
115 Standard_Integer TopOpeBRep_ShapeScanner::Index()const 
116 {
117   Standard_Integer n = 0;
118   if ( myListIterator.More() ) n = myListIterator.Value();
119   return n;
120 }
121
122 //=======================================================================
123 //function : DumpCurrent
124 //purpose  : 
125 //=======================================================================
126 Standard_OStream& TopOpeBRep_ShapeScanner::DumpCurrent(Standard_OStream& OS)const 
127 {
128 #ifdef DEB
129   if ( More() ) { 
130     const TopoDS_Shape&     S = Current();
131     TopAbs_ShapeEnum    T = S.ShapeType();
132     TopAbs_Orientation  O = S.Orientation();
133     Standard_Integer    I = Index();
134     TopAbs::Print(T,cout);
135     cout<<"("<<I<<","; TopAbs::Print(O,cout); cout<<") ";
136   }
137 #endif
138   return OS;
139 }