7fd59977 |
1 | // File: BOPTools_PaveFiller_2.cxx |
2 | // Created: Tue Mar 27 17:43:41 2001 |
3 | // Author: Peter KURNEV |
4 | // <pkv@irinox> |
5 | |
6 | |
7 | #include <BOPTools_PaveFiller.ixx> |
8 | |
9 | #include <TColStd_ListOfInteger.hxx> |
10 | |
11 | #include <BooleanOperations_ShapesDataStructure.hxx> |
12 | #include <BooleanOperations_OnceExplorer.hxx> |
13 | |
14 | #include <BOPTools_ListOfCommonBlock.hxx> |
15 | #include <BOPTools_ListIteratorOfListOfCommonBlock.hxx> |
16 | #include <BOPTools_CommonBlock.hxx> |
17 | |
18 | //======================================================================= |
19 | // |
20 | // A P I F U N C T I O N S |
21 | // |
22 | //======================================================================= |
23 | // function: SplitsInFace |
24 | // purpose: splits of edges from nF1 in nF2 |
25 | //======================================================================= |
26 | Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding |
27 | const Standard_Integer nF1, |
28 | const Standard_Integer nF2, |
29 | TColStd_ListOfInteger& aSplits) |
30 | { |
31 | Standard_Integer nE1; |
32 | TopAbs_ShapeEnum aT1, aT2; |
33 | |
34 | aT1=myDS->GetShapeType(nF1); |
35 | aT2=myDS->GetShapeType(nF2); |
36 | |
37 | if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) { |
38 | return 1; // Type mismatch |
39 | } |
40 | |
41 | BooleanOperations_OnceExplorer aExp(*myDS); |
42 | aExp.Init(nF1, TopAbs_EDGE); |
43 | for (; aExp.More(); aExp.Next()) { |
44 | nE1=aExp.Current(); |
45 | SplitsInFace (nE1, nF2, aSplits); |
46 | } |
47 | return 0; //Ok |
48 | } |
49 | //======================================================================= |
50 | // function: SplitsInFace |
51 | // purpose: splits of edge nE1 in aFace2 |
52 | //======================================================================= |
53 | Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer nE1, |
54 | const Standard_Integer nF2, |
55 | TColStd_ListOfInteger& aSplits) |
56 | { |
57 | Standard_Integer nF1, nSp; |
58 | TopAbs_ShapeEnum aT1, aT2; |
59 | |
60 | aT1=myDS->GetShapeType(nE1); |
61 | aT2=myDS->GetShapeType(nF2); |
62 | |
63 | if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) { |
64 | return 1; // Type mismatch |
65 | } |
66 | |
67 | const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); |
68 | BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB); |
69 | for (; anItCB.More(); anItCB.Next()) { |
70 | BOPTools_CommonBlock& aCB=anItCB.Value(); |
71 | BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); |
72 | |
73 | nF1=aCB.Face(); |
74 | if (nF1==nF2) { |
75 | nSp=aPB1.Edge(); |
76 | aSplits.Append(nSp); |
77 | } |
78 | } |
79 | return 0; //Ok |
80 | } |
81 | |
82 | //======================================================================= |
83 | // function: SplitsOnEdge |
84 | // purpose: splits of edge nE1 on nE2 |
85 | //======================================================================= |
86 | Standard_Integer BOPTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1, |
87 | const Standard_Integer nE2, |
88 | TColStd_ListOfInteger& aSplits) |
89 | { |
90 | Standard_Integer nE, nSp; |
91 | TopAbs_ShapeEnum aT1, aT2; |
92 | |
93 | aT1=myDS->GetShapeType(nE1); |
94 | aT2=myDS->GetShapeType(nE2); |
95 | |
96 | if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) { |
97 | return 1; // Type mismatch |
98 | } |
99 | |
100 | const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); |
101 | BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB); |
102 | for (; anItCB.More(); anItCB.Next()) { |
103 | BOPTools_CommonBlock& aCB=anItCB.Value(); |
104 | BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); |
105 | BOPTools_PaveBlock& aPB2=aCB.PaveBlock2(nE1); |
106 | nE=aPB2.OriginalEdge(); |
107 | if (nE==nE2) { |
108 | nSp=aPB1.Edge(); |
109 | aSplits.Append(nSp); |
110 | } |
111 | } |
112 | return 0; //Ok |
113 | } |
114 | //======================================================================= |
115 | // function: SplitsOnFace |
116 | // purpose: splits of edge nE1 on face nF2 |
117 | //======================================================================= |
118 | Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1, |
119 | const Standard_Integer nF2, |
120 | TColStd_ListOfInteger& aSplits) |
121 | { |
122 | Standard_Integer nE2, ip; |
123 | TopAbs_ShapeEnum aT1, aT2; |
124 | |
125 | aT1=myDS->GetShapeType(nE1); |
126 | aT2=myDS->GetShapeType(nF2); |
127 | |
128 | if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) { |
129 | return 1; // Type mismatch |
130 | } |
131 | |
132 | BooleanOperations_OnceExplorer aExp(*myDS); |
133 | aExp.Init(nF2, TopAbs_EDGE); |
134 | for (; aExp.More(); aExp.Next()) { |
135 | nE2=aExp.Current(); |
136 | ip=SplitsOnEdge(nE1, nE2, aSplits); |
137 | if (ip) { |
138 | return ip; |
139 | } |
140 | } |
141 | return 0; //Ok |
142 | } |
143 | //======================================================================= |
144 | // function: SplitsOnFace |
145 | // purpose: splits of edges from face nF1 on face nF2 |
146 | //======================================================================= |
147 | Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding |
148 | const Standard_Integer nF1, |
149 | const Standard_Integer nF2, |
150 | TColStd_ListOfInteger& aSplits) |
151 | { |
152 | Standard_Integer nE1, ip; |
153 | TopAbs_ShapeEnum aT1, aT2; |
154 | |
155 | aT1=myDS->GetShapeType(nF1); |
156 | aT2=myDS->GetShapeType(nF2); |
157 | |
158 | if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) { |
159 | return 1; // Type mismatch |
160 | } |
161 | |
162 | BooleanOperations_OnceExplorer aExp(*myDS); |
163 | aExp.Init(nF1, TopAbs_EDGE); |
164 | for (; aExp.More(); aExp.Next()) { |
165 | nE1=aExp.Current(); |
166 | ip=SplitsOnFace(nE1, nF2, aSplits); |
167 | if (ip) { |
168 | return ip; |
169 | } |
170 | } |
171 | return 0; //Ok |
172 | } |
173 | /////////////////////////////////////////////////////////////////////////////////// |
174 | //======================================================================= |
175 | // function: SplitsInFace |
176 | // purpose: splits of edges from nF1 in nF2 |
177 | //======================================================================= |
178 | Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding |
179 | const Standard_Integer nF1, |
180 | const Standard_Integer nF2, |
181 | BOPTools_ListOfPaveBlock& aLPB) |
182 | { |
183 | Standard_Integer nE1; |
184 | TopAbs_ShapeEnum aT1, aT2; |
185 | |
186 | aT1=myDS->GetShapeType(nF1); |
187 | aT2=myDS->GetShapeType(nF2); |
188 | |
189 | if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) { |
190 | return 1; // Type mismatch |
191 | } |
192 | |
193 | BooleanOperations_OnceExplorer aExp(*myDS); |
194 | aExp.Init(nF1, TopAbs_EDGE); |
195 | for (; aExp.More(); aExp.Next()) { |
196 | nE1=aExp.Current(); |
197 | SplitsInFace (nE1, nF2, aLPB); |
198 | } |
199 | return 0; //Ok |
200 | } |
201 | //======================================================================= |
202 | // function: SplitsInFace |
203 | // purpose: splits of edge nE1 in aFace2 |
204 | //======================================================================= |
205 | Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer nE1, |
206 | const Standard_Integer nF2, |
207 | BOPTools_ListOfPaveBlock& aLPB) |
208 | { |
209 | Standard_Integer nF1; |
210 | TopAbs_ShapeEnum aT1, aT2; |
211 | |
212 | aT1=myDS->GetShapeType(nE1); |
213 | aT2=myDS->GetShapeType(nF2); |
214 | |
215 | if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) { |
216 | return 1; // Type mismatch |
217 | } |
218 | |
219 | const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); |
220 | BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB); |
221 | for (; anItCB.More(); anItCB.Next()) { |
222 | BOPTools_CommonBlock& aCB=anItCB.Value(); |
223 | BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); |
224 | |
225 | nF1=aCB.Face(); |
226 | if (nF1==nF2) { |
227 | aLPB.Append(aPB1); |
228 | } |
229 | } |
230 | return 0; //Ok |
231 | } |
232 | |
233 | //======================================================================= |
234 | // function: SplitsOnEdge |
235 | // purpose: splits of edge nE1 on nE2 |
236 | //======================================================================= |
237 | Standard_Integer BOPTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1, |
238 | const Standard_Integer nE2, |
239 | BOPTools_ListOfPaveBlock& aLPB) |
240 | { |
241 | Standard_Integer nE; |
242 | TopAbs_ShapeEnum aT1, aT2; |
243 | |
244 | aT1=myDS->GetShapeType(nE1); |
245 | aT2=myDS->GetShapeType(nE2); |
246 | |
247 | if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) { |
248 | return 1; // Type mismatch |
249 | } |
250 | |
251 | const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1)); |
252 | BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB); |
253 | for (; anItCB.More(); anItCB.Next()) { |
254 | BOPTools_CommonBlock& aCB=anItCB.Value(); |
255 | BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1); |
256 | BOPTools_PaveBlock& aPB2=aCB.PaveBlock2(nE1); |
257 | nE=aPB2.OriginalEdge(); |
258 | if (nE==nE2) { |
259 | //modified by NIZNHY-PKV Tue Apr 4 16:59:24 2006f |
260 | //aLPB.Append(aPB1); |
261 | const BOPTools_PaveBlock& aPB1R=aCB.PaveBlock1(); |
262 | aLPB.Append(aPB1R); |
263 | //modified by NIZNHY-PKV Tue Apr 4 16:59:28 2006t |
264 | } |
265 | } |
266 | return 0; //Ok |
267 | } |
268 | //======================================================================= |
269 | // function: SplitsOnFace |
270 | // purpose: splits of edge nE1 on face nF2 |
271 | //======================================================================= |
272 | Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1, |
273 | const Standard_Integer nF2, |
274 | BOPTools_ListOfPaveBlock& aLPB) |
275 | { |
276 | Standard_Integer nE2, ip; |
277 | TopAbs_ShapeEnum aT1, aT2; |
278 | |
279 | aT1=myDS->GetShapeType(nE1); |
280 | aT2=myDS->GetShapeType(nF2); |
281 | |
282 | if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) { |
283 | return 1; // Type mismatch |
284 | } |
285 | |
286 | BooleanOperations_OnceExplorer aExp(*myDS); |
287 | aExp.Init(nF2, TopAbs_EDGE); |
288 | for (; aExp.More(); aExp.Next()) { |
289 | nE2=aExp.Current(); |
290 | ip=SplitsOnEdge(nE1, nE2, aLPB); |
291 | if (ip) { |
292 | return ip; |
293 | } |
294 | } |
295 | return 0; //Ok |
296 | } |
297 | //======================================================================= |
298 | // function: SplitsOnFace |
299 | // purpose: splits of edges from face nF1 on face nF2 |
300 | //======================================================================= |
301 | Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding |
302 | const Standard_Integer nF1, |
303 | const Standard_Integer nF2, |
304 | BOPTools_ListOfPaveBlock& aLPB) |
305 | { |
306 | Standard_Integer nE1, ip; |
307 | TopAbs_ShapeEnum aT1, aT2; |
308 | |
309 | aT1=myDS->GetShapeType(nF1); |
310 | aT2=myDS->GetShapeType(nF2); |
311 | |
312 | if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) { |
313 | return 1; // Type mismatch |
314 | } |
315 | |
316 | BooleanOperations_OnceExplorer aExp(*myDS); |
317 | aExp.Init(nF1, TopAbs_EDGE); |
318 | for (; aExp.More(); aExp.Next()) { |
319 | nE1=aExp.Current(); |
320 | ip=SplitsOnFace(nE1, nF2, aLPB); |
321 | if (ip) { |
322 | return ip; |
323 | } |
324 | } |
325 | return 0; //Ok |
326 | } |