0023024: Update headers of OCCT files
[occt.git] / src / BOPTools / BOPTools_PaveFiller_2.cxx
CommitLineData
b311480e 1// Created on: 2001-03-27
2// Created by: Peter KURNEV
3// Copyright (c) 2001-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
21
22#include <BOPTools_PaveFiller.ixx>
23
24#include <TColStd_ListOfInteger.hxx>
25
26#include <BooleanOperations_ShapesDataStructure.hxx>
27#include <BooleanOperations_OnceExplorer.hxx>
28
29#include <BOPTools_ListOfCommonBlock.hxx>
30#include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
31#include <BOPTools_CommonBlock.hxx>
32
33//=======================================================================
7fd59977 34// A P I F U N C T I O N S
7fd59977 35//=======================================================================
36// function: SplitsInFace
37// purpose: splits of edges from nF1 in nF2
38//=======================================================================
b311480e 39Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
7fd59977 40 const Standard_Integer nF1,
41 const Standard_Integer nF2,
42 TColStd_ListOfInteger& aSplits)
43{
44 Standard_Integer nE1;
45 TopAbs_ShapeEnum aT1, aT2;
46
47 aT1=myDS->GetShapeType(nF1);
48 aT2=myDS->GetShapeType(nF2);
49
50 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
51 return 1; // Type mismatch
52 }
53
54 BooleanOperations_OnceExplorer aExp(*myDS);
55 aExp.Init(nF1, TopAbs_EDGE);
56 for (; aExp.More(); aExp.Next()) {
57 nE1=aExp.Current();
58 SplitsInFace (nE1, nF2, aSplits);
59 }
60 return 0; //Ok
61}
62//=======================================================================
63// function: SplitsInFace
64// purpose: splits of edge nE1 in aFace2
65//=======================================================================
66 Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
67 const Standard_Integer nF2,
68 TColStd_ListOfInteger& aSplits)
69{
70 Standard_Integer nF1, nSp;
71 TopAbs_ShapeEnum aT1, aT2;
72
73 aT1=myDS->GetShapeType(nE1);
74 aT2=myDS->GetShapeType(nF2);
75
76 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
77 return 1; // Type mismatch
78 }
79
80 const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
81 BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
82 for (; anItCB.More(); anItCB.Next()) {
83 BOPTools_CommonBlock& aCB=anItCB.Value();
84 BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
85
86 nF1=aCB.Face();
87 if (nF1==nF2) {
88 nSp=aPB1.Edge();
89 aSplits.Append(nSp);
90 }
91 }
92 return 0; //Ok
93}
94
95//=======================================================================
96// function: SplitsOnEdge
97// purpose: splits of edge nE1 on nE2
98//=======================================================================
99 Standard_Integer BOPTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
100 const Standard_Integer nE2,
101 TColStd_ListOfInteger& aSplits)
102{
103 Standard_Integer nE, nSp;
104 TopAbs_ShapeEnum aT1, aT2;
105
106 aT1=myDS->GetShapeType(nE1);
107 aT2=myDS->GetShapeType(nE2);
108
109 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) {
110 return 1; // Type mismatch
111 }
112
113 const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
114 BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
115 for (; anItCB.More(); anItCB.Next()) {
116 BOPTools_CommonBlock& aCB=anItCB.Value();
117 BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
118 BOPTools_PaveBlock& aPB2=aCB.PaveBlock2(nE1);
119 nE=aPB2.OriginalEdge();
120 if (nE==nE2) {
121 nSp=aPB1.Edge();
122 aSplits.Append(nSp);
123 }
124 }
125 return 0; //Ok
126}
127//=======================================================================
128// function: SplitsOnFace
129// purpose: splits of edge nE1 on face nF2
130//=======================================================================
131 Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
132 const Standard_Integer nF2,
133 TColStd_ListOfInteger& aSplits)
134{
135 Standard_Integer nE2, ip;
136 TopAbs_ShapeEnum aT1, aT2;
137
138 aT1=myDS->GetShapeType(nE1);
139 aT2=myDS->GetShapeType(nF2);
140
141 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
142 return 1; // Type mismatch
143 }
144
145 BooleanOperations_OnceExplorer aExp(*myDS);
146 aExp.Init(nF2, TopAbs_EDGE);
147 for (; aExp.More(); aExp.Next()) {
148 nE2=aExp.Current();
149 ip=SplitsOnEdge(nE1, nE2, aSplits);
150 if (ip) {
151 return ip;
152 }
153 }
154 return 0; //Ok
155}
156//=======================================================================
157// function: SplitsOnFace
158// purpose: splits of edges from face nF1 on face nF2
159//=======================================================================
160 Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
161 const Standard_Integer nF1,
162 const Standard_Integer nF2,
163 TColStd_ListOfInteger& aSplits)
164{
165 Standard_Integer nE1, ip;
166 TopAbs_ShapeEnum aT1, aT2;
167
168 aT1=myDS->GetShapeType(nF1);
169 aT2=myDS->GetShapeType(nF2);
170
171 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
172 return 1; // Type mismatch
173 }
174
175 BooleanOperations_OnceExplorer aExp(*myDS);
176 aExp.Init(nF1, TopAbs_EDGE);
177 for (; aExp.More(); aExp.Next()) {
178 nE1=aExp.Current();
179 ip=SplitsOnFace(nE1, nF2, aSplits);
180 if (ip) {
181 return ip;
182 }
183 }
184 return 0; //Ok
185}
186///////////////////////////////////////////////////////////////////////////////////
187//=======================================================================
188// function: SplitsInFace
189// purpose: splits of edges from nF1 in nF2
190//=======================================================================
191 Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer ,//for overriding
192 const Standard_Integer nF1,
193 const Standard_Integer nF2,
194 BOPTools_ListOfPaveBlock& aLPB)
195{
196 Standard_Integer nE1;
197 TopAbs_ShapeEnum aT1, aT2;
198
199 aT1=myDS->GetShapeType(nF1);
200 aT2=myDS->GetShapeType(nF2);
201
202 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
203 return 1; // Type mismatch
204 }
205
206 BooleanOperations_OnceExplorer aExp(*myDS);
207 aExp.Init(nF1, TopAbs_EDGE);
208 for (; aExp.More(); aExp.Next()) {
209 nE1=aExp.Current();
210 SplitsInFace (nE1, nF2, aLPB);
211 }
212 return 0; //Ok
213}
214//=======================================================================
215// function: SplitsInFace
216// purpose: splits of edge nE1 in aFace2
217//=======================================================================
218 Standard_Integer BOPTools_PaveFiller::SplitsInFace(const Standard_Integer nE1,
219 const Standard_Integer nF2,
220 BOPTools_ListOfPaveBlock& aLPB)
221{
222 Standard_Integer nF1;
223 TopAbs_ShapeEnum aT1, aT2;
224
225 aT1=myDS->GetShapeType(nE1);
226 aT2=myDS->GetShapeType(nF2);
227
228 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
229 return 1; // Type mismatch
230 }
231
232 const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
233 BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
234 for (; anItCB.More(); anItCB.Next()) {
235 BOPTools_CommonBlock& aCB=anItCB.Value();
236 BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
237
238 nF1=aCB.Face();
239 if (nF1==nF2) {
240 aLPB.Append(aPB1);
241 }
242 }
243 return 0; //Ok
244}
245
246//=======================================================================
247// function: SplitsOnEdge
248// purpose: splits of edge nE1 on nE2
249//=======================================================================
250 Standard_Integer BOPTools_PaveFiller::SplitsOnEdge(const Standard_Integer nE1,
251 const Standard_Integer nE2,
252 BOPTools_ListOfPaveBlock& aLPB)
253{
254 Standard_Integer nE;
255 TopAbs_ShapeEnum aT1, aT2;
256
257 aT1=myDS->GetShapeType(nE1);
258 aT2=myDS->GetShapeType(nE2);
259
260 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_EDGE) {
261 return 1; // Type mismatch
262 }
263
264 const BOPTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(nE1));
265 BOPTools_ListIteratorOfListOfCommonBlock anItCB(aLCB);
266 for (; anItCB.More(); anItCB.Next()) {
267 BOPTools_CommonBlock& aCB=anItCB.Value();
6e6cd5d9 268 //BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(nE1);
7fd59977 269 BOPTools_PaveBlock& aPB2=aCB.PaveBlock2(nE1);
270 nE=aPB2.OriginalEdge();
271 if (nE==nE2) {
272 //modified by NIZNHY-PKV Tue Apr 4 16:59:24 2006f
273 //aLPB.Append(aPB1);
274 const BOPTools_PaveBlock& aPB1R=aCB.PaveBlock1();
275 aLPB.Append(aPB1R);
276 //modified by NIZNHY-PKV Tue Apr 4 16:59:28 2006t
277 }
278 }
279 return 0; //Ok
280}
281//=======================================================================
282// function: SplitsOnFace
283// purpose: splits of edge nE1 on face nF2
284//=======================================================================
285 Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer nE1,
286 const Standard_Integer nF2,
287 BOPTools_ListOfPaveBlock& aLPB)
288{
289 Standard_Integer nE2, ip;
290 TopAbs_ShapeEnum aT1, aT2;
291
292 aT1=myDS->GetShapeType(nE1);
293 aT2=myDS->GetShapeType(nF2);
294
295 if (aT1!=TopAbs_EDGE || aT2!=TopAbs_FACE) {
296 return 1; // Type mismatch
297 }
298
299 BooleanOperations_OnceExplorer aExp(*myDS);
300 aExp.Init(nF2, TopAbs_EDGE);
301 for (; aExp.More(); aExp.Next()) {
302 nE2=aExp.Current();
303 ip=SplitsOnEdge(nE1, nE2, aLPB);
304 if (ip) {
305 return ip;
306 }
307 }
308 return 0; //Ok
309}
310//=======================================================================
311// function: SplitsOnFace
312// purpose: splits of edges from face nF1 on face nF2
313//=======================================================================
314 Standard_Integer BOPTools_PaveFiller::SplitsOnFace(const Standard_Integer ,//for overriding
315 const Standard_Integer nF1,
316 const Standard_Integer nF2,
317 BOPTools_ListOfPaveBlock& aLPB)
318{
319 Standard_Integer nE1, ip;
320 TopAbs_ShapeEnum aT1, aT2;
321
322 aT1=myDS->GetShapeType(nF1);
323 aT2=myDS->GetShapeType(nF2);
324
325 if (aT1!=TopAbs_FACE || aT2!=TopAbs_FACE) {
326 return 1; // Type mismatch
327 }
328
329 BooleanOperations_OnceExplorer aExp(*myDS);
330 aExp.Init(nF1, TopAbs_EDGE);
331 for (; aExp.More(); aExp.Next()) {
332 nE1=aExp.Current();
333 ip=SplitsOnFace(nE1, nF2, aLPB);
334 if (ip) {
335 return ip;
336 }
337 }
338 return 0; //Ok
339}