1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: NMTTools_PaveFiller_9.cxx
23 // Created: Fri Dec 19 11:15:53 2003
24 // Author: Peter KURNEV
27 #include <NMTTools_PaveFiller.ixx>
29 #include <Geom_Surface.hxx>
31 #include <TopLoc_Location.hxx>
32 #include <TopAbs_Orientation.hxx>
35 #include <TopoDS_Face.hxx>
36 #include <TopoDS_Wire.hxx>
37 #include <TopoDS_Edge.hxx>
38 #include <TopoDS_Shape.hxx>
40 #include <BRep_Builder.hxx>
41 #include <BRep_Tool.hxx>
43 #include <TopExp_Explorer.hxx>
45 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
46 #include <BOPTools_ListOfPaveBlock.hxx>
47 #include <BOPTools_PaveBlock.hxx>
48 #include <BOPTools_Tools3D.hxx>
50 #include <NMTDS_ShapesDataStructure.hxx>
52 #include <NMTTools_CommonBlockAPI.hxx>
53 #include <NMTTools_CommonBlock.hxx>
56 //=======================================================================
57 // function: PrepareFace
59 //=======================================================================
60 void NMTTools_PaveFiller::PrepareFace(const Standard_Integer nF,
63 Standard_Boolean bToReverse, bIsDegenerated;
64 Standard_Integer iRankF, nE, nSp, aNbPB;
70 TopAbs_Orientation anOrF, anOrE;
72 TopExp_Explorer aExpW, aExpE;
73 BOPTools_ListIteratorOfListOfPaveBlock aItPB;
75 iRankF=myDS->Rank(nF);
76 aF=TopoDS::Face(myDS->Shape(nF));
77 anOrF=aF.Orientation();
78 aF.Orientation(TopAbs_FORWARD);
80 Handle(Geom_Surface) aS=BRep_Tool::Surface(aF, aLoc);
81 aTol=BRep_Tool::Tolerance(aF);
83 aBB.MakeFace (newFace, aS, aLoc, aTol);
85 aExpW.Init(aF, TopAbs_WIRE);
86 for (; aExpW.More(); aExpW.Next()) {
87 const TopoDS_Shape& aW=aExpW.Current();
88 aBB.MakeWire(newWire);
90 aExpE.Init(aW, TopAbs_EDGE);
91 for (; aExpE.More(); aExpE.Next()) {
92 const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current());
93 bIsDegenerated=BRep_Tool::Degenerated(aE);
94 anOrE=aE.Orientation();
96 nE=myDS->ShapeIndex(aE, iRankF);
97 const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
100 aBB.Add(newWire, aE);
104 aItPB.Initialize(aLPB);
105 for (; aItPB.More(); aItPB.Next()) {
106 const BOPTools_PaveBlock& aPB=aItPB.Value();
107 const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB);
110 aSp=TopoDS::Edge(myDS->Shape(nSp));
111 if (!bIsDegenerated) {
112 bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, myContext);
118 aSp.Orientation(anOrE);
120 aBB.Add(newWire, aSp);
123 aBB.Add(newFace, newWire);
125 newFace.Orientation(anOrF);