0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[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-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <TopOpeBRepDS_Interference.hxx>
19 #include <TopOpeBRepDS_InterferenceIterator.hxx>
20
21 //=======================================================================
22 //function : TopOpeBRepDS_InterferenceIterator
23 //purpose  : 
24 //=======================================================================
25 TopOpeBRepDS_InterferenceIterator::TopOpeBRepDS_InterferenceIterator() :
26   myGKDef(Standard_False),
27   myGDef(Standard_False),
28   mySKDef(Standard_False),
29   mySDef(Standard_False)
30 {
31 }
32
33
34 //=======================================================================
35 //function : TopOpeBRepDS_InterferenceIterator
36 //purpose  : 
37 //=======================================================================
38
39 TopOpeBRepDS_InterferenceIterator::TopOpeBRepDS_InterferenceIterator
40   (const TopOpeBRepDS_ListOfInterference& L) :
41   myGKDef(Standard_False),
42   myGDef(Standard_False),
43   mySKDef(Standard_False),
44   mySDef(Standard_False)
45 {
46   Init(L);
47 }
48
49
50 //=======================================================================
51 //function : Init
52 //purpose  : 
53 //=======================================================================
54
55 void TopOpeBRepDS_InterferenceIterator::Init(const TopOpeBRepDS_ListOfInterference& L)
56 {
57   myIterator.Initialize(L);
58   Match();
59 }
60
61
62 //=======================================================================
63 //function : GeometryKind
64 //purpose  : 
65 //=======================================================================
66
67 void TopOpeBRepDS_InterferenceIterator::GeometryKind(const TopOpeBRepDS_Kind GK)
68 {
69   myGKDef = Standard_True;
70   myGK = GK;
71 }
72
73
74 //=======================================================================
75 //function : Geometry
76 //purpose  : 
77 //=======================================================================
78
79 void TopOpeBRepDS_InterferenceIterator::Geometry(const Standard_Integer G)
80 {
81   myGDef = Standard_True;
82   myG = G;
83 }
84
85
86 //=======================================================================
87 //function : SupportKind
88 //purpose  : 
89 //=======================================================================
90
91 void TopOpeBRepDS_InterferenceIterator::SupportKind(const TopOpeBRepDS_Kind ST)
92 {
93   mySKDef = Standard_True;
94   mySK = ST;
95 }
96
97
98 //=======================================================================
99 //function : Support
100 //purpose  : 
101 //=======================================================================
102
103 void TopOpeBRepDS_InterferenceIterator::Support(const Standard_Integer S)
104 {
105   mySDef = Standard_True;
106   myS = S;
107 }
108
109
110 //=======================================================================
111 //function : Match
112 //purpose  : 
113 //=======================================================================
114
115 void TopOpeBRepDS_InterferenceIterator::Match()
116 {
117   while ( myIterator.More() ) {
118     Handle(TopOpeBRepDS_Interference) I = myIterator.Value();
119     Standard_Boolean b = MatchInterference(I);
120     if ( ! b ) {
121       myIterator.Next();
122     }
123     else break;
124   }
125 }
126
127
128 //=======================================================================
129 //function : Match
130 //purpose  : 
131 //=======================================================================
132
133 Standard_Boolean TopOpeBRepDS_InterferenceIterator::MatchInterference
134   (const Handle(TopOpeBRepDS_Interference)& I) const 
135 {
136   Standard_Boolean GK = myGKDef ? (I->GeometryType() == myGK) : Standard_True;
137   Standard_Boolean SK = mySKDef ? (I->SupportType() == mySK) : Standard_True;
138   Standard_Boolean G = myGDef ? (I->Geometry() == myG) : Standard_True;
139   Standard_Boolean S = mySDef ? (I->Support() == myS) : Standard_True;
140   return (GK && SK && G && S);
141 }
142
143
144 //=======================================================================
145 //function : More
146 //purpose  : 
147 //=======================================================================
148
149 Standard_Boolean TopOpeBRepDS_InterferenceIterator::More() const 
150 {
151   return myIterator.More();
152 }
153
154
155 //=======================================================================
156 //function : Next
157 //purpose  : 
158 //=======================================================================
159
160 void TopOpeBRepDS_InterferenceIterator::Next()
161 {
162   if ( myIterator.More() ) {
163     myIterator.Next();
164     Match();
165   }
166 }
167
168
169 //=======================================================================
170 //function : Value
171 //purpose  : 
172 //=======================================================================
173
174 const Handle(TopOpeBRepDS_Interference)& TopOpeBRepDS_InterferenceIterator::Value() const 
175 {
176   return myIterator.Value();
177 }
178
179
180 //=======================================================================
181 //function : ChangeIterator
182 //purpose  : 
183 //=======================================================================
184
185 TopOpeBRepDS_ListIteratorOfListOfInterference& 
186 TopOpeBRepDS_InterferenceIterator::ChangeIterator() 
187 {
188   return myIterator;
189 }