b311480e |
1 | // Created on: 1994-08-30 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
7fd59977 |
18 | #include <BRep_Builder.hxx> |
42cf5bc1 |
19 | #include <BRep_Tool.hxx> |
7fd59977 |
20 | #include <BRepCheck.hxx> |
7fd59977 |
21 | #include <BRepCheck_Analyzer.hxx> |
22 | #include <BRepCheck_ListIteratorOfListOfStatus.hxx> |
7fd59977 |
23 | #include <BRepCheck_Result.hxx> |
42cf5bc1 |
24 | #include <BRepCheck_Wire.hxx> |
25 | #include <gp_Pnt.hxx> |
26 | #include <Standard_NoSuchObject.hxx> |
27 | #include <TCollection_AsciiString.hxx> |
28 | #include <TopExp.hxx> |
29 | #include <TopoDS.hxx> |
30 | #include <TopoDS_Edge.hxx> |
31 | #include <TopoDS_Face.hxx> |
32 | #include <TopoDS_Iterator.hxx> |
33 | #include <TopoDS_Shape.hxx> |
34 | #include <TopoDS_Vertex.hxx> |
35 | #include <TopOpeBRepBuild_Builder.hxx> |
36 | #include <TopOpeBRepBuild_define.hxx> |
37 | #include <TopOpeBRepBuild_EdgeBuilder.hxx> |
38 | #include <TopOpeBRepBuild_FaceBuilder.hxx> |
39 | #include <TopOpeBRepBuild_GTopo.hxx> |
40 | #include <TopOpeBRepBuild_HBuilder.hxx> |
41 | #include <TopOpeBRepBuild_PaveSet.hxx> |
42 | #include <TopOpeBRepBuild_ShapeSet.hxx> |
43 | #include <TopOpeBRepBuild_ShellFaceSet.hxx> |
44 | #include <TopOpeBRepBuild_SolidBuilder.hxx> |
45 | #include <TopOpeBRepBuild_WireEdgeSet.hxx> |
46 | #include <TopOpeBRepDS_BuildTool.hxx> |
47 | #include <TopOpeBRepDS_CurveIterator.hxx> |
48 | #include <TopOpeBRepDS_HDataStructure.hxx> |
49 | #include <TopOpeBRepDS_ListOfShapeOn1State.hxx> |
50 | #include <TopOpeBRepDS_PointIterator.hxx> |
51 | #include <TopOpeBRepDS_SurfaceIterator.hxx> |
52 | #include <TopOpeBRepTool_ShapeExplorer.hxx> |
53 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
54 | #include <TopTools_ListOfShape.hxx> |
7fd59977 |
55 | |
42cf5bc1 |
56 | //#include <DBRep.hxx> |
0797d9d3 |
57 | #ifdef OCCT_DEBUG |
1d0a9d4d |
58 | extern Standard_Boolean TopOpeBRepBuild_GettraceSPS(); |
7fd59977 |
59 | #endif |
60 | //------------ |
61 | //static Standard_Integer ifvNbFace = 0; |
62 | //static char *name = " "; |
63 | //------------- |
64 | static void CorrectEdgeOrientation(TopoDS_Shape& aWire) |
65 | { |
66 | |
67 | TopTools_ListOfShape anEdgeList, anAuxList, aTrueEdgeList; |
68 | BRep_Builder BB; |
69 | TopoDS_Vertex vf, vl, v1f, v1l; |
70 | Standard_Boolean append = Standard_True; |
71 | |
72 | TopoDS_Iterator tdi(aWire, Standard_False, Standard_False); |
73 | for(; tdi.More(); tdi.Next()) anEdgeList.Append(tdi.Value()); |
74 | |
75 | Standard_Integer n = anEdgeList.Extent(); |
76 | if(n <= 1) return; |
77 | |
78 | TopTools_ListIteratorOfListOfShape anIt(anEdgeList); |
79 | |
80 | TopoDS_Shape anCurEdge = anIt.Value(); |
81 | TopExp::Vertices(TopoDS::Edge(anCurEdge), vf, vl, Standard_True); |
82 | aTrueEdgeList.Append(anCurEdge); |
83 | anIt.Next(); |
84 | |
85 | while(n > 0 && append) { |
86 | |
87 | for(; anIt.More(); anIt.Next()) { |
88 | append = Standard_False; |
89 | anCurEdge = anIt.Value(); |
90 | TopExp::Vertices(TopoDS::Edge(anCurEdge), v1f, v1l, Standard_True); |
91 | if(v1f.IsSame(vl)) { |
92 | aTrueEdgeList.Append(anCurEdge); |
93 | vl = v1l; |
94 | append = Standard_True; |
95 | continue; |
96 | } |
97 | if(v1l.IsSame(vf)) { |
98 | aTrueEdgeList.Append(anCurEdge); |
99 | vf = v1f; |
100 | append = Standard_True; |
101 | continue; |
102 | } |
103 | |
104 | if(v1l.IsSame(vl)) { |
105 | TopoDS_Shape anRevEdge = anCurEdge.Reversed(); |
106 | aTrueEdgeList.Append(anRevEdge); |
107 | vl = v1f; |
108 | append = Standard_True; |
109 | continue; |
110 | } |
111 | if(v1f.IsSame(vf)) { |
112 | TopoDS_Shape anRevEdge = anCurEdge.Reversed(); |
113 | aTrueEdgeList.Append(anRevEdge); |
114 | vf = v1l; |
115 | append = Standard_True; |
116 | continue; |
117 | } |
118 | |
119 | anAuxList.Append(anCurEdge); |
120 | } |
121 | |
122 | anEdgeList.Assign(anAuxList); |
123 | anAuxList.Clear(); //something wrong in Assign when list contains 1 element. |
124 | n = anEdgeList.Extent(); |
125 | anIt.Initialize(anEdgeList); |
126 | } |
127 | |
128 | if(n > 0) aTrueEdgeList.Append(anEdgeList); |
129 | |
130 | aWire.Nullify(); |
131 | BB.MakeWire(TopoDS::Wire(aWire)); |
132 | anIt.Initialize(aTrueEdgeList); |
133 | for(; anIt.More(); anIt.Next()) BB.Add(aWire, anIt.Value()); |
134 | |
135 | } |
136 | |
137 | |
138 | |
139 | static void CorrectUnclosedWire(TopoDS_Shape& aWire) |
140 | { |
141 | // cout << "-------CorrectUnclosedWire" << endl; |
142 | BRep_Builder BB; |
143 | TopoDS_Iterator tdi(aWire, Standard_False, Standard_False); |
144 | Standard_Integer nbe = 0; |
145 | for(; tdi.More(); tdi.Next()) { |
146 | nbe++; |
147 | const TopoDS_Shape& ed = tdi.Value(); |
b2d1851c |
148 | Standard_Integer nbv = ed.NbChildren(); |
7fd59977 |
149 | // cout << "Edge " << nbe << " : " << nbv << endl; |
150 | if(nbv <= 1) { |
151 | // cout << "Remove bad edge" << endl; |
152 | BB.Remove(aWire, ed); |
153 | } |
154 | } |
155 | |
156 | TopTools_IndexedDataMapOfShapeListOfShape VElists; |
157 | VElists.Clear(); |
158 | TopExp::MapShapesAndAncestors(aWire, TopAbs_VERTEX, TopAbs_EDGE, VElists); |
159 | Standard_Integer nbVer = VElists.Extent(), i; |
160 | |
161 | for(i = 1; i <= nbVer; i++) { |
162 | const TopTools_ListOfShape& Elist = VElists.FindFromIndex(i); |
163 | if(Elist.Extent() == 1) { |
164 | TopoDS_Shape anEdge = Elist.First(); |
165 | // cout << "Remove redundant edge" << endl; |
166 | BB.Remove(aWire, anEdge); |
167 | } |
168 | } |
169 | } |
170 | |
171 | //======================================================================= |
172 | //function : MergeShapes |
173 | //purpose : |
174 | //======================================================================= |
175 | |
176 | |
177 | void TopOpeBRepBuild_Builder::MergeShapes(const TopoDS_Shape& S1,const TopAbs_State ToBuild1,const TopoDS_Shape& S2,const TopAbs_State ToBuild2) |
178 | { |
179 | Standard_Boolean lesmemes = S1.IsEqual(S2); |
180 | if (lesmemes) { |
0797d9d3 |
181 | #ifdef OCCT_DEBUG |
7fd59977 |
182 | cout<<"TopOpeBRepBuild : S1 == S2"<<endl; |
183 | #endif |
184 | return; |
185 | } |
186 | |
0797d9d3 |
187 | #ifdef OCCT_DEBUG |
7fd59977 |
188 | GdumpSHASETreset(); |
189 | #endif |
190 | |
191 | myState1 = ToBuild1; |
192 | myState2 = ToBuild2; |
193 | myShape1 = S1; |
194 | myShape2 = S2; |
195 | Standard_Boolean S1null = S1.IsNull(); |
196 | Standard_Boolean S2null = S2.IsNull(); |
197 | |
198 | MapShapes(S1,S2); |
199 | SplitSectionEdges(); |
200 | |
201 | //======================== debut KPart |
202 | if (IsKPart()) { |
203 | MergeKPart(); |
204 | ClearMaps(); |
205 | return; |
206 | } |
207 | //======================== fin KPart |
208 | |
209 | Standard_Boolean RevOri1 = Reverse(ToBuild1,ToBuild2); |
210 | Standard_Boolean RevOri2 = Reverse(ToBuild2,ToBuild1); |
211 | |
212 | // Create a face set <SFS> connected by edges |
213 | // ----------------------------------------- |
214 | TopOpeBRepBuild_ShellFaceSet SFS; |
215 | |
0797d9d3 |
216 | #ifdef OCCT_DEBUG |
7fd59977 |
217 | SFS.DEBNumber(GdumpSHASETindex()); |
218 | #endif |
219 | |
220 | // NYI : SplitCompound appele par SplitShape |
221 | |
222 | TopOpeBRepTool_ShapeExplorer ex1; |
1d47d8d0 |
223 | |
7fd59977 |
224 | TopAbs_ShapeEnum t1=TopAbs_COMPOUND,tex1=TopAbs_COMPOUND; |
1d47d8d0 |
225 | |
7fd59977 |
226 | if ( ! S1null ) { |
227 | t1 = tex1 = TopType(S1); |
228 | if ( t1 == TopAbs_COMPOUND ) { |
229 | tex1 = TopAbs_SOLID; ex1.Init(S1,tex1); |
230 | if ( ! ex1.More() ) { |
231 | tex1 = TopAbs_SHELL; ex1.Init(S1,tex1); |
232 | if ( ! ex1.More() ) { |
233 | tex1 = TopAbs_FACE; ex1.Init(S1,tex1); |
234 | if( ! ex1.More() ) { |
235 | tex1 = TopAbs_EDGE; ex1.Init(S1,tex1); |
236 | } |
237 | } |
238 | } |
239 | } |
240 | else if (t1 == TopAbs_WIRE) { |
241 | tex1 = TopAbs_EDGE; ex1.Init(S1,tex1); |
242 | } |
243 | else ex1.Init(S1,tex1); |
244 | SplitShapes(ex1,ToBuild1,ToBuild2,SFS,RevOri1); |
245 | } |
246 | |
247 | TopOpeBRepTool_ShapeExplorer ex2; |
1d47d8d0 |
248 | |
7fd59977 |
249 | TopAbs_ShapeEnum t2=TopAbs_COMPOUND,tex2=TopAbs_COMPOUND; |
1d47d8d0 |
250 | |
7fd59977 |
251 | if ( ! S2null ) { |
252 | t2 = tex2 = TopType(S2); |
253 | if ( t2 == TopAbs_COMPOUND ) { |
254 | tex2 = TopAbs_SOLID; ex2.Init(S2,tex2); |
255 | if ( ! ex2.More() ) { |
256 | tex2 = TopAbs_SHELL; ex2.Init(S2,tex2); |
257 | if ( ! ex2.More() ) { |
258 | tex2 = TopAbs_FACE; ex2.Init(S2,tex2); |
259 | if( ! ex2.More() ) { |
260 | tex2 = TopAbs_EDGE; ex2.Init(S2,tex2); |
261 | } |
262 | } |
263 | } |
264 | } |
265 | else if (t2 == TopAbs_WIRE) { |
266 | tex2 = TopAbs_EDGE; ex2.Init(S2,tex2); |
267 | } |
268 | else ex2.Init(S2,tex2); |
269 | SplitShapes(ex2,ToBuild2,ToBuild1,SFS,RevOri2); |
270 | } |
271 | |
272 | // S1 or S2 = COMPOUND : connect them the list of merged shapes build |
273 | // on the first subshape. |
274 | |
275 | if ( ! S1null ) { |
276 | if ( t1 == TopAbs_COMPOUND ) { |
277 | TopTools_ListOfShape& L1 = ChangeMerged(S1,ToBuild1); |
278 | ex1.Init(S1,tex1); |
279 | if ( ex1.More() ) { |
280 | const TopoDS_Shape& SS1 = ex1.Current(); |
281 | TopTools_ListOfShape& LSS1 = ChangeMerged(SS1,ToBuild1); |
282 | L1 = LSS1; |
283 | } |
284 | } |
285 | } |
286 | |
287 | if ( ! S2null ) { |
288 | if ( t2 == TopAbs_COMPOUND ) { |
289 | TopTools_ListOfShape& L2 = ChangeMerged(S2,ToBuild2); |
290 | ex2.Init(S2,tex2); |
291 | if ( ex2.More() ) { |
292 | const TopoDS_Shape& SS2 = ex2.Current(); |
293 | TopTools_ListOfShape& LSS2 = ChangeMerged(SS2,ToBuild2); |
294 | L2 = LSS2; |
295 | } |
296 | } |
297 | } |
298 | |
299 | ClearMaps(); |
300 | |
301 | } // MergeShapes |
302 | |
303 | |
304 | //======================================================================= |
305 | //function : Classify |
306 | //purpose : LocOpe use |
307 | //======================================================================= |
308 | |
309 | Standard_Boolean TopOpeBRepBuild_Builder::Classify() const |
310 | { |
311 | return myClassifyVal; |
312 | } |
313 | |
314 | //======================================================================= |
315 | //function : ChangeClassify |
316 | //purpose : LocOpe use |
317 | //======================================================================= |
318 | |
319 | void TopOpeBRepBuild_Builder::ChangeClassify(const Standard_Boolean classify) |
320 | { |
321 | myClassifyDef = Standard_True; |
322 | myClassifyVal = classify; |
323 | } |
324 | |
325 | //======================================================================= |
326 | //function : MergeSolids |
327 | //purpose : |
328 | //======================================================================= |
329 | |
330 | void TopOpeBRepBuild_Builder::MergeSolids(const TopoDS_Shape& S1,const TopAbs_State ToBuild1,const TopoDS_Shape& S2,const TopAbs_State ToBuild2) |
331 | { |
332 | MergeShapes(S1,ToBuild1,S2,ToBuild2); |
333 | } // MergeSolids |
334 | |
335 | |
336 | //======================================================================= |
337 | //function : MergeSolid |
338 | //purpose : |
339 | //======================================================================= |
340 | |
341 | void TopOpeBRepBuild_Builder::MergeSolid(const TopoDS_Shape& S,const TopAbs_State ToBuild) |
342 | { |
343 | TopoDS_Shape Snull; |
344 | MergeShapes(S,ToBuild,Snull,ToBuild); |
345 | } // MergeSolid |
346 | |
347 | |
348 | //======================================================================= |
349 | //function : MakeSolids |
350 | //purpose : |
351 | //======================================================================= |
352 | |
353 | void TopOpeBRepBuild_Builder::MakeSolids(TopOpeBRepBuild_SolidBuilder& SOBU,TopTools_ListOfShape& L) |
354 | { |
355 | TopoDS_Shape newSolid; |
356 | TopoDS_Shape newShell; |
357 | for (SOBU.InitSolid(); SOBU.MoreSolid(); SOBU.NextSolid()) { |
358 | myBuildTool.MakeSolid(newSolid); |
359 | for (SOBU.InitShell(); SOBU.MoreShell(); SOBU.NextShell()) { |
360 | Standard_Boolean isold = SOBU.IsOldShell(); |
361 | if (isold) newShell = SOBU.OldShell(); |
362 | else { |
363 | myBuildTool.MakeShell(newShell); |
364 | for (SOBU.InitFace(); SOBU.MoreFace(); SOBU.NextFace()) { |
365 | TopoDS_Shape F = SOBU.Face(); |
366 | myBuildTool.AddShellFace(newShell,F); |
367 | } |
368 | } |
369 | myBuildTool.Closed(newShell,Standard_True); // NYI : check exact du caractere closed du shell |
370 | myBuildTool.AddSolidShell(newSolid,newShell); |
371 | } |
372 | L.Append(newSolid); |
373 | } |
374 | } |
375 | //======================================================================= |
376 | //function : MakeShells |
377 | //purpose : |
378 | //======================================================================= |
379 | |
380 | void TopOpeBRepBuild_Builder::MakeShells(TopOpeBRepBuild_SolidBuilder& SOBU,TopTools_ListOfShape& L) |
381 | { |
382 | TopoDS_Shape newShell; |
383 | for (SOBU.InitShell(); SOBU.MoreShell(); SOBU.NextShell()) { |
384 | Standard_Boolean isold = SOBU.IsOldShell(); |
385 | if (isold) newShell = SOBU.OldShell(); |
386 | else { |
387 | myBuildTool.MakeShell(newShell); |
388 | for (SOBU.InitFace(); SOBU.MoreFace(); SOBU.NextFace()) { |
389 | TopoDS_Shape F = SOBU.Face(); |
390 | myBuildTool.AddShellFace(newShell,F); |
391 | } |
392 | } |
393 | L.Append(newShell); |
394 | } |
395 | } |
396 | |
397 | |
398 | |
399 | //======================================================================= |
400 | //function : MakeFaces |
401 | //purpose : |
402 | //======================================================================= |
403 | |
404 | void TopOpeBRepBuild_Builder::MakeFaces(const TopoDS_Shape& aFace,TopOpeBRepBuild_FaceBuilder& FABU,TopTools_ListOfShape& L) |
405 | { |
0797d9d3 |
406 | #ifdef OCCT_DEBUG |
7fd59977 |
407 | Standard_Integer iF = 0; Standard_Boolean tSPS = GtraceSPS(aFace,iF); |
408 | if(tSPS){GdumpFABU(FABU);} |
409 | #endif |
410 | Standard_Boolean hashds = (!myDataStructure.IsNull()); |
411 | TopoDS_Shape newFace; |
412 | TopoDS_Shape newWire; |
413 | |
414 | for (FABU.InitFace(); FABU.MoreFace(); FABU.NextFace()) { |
415 | myBuildTool.CopyFace(aFace,newFace); |
416 | Standard_Boolean hns = Standard_False; |
417 | if (hashds) { |
418 | const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS(); |
419 | hns = BDS.HasNewSurface(aFace); |
420 | if (hns) { |
421 | const Handle(Geom_Surface)& SU = BDS.NewSurface(aFace); |
422 | myBuildTool.UpdateSurface(newFace,SU); |
423 | } |
424 | } |
425 | |
426 | |
427 | for (FABU.InitWire(); FABU.MoreWire(); FABU.NextWire()) { |
428 | Standard_Boolean isold = FABU.IsOldWire(); |
429 | if (isold) newWire = FABU.OldWire(); |
430 | else { |
431 | myBuildTool.MakeWire(newWire); |
432 | for(FABU.InitEdge(); FABU.MoreEdge(); FABU.NextEdge()) { |
433 | TopoDS_Shape E = FABU.Edge(); |
434 | if (hns) myBuildTool.UpdateSurface(E,aFace,newFace); |
435 | myBuildTool.AddWireEdge(newWire,E); |
436 | } |
437 | } |
438 | //----------- IFV |
439 | if(!isold) { |
440 | BRepCheck_Analyzer bca(newWire, Standard_False); |
441 | if (!bca.IsValid()) { |
442 | newWire.Free(Standard_True); |
443 | CorrectUnclosedWire(newWire); |
444 | const Handle(BRepCheck_Result)& bcr = bca.Result(newWire); |
445 | BRepCheck_ListIteratorOfListOfStatus itl(bcr->Status()); |
446 | for(; itl.More(); itl.Next() ) { |
447 | if(itl.Value() == BRepCheck_BadOrientationOfSubshape) { |
448 | CorrectEdgeOrientation(newWire); |
449 | break; |
450 | } |
451 | } |
452 | } |
453 | } |
454 | myBuildTool.Closed(newWire,Standard_True); // NYI : check exact du caractere closed du wire |
455 | myBuildTool.AddFaceWire(newFace,newWire); |
456 | } |
457 | |
458 | |
459 | L.Append(newFace); |
460 | } |
461 | } |
462 | |
463 | |
464 | //======================================================================= |
465 | //function : MakeEdges |
466 | //purpose : |
467 | //======================================================================= |
468 | |
469 | void TopOpeBRepBuild_Builder::MakeEdges(const TopoDS_Shape& anEdge,TopOpeBRepBuild_EdgeBuilder& EDBU,TopTools_ListOfShape& L) |
470 | { |
0797d9d3 |
471 | #ifdef OCCT_DEBUG |
7fd59977 |
472 | Standard_Integer iE; Standard_Boolean tSPS = GtraceSPS(anEdge,iE); |
473 | Standard_Integer ne = 0; |
474 | #endif |
475 | |
476 | Standard_Integer nvertex = 0; |
477 | for (TopOpeBRepTool_ShapeExplorer ex(anEdge,TopAbs_VERTEX); ex.More(); ex.Next()) nvertex++; |
478 | |
479 | TopoDS_Shape newEdge; |
480 | for (EDBU.InitEdge(); EDBU.MoreEdge(); EDBU.NextEdge()) { |
481 | |
482 | // 1 vertex sur edge courante => suppression edge |
483 | Standard_Integer nloop = 0; |
484 | for (EDBU.InitVertex(); EDBU.MoreVertex(); EDBU.NextVertex()) nloop++; |
485 | if ( nloop <= 1 ) continue; |
486 | |
487 | myBuildTool.CopyEdge(anEdge,newEdge); |
488 | |
489 | Standard_Boolean hasvertex = Standard_False; |
490 | for (EDBU.InitVertex(); EDBU.MoreVertex(); EDBU.NextVertex()) { |
491 | TopoDS_Shape V = EDBU.Vertex(); |
492 | TopAbs_Orientation Vori = V.Orientation(); |
493 | |
494 | Standard_Boolean hassd = myDataStructure->HasSameDomain(V); |
495 | if (hassd) { |
496 | // on prend le vertex reference de V |
497 | Standard_Integer iref = myDataStructure->SameDomainReference(V); |
498 | V = myDataStructure->Shape(iref); |
499 | V.Orientation(Vori); |
500 | } |
501 | |
502 | TopAbs_Orientation oriV = V.Orientation(); |
503 | if ( oriV != TopAbs_EXTERNAL ) { |
504 | // betonnage |
505 | Standard_Boolean equafound = Standard_False; |
506 | TopExp_Explorer exE(newEdge,TopAbs_VERTEX); |
507 | for (; exE.More(); exE.Next() ) { |
508 | const TopoDS_Shape& VE = exE.Current(); |
509 | TopAbs_Orientation oriVE = VE.Orientation(); |
510 | if ( V.IsEqual(VE) ) { |
511 | equafound = Standard_True; |
512 | break; |
513 | } |
514 | else if (oriVE == TopAbs_FORWARD || oriVE == TopAbs_REVERSED) { |
515 | if (oriV == oriVE) { |
516 | equafound = Standard_True; |
517 | break; |
518 | } |
519 | } |
520 | else if (oriVE == TopAbs_INTERNAL || oriVE == TopAbs_EXTERNAL) { |
521 | Standard_Real parV = EDBU.Parameter(); |
522 | Standard_Real parVE = BRep_Tool::Parameter(TopoDS::Vertex(VE), |
523 | TopoDS::Edge(newEdge)); |
524 | if ( parV == parVE ) { |
525 | equafound = Standard_True; |
526 | break; |
527 | } |
528 | } |
529 | } |
530 | if ( !equafound ) { |
531 | hasvertex = Standard_True; |
532 | Standard_Real parV = EDBU.Parameter(); |
533 | myBuildTool.AddEdgeVertex(newEdge,V); |
534 | myBuildTool.Parameter(newEdge,V,parV); |
535 | } |
536 | |
537 | } |
538 | } // loop on vertices of new edge newEdge |
539 | |
0797d9d3 |
540 | #ifdef OCCT_DEBUG |
7fd59977 |
541 | if(tSPS){cout<<endl;} |
542 | if(tSPS){cout<<"V of new edge "<<++ne<<endl;} |
543 | if(tSPS){GdumpEDG(newEdge);} |
544 | #endif |
545 | |
546 | if (hasvertex) L.Append(newEdge); |
547 | } // loop on EDBU edges |
548 | } // MakeEdges |
549 | |
550 | |
551 | //======================================================================= |
552 | //function : IsMerged |
553 | //purpose : |
554 | //======================================================================= |
555 | |
556 | Standard_Boolean TopOpeBRepBuild_Builder::IsMerged(const TopoDS_Shape& S,const TopAbs_State ToBuild) const |
557 | { |
558 | const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State* p = NULL; |
559 | if ( ToBuild == TopAbs_OUT ) p = &myMergedOUT; |
560 | else if ( ToBuild == TopAbs_IN ) p = &myMergedIN; |
561 | else if ( ToBuild == TopAbs_ON ) p = &myMergedON; |
562 | if ( p == NULL ) return Standard_False; |
563 | |
564 | Standard_Boolean notbound = ! (*p).IsBound(S); |
565 | if ( notbound ) { |
566 | return Standard_False; |
567 | } |
568 | else { |
569 | const TopTools_ListOfShape& L = Merged(S,ToBuild); |
570 | Standard_Boolean isempty = L.IsEmpty(); |
571 | return (!isempty); |
572 | } |
573 | } // IsMerged |
574 | |
575 | |
576 | //======================================================================= |
577 | //function : Merged |
578 | //purpose : |
579 | //======================================================================= |
580 | |
581 | const TopTools_ListOfShape& TopOpeBRepBuild_Builder::Merged(const TopoDS_Shape& S,const TopAbs_State ToBuild) const |
582 | { |
583 | const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State* p = NULL; |
584 | if ( ToBuild == TopAbs_OUT ) p = &myMergedOUT; |
585 | else if ( ToBuild == TopAbs_IN ) p = &myMergedIN; |
586 | else if ( ToBuild == TopAbs_ON ) p = &myMergedON; |
587 | if ( p == NULL ) return myEmptyShapeList; |
588 | |
589 | if ( ! (*p).IsBound(S) ) { |
590 | return myEmptyShapeList; |
591 | } |
592 | else { |
593 | const TopTools_ListOfShape& L = (*p)(S).ListOnState(); |
594 | return L; |
595 | } |
596 | } // Merged |
597 | |
598 | |
599 | //======================================================================= |
600 | //function : ChangeMerged |
601 | //purpose : |
602 | //======================================================================= |
603 | |
604 | TopTools_ListOfShape& TopOpeBRepBuild_Builder::ChangeMerged(const TopoDS_Shape& S, const TopAbs_State ToBuild) |
605 | { |
606 | TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State* p = NULL; |
607 | if ( ToBuild == TopAbs_OUT ) p = &myMergedOUT; |
608 | else if ( ToBuild == TopAbs_IN ) p = &myMergedIN; |
609 | else if ( ToBuild == TopAbs_ON ) p = &myMergedON; |
610 | if ( p == NULL ) return myEmptyShapeList; |
611 | |
612 | if ( ! (*p).IsBound(S) ) { |
613 | TopOpeBRepDS_ListOfShapeOn1State thelist; |
614 | (*p).Bind(S, thelist); |
615 | } |
616 | TopTools_ListOfShape& L = (*p)(S).ChangeListOnState(); |
617 | return L; |
618 | } // ChangeMerged |
619 | |
620 | //======================================================================= |
621 | //function : MergeEdges |
622 | //purpose : |
623 | //======================================================================= |
624 | |
625 | void TopOpeBRepBuild_Builder::MergeEdges(const TopTools_ListOfShape& ,//L1, |
626 | const TopAbs_State ,//ToBuild1, |
627 | const TopTools_ListOfShape& ,//L2, |
628 | const TopAbs_State ,//ToBuild2, |
629 | const Standard_Boolean ,//Keepon1, |
630 | const Standard_Boolean ,//Keepon2, |
631 | const Standard_Boolean )//Keepon12) |
632 | { |
633 | } // MergeEdges |
634 | |
635 | //======================================================================= |
636 | //function : MergeFaces |
637 | //purpose : |
638 | //======================================================================= |
639 | |
640 | void TopOpeBRepBuild_Builder::MergeFaces(const TopTools_ListOfShape& , //S1, |
641 | const TopAbs_State , //ToBuild1, |
642 | const TopTools_ListOfShape& , //S2, |
643 | const TopAbs_State , //ToBuild2 |
644 | const Standard_Boolean ,//onA, |
645 | const Standard_Boolean ,//onB, |
646 | const Standard_Boolean )//onAB) |
647 | { |
648 | } |