0023258: Missing parenthesis
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_InterferenceIterator.cxx
1 // Created on: 1994-06-06
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 #include <TopOpeBRepDS_InterferenceIterator.ixx>
24
25
26 //=======================================================================
27 //function : TopOpeBRepDS_InterferenceIterator
28 //purpose  : 
29 //=======================================================================
30
31 TopOpeBRepDS_InterferenceIterator::TopOpeBRepDS_InterferenceIterator() :
32   myGKDef(Standard_False),
33   myGDef(Standard_False),
34   mySKDef(Standard_False),
35   mySDef(Standard_False)
36 {
37 }
38
39
40 //=======================================================================
41 //function : TopOpeBRepDS_InterferenceIterator
42 //purpose  : 
43 //=======================================================================
44
45 TopOpeBRepDS_InterferenceIterator::TopOpeBRepDS_InterferenceIterator
46   (const TopOpeBRepDS_ListOfInterference& L) :
47   myGKDef(Standard_False),
48   myGDef(Standard_False),
49   mySKDef(Standard_False),
50   mySDef(Standard_False)
51 {
52   Init(L);
53 }
54
55
56 //=======================================================================
57 //function : Init
58 //purpose  : 
59 //=======================================================================
60
61 void TopOpeBRepDS_InterferenceIterator::Init(const TopOpeBRepDS_ListOfInterference& L)
62 {
63   myIterator.Initialize(L);
64   Match();
65 }
66
67
68 //=======================================================================
69 //function : GeometryKind
70 //purpose  : 
71 //=======================================================================
72
73 void TopOpeBRepDS_InterferenceIterator::GeometryKind(const TopOpeBRepDS_Kind GK)
74 {
75   myGKDef = Standard_True;
76   myGK = GK;
77 }
78
79
80 //=======================================================================
81 //function : Geometry
82 //purpose  : 
83 //=======================================================================
84
85 void TopOpeBRepDS_InterferenceIterator::Geometry(const Standard_Integer G)
86 {
87   myGDef = Standard_True;
88   myG = G;
89 }
90
91
92 //=======================================================================
93 //function : SupportKind
94 //purpose  : 
95 //=======================================================================
96
97 void TopOpeBRepDS_InterferenceIterator::SupportKind(const TopOpeBRepDS_Kind ST)
98 {
99   mySKDef = Standard_True;
100   mySK = ST;
101 }
102
103
104 //=======================================================================
105 //function : Support
106 //purpose  : 
107 //=======================================================================
108
109 void TopOpeBRepDS_InterferenceIterator::Support(const Standard_Integer S)
110 {
111   mySDef = Standard_True;
112   myS = S;
113 }
114
115
116 //=======================================================================
117 //function : Match
118 //purpose  : 
119 //=======================================================================
120
121 void TopOpeBRepDS_InterferenceIterator::Match()
122 {
123   while ( myIterator.More() ) {
124     Handle(TopOpeBRepDS_Interference) I = myIterator.Value();
125     Standard_Boolean b = MatchInterference(I);
126     if ( ! b ) {
127       myIterator.Next();
128     }
129     else break;
130   }
131 }
132
133
134 //=======================================================================
135 //function : Match
136 //purpose  : 
137 //=======================================================================
138
139 Standard_Boolean TopOpeBRepDS_InterferenceIterator::MatchInterference
140   (const Handle(TopOpeBRepDS_Interference)& I) const 
141 {
142   Standard_Boolean GK = myGKDef ? (I->GeometryType() == myGK) : Standard_True;
143   Standard_Boolean SK = mySKDef ? (I->SupportType() == mySK) : Standard_True;
144   Standard_Boolean G = myGDef ? (I->Geometry() == myG) : Standard_True;
145   Standard_Boolean S = mySDef ? (I->Support() == myS) : Standard_True;
146   return (GK && SK && G && S);
147 }
148
149
150 //=======================================================================
151 //function : More
152 //purpose  : 
153 //=======================================================================
154
155 Standard_Boolean TopOpeBRepDS_InterferenceIterator::More() const 
156 {
157   return myIterator.More();
158 }
159
160
161 //=======================================================================
162 //function : Next
163 //purpose  : 
164 //=======================================================================
165
166 void TopOpeBRepDS_InterferenceIterator::Next()
167 {
168   if ( myIterator.More() ) {
169     myIterator.Next();
170     Match();
171   }
172 }
173
174
175 //=======================================================================
176 //function : Value
177 //purpose  : 
178 //=======================================================================
179
180 Handle(TopOpeBRepDS_Interference)& TopOpeBRepDS_InterferenceIterator::Value() const 
181 {
182   return myIterator.Value();
183 }
184
185
186 //=======================================================================
187 //function : ChangeIterator
188 //purpose  : 
189 //=======================================================================
190
191 TopOpeBRepDS_ListIteratorOfListOfInterference& 
192 TopOpeBRepDS_InterferenceIterator::ChangeIterator() 
193 {
194   return myIterator;
195 }