Integration of OCCT 6.5.0 from SVN
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_InterferenceIterator.cxx
1 // File:        TopOpeBRepDS_InterferenceIterator.cxx
2 // Created:     Mon Jun  6 13:08:36 1994
3 // Author:      Jean Yves LEBEY
4 //              <jyl@meteox>
5
6
7 #include <TopOpeBRepDS_InterferenceIterator.ixx>
8
9
10 //=======================================================================
11 //function : TopOpeBRepDS_InterferenceIterator
12 //purpose  : 
13 //=======================================================================
14
15 TopOpeBRepDS_InterferenceIterator::TopOpeBRepDS_InterferenceIterator() :
16   myGKDef(Standard_False),
17   myGDef(Standard_False),
18   mySKDef(Standard_False),
19   mySDef(Standard_False)
20 {
21 }
22
23
24 //=======================================================================
25 //function : TopOpeBRepDS_InterferenceIterator
26 //purpose  : 
27 //=======================================================================
28
29 TopOpeBRepDS_InterferenceIterator::TopOpeBRepDS_InterferenceIterator
30   (const TopOpeBRepDS_ListOfInterference& L) :
31   myGKDef(Standard_False),
32   myGDef(Standard_False),
33   mySKDef(Standard_False),
34   mySDef(Standard_False)
35 {
36   Init(L);
37 }
38
39
40 //=======================================================================
41 //function : Init
42 //purpose  : 
43 //=======================================================================
44
45 void TopOpeBRepDS_InterferenceIterator::Init(const TopOpeBRepDS_ListOfInterference& L)
46 {
47   myIterator.Initialize(L);
48   Match();
49 }
50
51
52 //=======================================================================
53 //function : GeometryKind
54 //purpose  : 
55 //=======================================================================
56
57 void TopOpeBRepDS_InterferenceIterator::GeometryKind(const TopOpeBRepDS_Kind GK)
58 {
59   myGKDef = Standard_True;
60   myGK = GK;
61 }
62
63
64 //=======================================================================
65 //function : Geometry
66 //purpose  : 
67 //=======================================================================
68
69 void TopOpeBRepDS_InterferenceIterator::Geometry(const Standard_Integer G)
70 {
71   myGDef = Standard_True;
72   myG = G;
73 }
74
75
76 //=======================================================================
77 //function : SupportKind
78 //purpose  : 
79 //=======================================================================
80
81 void TopOpeBRepDS_InterferenceIterator::SupportKind(const TopOpeBRepDS_Kind ST)
82 {
83   mySKDef = Standard_True;
84   mySK = ST;
85 }
86
87
88 //=======================================================================
89 //function : Support
90 //purpose  : 
91 //=======================================================================
92
93 void TopOpeBRepDS_InterferenceIterator::Support(const Standard_Integer S)
94 {
95   mySDef = Standard_True;
96   myS = S;
97 }
98
99
100 //=======================================================================
101 //function : Match
102 //purpose  : 
103 //=======================================================================
104
105 void TopOpeBRepDS_InterferenceIterator::Match()
106 {
107   while ( myIterator.More() ) {
108     Handle(TopOpeBRepDS_Interference) I = myIterator.Value();
109     Standard_Boolean b = MatchInterference(I);
110     if ( ! b ) {
111       myIterator.Next();
112     }
113     else break;
114   }
115 }
116
117
118 //=======================================================================
119 //function : Match
120 //purpose  : 
121 //=======================================================================
122
123 Standard_Boolean TopOpeBRepDS_InterferenceIterator::MatchInterference
124   (const Handle(TopOpeBRepDS_Interference)& I) const 
125 {
126   Standard_Boolean GK = myGKDef ? (I->GeometryType() == myGK) : Standard_True;
127   Standard_Boolean SK = mySKDef ? (I->SupportType() == mySK) : Standard_True;
128   Standard_Boolean G = myGDef ? (I->Geometry() == myG) : Standard_True;
129   Standard_Boolean S = mySDef ? (I->Support() == myS) : Standard_True;
130   return (GK && SK && G && S);
131 }
132
133
134 //=======================================================================
135 //function : More
136 //purpose  : 
137 //=======================================================================
138
139 Standard_Boolean TopOpeBRepDS_InterferenceIterator::More() const 
140 {
141   return myIterator.More();
142 }
143
144
145 //=======================================================================
146 //function : Next
147 //purpose  : 
148 //=======================================================================
149
150 void TopOpeBRepDS_InterferenceIterator::Next()
151 {
152   if ( myIterator.More() ) {
153     myIterator.Next();
154     Match();
155   }
156 }
157
158
159 //=======================================================================
160 //function : Value
161 //purpose  : 
162 //=======================================================================
163
164 Handle(TopOpeBRepDS_Interference)& TopOpeBRepDS_InterferenceIterator::Value() const 
165 {
166   return myIterator.Value();
167 }
168
169
170 //=======================================================================
171 //function : ChangeIterator
172 //purpose  : 
173 //=======================================================================
174
175 TopOpeBRepDS_ListIteratorOfListOfInterference& 
176 TopOpeBRepDS_InterferenceIterator::ChangeIterator() 
177 {
178   return myIterator;
179 }