1 // Created on: 1993-06-14
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRep_Builder.hxx>
19 #include <BRep_Tool.hxx>
20 #include <BRepClass3d_SolidClassifier.hxx>
21 #include <Geom2d_Curve.hxx>
22 #include <Geom_Curve.hxx>
24 #include <Precision.hxx>
25 #include <Standard_NoSuchObject.hxx>
26 #include <TCollection_AsciiString.hxx>
29 #include <TopoDS_Compound.hxx>
30 #include <TopoDS_Edge.hxx>
31 #include <TopoDS_Face.hxx>
32 #include <TopoDS_Shape.hxx>
33 #include <TopoDS_Shell.hxx>
34 #include <TopoDS_Vertex.hxx>
35 #include <TopoDS_Wire.hxx>
36 #include <TopOpeBRepBuild_Builder.hxx>
37 #include <TopOpeBRepBuild_define.hxx>
38 #include <TopOpeBRepBuild_EdgeBuilder.hxx>
39 #include <TopOpeBRepBuild_FaceBuilder.hxx>
40 #include <TopOpeBRepBuild_GTool.hxx>
41 #include <TopOpeBRepBuild_GTopo.hxx>
42 #include <TopOpeBRepBuild_HBuilder.hxx>
43 #include <TopOpeBRepBuild_PaveSet.hxx>
44 #include <TopOpeBRepBuild_ShapeSet.hxx>
45 #include <TopOpeBRepBuild_ShellFaceSet.hxx>
46 #include <TopOpeBRepBuild_SolidBuilder.hxx>
47 #include <TopOpeBRepBuild_WireEdgeSet.hxx>
48 #include <TopOpeBRepDS_BuildTool.hxx>
49 #include <TopOpeBRepDS_Config.hxx>
50 #include <TopOpeBRepDS_Curve.hxx>
51 #include <TopOpeBRepDS_CurveExplorer.hxx>
52 #include <TopOpeBRepDS_CurveIterator.hxx>
53 #include <TopOpeBRepDS_DataMapIteratorOfDataMapOfShapeListOfShapeOn1State.hxx>
54 #include <TopOpeBRepDS_Filter.hxx>
55 #include <TopOpeBRepDS_HDataStructure.hxx>
56 #include <TopOpeBRepDS_ListOfShapeOn1State.hxx>
57 #include <TopOpeBRepDS_Point.hxx>
58 #include <TopOpeBRepDS_PointIterator.hxx>
59 #include <TopOpeBRepDS_Reducer.hxx>
60 #include <TopOpeBRepDS_Surface.hxx>
61 #include <TopOpeBRepDS_SurfaceIterator.hxx>
62 #include <TopOpeBRepTool_ShapeExplorer.hxx>
65 extern Standard_Boolean TopOpeBRepBuild_GettraceCU();
66 extern Standard_Boolean TopOpeBRepBuild_GettraceCUV();
67 extern Standard_Boolean TopOpeBRepBuild_GettraceSPF();
68 extern Standard_Boolean TopOpeBRepBuild_GettraceSPS();
69 extern Standard_Boolean TopOpeBRepBuild_GetcontextSF2();
70 extern Standard_Boolean TopOpeBRepBuild_GettraceSHEX();
71 Standard_EXPORT void debmarksplit(const Standard_Integer i) {cout<<"++ debmarksplit "<<i<<endl;}
72 Standard_EXPORT void debchangesplit(const Standard_Integer i) {cout<<"++ debchangesplit "<<i<<endl;}
75 static Standard_Integer STATIC_SOLIDINDEX = 0;
76 #include <TopOpeBRepBuild_SplitEdge.hxx>
77 #include <TopOpeBRepBuild_SplitFace.hxx>
78 #include "TopOpeBRepBuild_SplitSolid.pxx"
79 #include <TopOpeBRepBuild_SplitShapes.hxx>
80 #include "TopOpeBRepBuild_Fill.pxx"
82 Standard_EXPORT TopOpeBRepBuild_Builder* GLOBAL_PBUILDER;
84 //=======================================================================
85 //function : TopOpeBRepBuild_Builder
87 //=======================================================================
88 TopOpeBRepBuild_Builder::TopOpeBRepBuild_Builder(const TopOpeBRepDS_BuildTool& BT)
90 mySectionDone(Standard_False),
92 myClassifyDef(Standard_False),
93 myClassifyVal(Standard_True),
94 myProcessON(Standard_False)
96 GLOBAL_PBUILDER = this;
100 //modified by NIZHNY-MZV Sat May 6 10:04:49 2000
101 //=======================================================================
102 //function : ~TopOpeBRepBuild_Builder
103 //purpose : virtual destructor
104 //=======================================================================
105 TopOpeBRepBuild_Builder::~TopOpeBRepBuild_Builder()
109 //=======================================================================
110 //function : ChangeBuildTool
112 //=======================================================================
113 TopOpeBRepDS_BuildTool& TopOpeBRepBuild_Builder::ChangeBuildTool()
118 //=======================================================================
119 //function : BuildTool
121 //=======================================================================
122 const TopOpeBRepDS_BuildTool& TopOpeBRepBuild_Builder::BuildTool() const
127 //=======================================================================
128 //function : DataStructure
130 //=======================================================================
131 Handle(TopOpeBRepDS_HDataStructure) TopOpeBRepBuild_Builder::DataStructure() const
133 return myDataStructure;
136 //=======================================================================
139 //=======================================================================
140 void TopOpeBRepBuild_Builder::Perform(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
146 myDataStructure = HDS;
148 SplitEvisoONperiodicF();
154 TopOpeBRepDS_Filter F(HDS, &myShapeClassifier);
155 F.ProcessFaceInterferences(mySplitON);
156 TopOpeBRepDS_Reducer R(HDS);
157 R.ProcessFaceInterferences(mySplitON);
160 //=======================================================================
163 //=======================================================================
164 void TopOpeBRepBuild_Builder::Perform(const Handle(TopOpeBRepDS_HDataStructure)& HDS,const TopoDS_Shape& S1, const TopoDS_Shape& S2)
167 myShape1 = S1; myShape2 = S2;
168 myIsKPart = FindIsKPart();
171 //=======================================================================
172 //function : AddIntersectionEdges
174 //=======================================================================
175 void TopOpeBRepBuild_Builder::AddIntersectionEdges
176 (TopoDS_Shape& aFace,const TopAbs_State ToBuild1,const Standard_Boolean RevOri1,TopOpeBRepBuild_ShapeSet& WES) const
179 TopOpeBRepDS_CurveIterator FCurves = myDataStructure->FaceCurves(aFace);
180 for (; FCurves.More(); FCurves.Next()) {
181 Standard_Integer iC = FCurves.Current();
182 const TopTools_ListOfShape& LnewE = NewEdges(iC);
183 for (TopTools_ListIteratorOfListOfShape Iti(LnewE); Iti.More(); Iti.Next()) {
184 anEdge = Iti.Value();
185 TopAbs_Orientation ori = FCurves.Orientation(ToBuild1);
186 TopAbs_Orientation newori = Orient(ori,RevOri1);
188 if(newori == TopAbs_EXTERNAL) continue;
190 myBuildTool.Orientation(anEdge,newori);
191 const Handle(Geom2d_Curve)& PC = FCurves.PCurve();
192 myBuildTool.PCurve(aFace,anEdge,PC);
193 WES.AddStartElement(anEdge);
198 //=======================================================================
201 //=======================================================================
202 void TopOpeBRepBuild_Builder::Clear()
204 const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS();
205 TopOpeBRepDS_DataMapIteratorOfDataMapOfShapeListOfShapeOn1State it;
206 for (it.Initialize(mySplitOUT); it.More(); it.Next()) {
207 const TopoDS_Shape& e = it.Key();
208 if ( e.ShapeType() == TopAbs_EDGE ) {
209 Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
210 if (!isse) mySplitOUT.ChangeFind(e).Clear();
213 for (it.Initialize(mySplitIN); it.More(); it.Next()) {
214 const TopoDS_Shape& e = it.Key();
215 if ( e.ShapeType() == TopAbs_EDGE ) {
216 Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
217 if (!isse) mySplitIN.ChangeFind(e).Clear();
220 for (it.Initialize(mySplitON); it.More(); it.Next()) {
221 const TopoDS_Shape& e = it.Key();
222 if ( e.ShapeType() == TopAbs_EDGE ) {
223 Standard_Boolean isse = BDS.IsSectionEdge(TopoDS::Edge(e));
224 if (!isse) mySplitON.ChangeFind(e).Clear();
232 //=======================================================================
233 //function : NewFaces
235 //=======================================================================
236 const TopTools_ListOfShape& TopOpeBRepBuild_Builder::NewFaces(const Standard_Integer I) const
238 const TopTools_ListOfShape& L = myNewFaces->Array1().Value(I);
242 //=======================================================================
243 //function : ChangeNewFaces
245 //=======================================================================
246 TopTools_ListOfShape& TopOpeBRepBuild_Builder::ChangeNewFaces(const Standard_Integer I)
248 TopTools_ListOfShape& L = myNewFaces->ChangeArray1().ChangeValue(I);
252 //=======================================================================
253 //function : NewEdges
255 //=======================================================================
256 const TopTools_ListOfShape& TopOpeBRepBuild_Builder::NewEdges(const Standard_Integer I) const
258 if ( myNewEdges.IsBound(I) ) {
259 return myNewEdges.Find(I);
262 return myEmptyShapeList;
266 //=======================================================================
267 //function : ChangeNewEdges
269 //=======================================================================
270 TopTools_ListOfShape& TopOpeBRepBuild_Builder::ChangeNewEdges(const Standard_Integer I)
272 if ( ! myNewEdges.IsBound(I) ) {
273 TopTools_ListOfShape thelist;
274 myNewEdges.Bind(I, thelist);
276 TopTools_ListOfShape& L = myNewEdges.ChangeFind(I);
280 //=======================================================================
281 //function : NewVertex
283 //=======================================================================
284 const TopoDS_Shape& TopOpeBRepBuild_Builder::NewVertex(const Standard_Integer I) const
286 const TopoDS_Shape& V = myNewVertices->Array1().Value(I);
290 //=======================================================================
291 //function : ChangeNewVertex
293 //=======================================================================
294 TopoDS_Shape& TopOpeBRepBuild_Builder::ChangeNewVertex(const Standard_Integer I)
296 TopoDS_Shape& V = myNewVertices->ChangeArray1().ChangeValue(I);
300 //=======================================================================
303 //=======================================================================
304 Standard_Boolean TopOpeBRepBuild_Builder::ToSplit(const TopoDS_Shape& S,const TopAbs_State ToBuild) const
306 Standard_Boolean issplit = IsSplit(S,ToBuild);
307 Standard_Boolean hasgeom = myDataStructure->HasGeometry(S);
308 Standard_Boolean hassame = myDataStructure->HasSameDomain(S);
309 Standard_Boolean tosplit = (!issplit) && (hasgeom || hassame);
312 Standard_Integer iS; Standard_Boolean tSPS = GtraceSPS(S,iS);
314 cout<<"tosplit "<<tosplit<<" : !issplit "<<(!issplit);
315 cout<<" && (hasgeom || hassame) ("<<hasgeom<<" || "<<hassame<<")"<<endl;
322 //=======================================================================
323 //function : MarkSplit
325 //=======================================================================
326 void TopOpeBRepBuild_Builder::MarkSplit(const TopoDS_Shape& S,const TopAbs_State ToBuild,const Standard_Boolean Bval)
328 TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State* p = NULL;
329 if ( ToBuild == TopAbs_OUT ) p = &mySplitOUT;
330 else if ( ToBuild == TopAbs_IN ) p = &mySplitIN;
331 else if ( ToBuild == TopAbs_ON ) p = &mySplitON;
332 if ( p == NULL ) return;
334 TopOpeBRepDS_ListOfShapeOn1State thelist;
335 if (!(*p).IsBound(S)) (*p).Bind(S, thelist);
336 TopOpeBRepDS_ListOfShapeOn1State& losos = (*p).ChangeFind(S);
340 Standard_Integer iS; Standard_Boolean tSPS = GtraceSPS(S,iS);
342 GdumpSHA(S, (char *) "MarkSplit ");
343 cout<<" ";TopAbs::Print(ToBuild,cout);cout<<" "<<Bval<<endl;
350 //=======================================================================
353 //=======================================================================
354 Standard_Boolean TopOpeBRepBuild_Builder::IsSplit(const TopoDS_Shape& S,const TopAbs_State ToBuild) const
356 Standard_Boolean res = Standard_False;
357 const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State* p = NULL;
358 if ( ToBuild == TopAbs_OUT ) p = &mySplitOUT;
359 else if ( ToBuild == TopAbs_IN ) p = &mySplitIN;
360 else if ( ToBuild == TopAbs_ON ) p = &mySplitON;
361 if ( p == NULL ) return res;
363 if ((*p).IsBound(S)) {
364 const TopOpeBRepDS_ListOfShapeOn1State& losos = (*p).Find(S);
365 res = losos.IsSplit();
367 // Standard_Integer n = losos.ListOnState().Extent();
373 //=======================================================================
376 //=======================================================================
377 const TopTools_ListOfShape& TopOpeBRepBuild_Builder::Splits(const TopoDS_Shape& S, const TopAbs_State ToBuild) const
379 const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State* p = NULL;
380 if ( ToBuild == TopAbs_OUT ) p = &mySplitOUT;
381 else if ( ToBuild == TopAbs_IN ) p = &mySplitIN;
382 else if ( ToBuild == TopAbs_ON ) p = &mySplitON;
383 if ( p == NULL ) return myEmptyShapeList;
385 if ((*p).IsBound(S)) {
386 const TopOpeBRepDS_ListOfShapeOn1State& losos = (*p).Find(S);
387 const TopTools_ListOfShape& L = losos.ListOnState();
390 return myEmptyShapeList;
393 //=======================================================================
394 //function : ChangeSplit
396 //=======================================================================
397 TopTools_ListOfShape& TopOpeBRepBuild_Builder::ChangeSplit(const TopoDS_Shape& S,const TopAbs_State ToBuild)
400 Standard_Integer iS; Standard_Boolean tSPS = GtraceSPS(S,iS);
402 GdumpSHA(S, (char *) "ChangeSplit ");
403 cout<<" ";TopAbs::Print(ToBuild,cout);cout<<endl;
408 TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State* p = NULL;
409 if ( ToBuild == TopAbs_OUT ) p = &mySplitOUT;
410 else if ( ToBuild == TopAbs_IN ) p = &mySplitIN;
411 else if ( ToBuild == TopAbs_ON ) p = &mySplitON;
412 if ( p == NULL ) return myEmptyShapeList;
413 TopOpeBRepDS_ListOfShapeOn1State thelist1;
414 if (!(*p).IsBound(S)) (*p).Bind(S, thelist1);
415 TopOpeBRepDS_ListOfShapeOn1State& losos = (*p).ChangeFind(S);
416 TopTools_ListOfShape& L = losos.ChangeListOnState();
420 //=======================================================================
421 //function : ShapePosition
422 //purpose : compute position of shape S compared with the shapes of list LS
423 // if S is found IN any shape of LS, return IN
425 //=======================================================================
426 TopAbs_State TopOpeBRepBuild_Builder::ShapePosition(const TopoDS_Shape& S, const TopTools_ListOfShape& LS)
428 TopAbs_State state = TopAbs_UNKNOWN;
430 // take the edges of myEdgeAvoid as shape to avoid
431 // during face classification
432 const TopTools_ListOfShape* PLOS = &myEmptyShapeList;
433 TopAbs_ShapeEnum tS = S.ShapeType();
434 if (tS == TopAbs_FACE) PLOS = &myEdgeAvoid;
435 // NYI : idem with myFaceAvoid if (tS == TopAbs_SOLID)
437 for (TopTools_ListIteratorOfListOfShape Iti(LS); Iti.More(); Iti.Next()) {
438 const TopoDS_Shape& SLS = Iti.Value();
440 // TopAbs_ShapeEnum tSLS = SLS.ShapeType();
442 state = myShapeClassifier.StateShapeShape(S,(*PLOS),SLS);
443 if (state != TopAbs_OUT && state != TopAbs_UNKNOWN) return state;
445 if (state == TopAbs_UNKNOWN) return state;
449 //=======================================================================
450 //function : KeepShape
451 //purpose : compute <pos2> = position of shape <S1> / shapes of list <LS2>
454 // - if (pos2 == ToBuild1)
455 //=======================================================================
456 Standard_Boolean TopOpeBRepBuild_Builder::KeepShape(const TopoDS_Shape& S1,const TopTools_ListOfShape& LS2,const TopAbs_State ToBuild1)
458 Standard_Boolean keep = Standard_True;
459 if ( ! LS2.IsEmpty() ) {
460 TopAbs_State pos2 = ShapePosition(S1,LS2);
461 if ( pos2 != ToBuild1 ) keep = Standard_False;
466 //=======================================================================
468 //purpose : return the type of upper subshape found in <S>
469 //=======================================================================
470 TopAbs_ShapeEnum TopOpeBRepBuild_Builder::TopType(const TopoDS_Shape& S)
473 TopOpeBRepTool_ShapeExplorer e;
475 t = TopAbs_COMPOUND; e.Init(S,t); if (e.More()) return t;
476 t = TopAbs_COMPSOLID; e.Init(S,t); if (e.More()) return t;
477 t = TopAbs_SOLID; e.Init(S,t); if (e.More()) return t;
478 t = TopAbs_SHELL; e.Init(S,t); if (e.More()) return t;
479 t = TopAbs_FACE; e.Init(S,t); if (e.More()) return t;
480 t = TopAbs_WIRE; e.Init(S,t); if (e.More()) return t;
481 t = TopAbs_EDGE; e.Init(S,t); if (e.More()) return t;
482 t = TopAbs_VERTEX; e.Init(S,t); if (e.More()) return t;
487 //=======================================================================
489 //purpose : compute orientation reversibility according to build states
490 //=======================================================================
491 Standard_Boolean TopOpeBRepBuild_Builder::Reverse(const TopAbs_State ToBuild1,const TopAbs_State ToBuild2)
493 Standard_Boolean rev;
494 if (ToBuild1 == TopAbs_IN && ToBuild2 == TopAbs_IN) rev = Standard_False;
495 else rev = (ToBuild1 == TopAbs_IN);
499 //=======================================================================
501 //purpose : reverse the orientation
502 //=======================================================================
503 TopAbs_Orientation TopOpeBRepBuild_Builder::Orient(const TopAbs_Orientation Ori,const Standard_Boolean Reverse)
507 : TopAbs::Complement(Ori);
510 //=======================================================================
511 //function : FindSameDomain
512 //purpose : complete the lists L1,L2 with the shapes of the DS
513 // having same domain :
514 // L1 = shapes sharing the same domain of L2 shapes
515 // L2 = shapes sharing the same domain of L1 shapes
516 // (L1 contains a face)
517 //=======================================================================
518 void TopOpeBRepBuild_Builder::FindSameDomain(TopTools_ListOfShape& L1,TopTools_ListOfShape& L2) const
521 Standard_Integer nl1 = L1.Extent(), nl2 = L2.Extent();
523 while ( nl1 > 0 || nl2 > 0 ) {
525 TopTools_ListIteratorOfListOfShape it1(L1);
526 for (i=1 ; i<=nl1; i++) {
527 const TopoDS_Shape& S1 = it1.Value();
529 // Standard_Integer iS1 = myDataStructure->Shape(S1); // DEB
531 TopTools_ListIteratorOfListOfShape itsd(myDataStructure->SameDomain(S1));
532 for (; itsd.More(); itsd.Next() ) {
533 const TopoDS_Shape& S2 = itsd.Value();
535 // Standard_Integer iS2 = myDataStructure->Shape(S2);// DEB
537 Standard_Boolean found = Contains(S2,L2);
547 TopTools_ListIteratorOfListOfShape it2(L2);
548 for (i=1 ; i<=nl2; i++) {
549 const TopoDS_Shape& S2 = it2.Value();
551 // Standard_Integer iS2 = myDataStructure->Shape(S2);// DEB
553 TopTools_ListIteratorOfListOfShape itsd(myDataStructure->SameDomain(S2));
554 for (; itsd.More(); itsd.Next() ) {
555 const TopoDS_Shape& S1 = itsd.Value();
557 // Standard_Integer iS1 = myDataStructure->Shape(S1);// DEB
559 Standard_Boolean found = Contains(S1,L1);
574 //=======================================================================
575 //function : FindSameDomainSameOrientation
577 //=======================================================================
578 void TopOpeBRepBuild_Builder::FindSameDomainSameOrientation(TopTools_ListOfShape& L1, TopTools_ListOfShape& L2) const
580 FindSameDomain(L1,L2);
581 TopTools_ListIteratorOfListOfShape it(L1);
582 if ( !it.More() ) return;
584 const TopoDS_Shape& sref = it.Value();
586 // Standard_Integer iref = myDataStructure->SameDomainReference(sref);
588 TopOpeBRepDS_Config oref = myDataStructure->SameDomainOrientation(sref);
590 TopTools_ListOfShape LL1,LL2;
592 for (it.Initialize(L1); it.More(); it.Next() ) {
593 const TopoDS_Shape& s = it.Value();
594 TopOpeBRepDS_Config o = myDataStructure->SameDomainOrientation(s);
595 if ( o == oref && !Contains(s,LL1) ) LL1.Append(s);
596 else if ( o != oref && !Contains(s,LL2) ) LL2.Append(s);
599 for (it.Initialize(L2); it.More(); it.Next() ) {
600 const TopoDS_Shape& s = it.Value();
601 TopOpeBRepDS_Config o = myDataStructure->SameDomainOrientation(s);
602 if ( o == oref && !Contains(s,LL1) ) LL1.Append(s);
603 else if ( o != oref && !Contains(s,LL2) ) LL2.Append(s);
611 //=======================================================================
612 //function : MapShapes
614 //=======================================================================
615 void TopOpeBRepBuild_Builder::MapShapes(const TopoDS_Shape& S1,const TopoDS_Shape& S2)
617 Standard_Boolean S1null = S1.IsNull();
618 Standard_Boolean S2null = S2.IsNull();
620 if ( ! S1null ) TopExp::MapShapes(S1,myMAP1);
621 if ( ! S2null ) TopExp::MapShapes(S2,myMAP2);
624 //=======================================================================
625 //function : ClearMaps
627 //=======================================================================
628 void TopOpeBRepBuild_Builder::ClearMaps()
634 //=======================================================================
635 //function : FindSameRank
637 //=======================================================================
638 void TopOpeBRepBuild_Builder::FindSameRank(const TopTools_ListOfShape& L1,const Standard_Integer rank,TopTools_ListOfShape& L2) const
640 for ( TopTools_ListIteratorOfListOfShape it1(L1); it1.More(); it1.Next() ) {
641 const TopoDS_Shape& s = it1.Value();
642 Standard_Integer r = ShapeRank(s);
643 if ( r == rank && !Contains(s,L2) ) {
649 //=======================================================================
650 //function : ShapeRank
652 //=======================================================================
653 Standard_Integer TopOpeBRepBuild_Builder::ShapeRank(const TopoDS_Shape& s) const
655 Standard_Boolean isof1 = IsShapeOf(s,1);
656 Standard_Boolean isof2 = IsShapeOf(s,2);
657 Standard_Integer ancetre = (isof1 || isof2) ? ((isof1) ? 1 : 2) : 0;
661 //=======================================================================
662 //function : IsShapeOf
664 //=======================================================================
665 Standard_Boolean TopOpeBRepBuild_Builder::IsShapeOf(const TopoDS_Shape& s,const Standard_Integer i) const
667 Standard_Boolean b = Standard_False;
668 if (i == 1) b = myMAP1.Contains(s);
669 else if (i == 2) b = myMAP2.Contains(s);
673 //=======================================================================
674 //function : Contains
675 //purpose : returns True if S is in the list L.
676 //=======================================================================
677 Standard_Boolean TopOpeBRepBuild_Builder::Contains(const TopoDS_Shape& S,const TopTools_ListOfShape& L)
679 for (TopTools_ListIteratorOfListOfShape it(L); it.More(); it.Next() ) {
680 TopoDS_Shape& SL = it.Value();
681 Standard_Boolean issame = SL.IsSame(S);
682 if ( issame ) return Standard_True;
684 return Standard_False;
687 //=======================================================================
690 //=======================================================================
691 Standard_Boolean TopOpeBRepBuild_Builder::Opec12() const
693 Standard_Boolean b = (myState1 == TopAbs_OUT) && (myState2 == TopAbs_IN );
697 //=======================================================================
700 //=======================================================================
701 Standard_Boolean TopOpeBRepBuild_Builder::Opec21() const
703 Standard_Boolean b = (myState1 == TopAbs_IN ) && (myState2 == TopAbs_OUT);
707 //=======================================================================
710 //=======================================================================
711 Standard_Boolean TopOpeBRepBuild_Builder::Opecom() const
713 Standard_Boolean b = (myState1 == TopAbs_IN ) && (myState2 == TopAbs_IN );
717 //=======================================================================
720 //=======================================================================
721 Standard_Boolean TopOpeBRepBuild_Builder::Opefus() const
723 Standard_Boolean b = (myState1 == TopAbs_OUT) && (myState2 == TopAbs_OUT);
727 //=======================================================================
730 //=======================================================================
731 const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& TopOpeBRepBuild_Builder::MSplit(const TopAbs_State s) const
733 if (s == TopAbs_IN) return mySplitIN;
734 else if (s == TopAbs_OUT) return mySplitOUT;
735 else if (s == TopAbs_ON) return mySplitON;
739 //=======================================================================
740 //function : ChangeMSplit
742 //=======================================================================
743 TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& TopOpeBRepBuild_Builder::ChangeMSplit(const TopAbs_State s)
745 if (s == TopAbs_IN) return mySplitIN;
746 else if (s == TopAbs_OUT) return mySplitOUT;
747 else if (s == TopAbs_ON) return mySplitON;