1 // Copyright (C) 2007-2010 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
23 // File: NMTTools_PaveFiller_9.cxx
24 // Created: Fri Dec 19 11:15:53 2003
25 // Author: Peter KURNEV
28 #include <NMTTools_PaveFiller.ixx>
30 #include <Geom_Surface.hxx>
32 #include <TopLoc_Location.hxx>
33 #include <TopAbs_Orientation.hxx>
36 #include <TopoDS_Face.hxx>
37 #include <TopoDS_Wire.hxx>
38 #include <TopoDS_Edge.hxx>
39 #include <TopoDS_Shape.hxx>
41 #include <BRep_Builder.hxx>
42 #include <BRep_Tool.hxx>
44 #include <TopExp_Explorer.hxx>
46 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
47 #include <BOPTools_ListOfPaveBlock.hxx>
48 #include <BOPTools_PaveBlock.hxx>
49 #include <BOPTools_Tools3D.hxx>
51 #include <NMTDS_ShapesDataStructure.hxx>
53 #include <NMTTools_CommonBlockAPI.hxx>
54 #include <NMTTools_CommonBlock.hxx>
57 //=======================================================================
58 // function: PrepareFace
60 //=======================================================================
61 void NMTTools_PaveFiller::PrepareFace(const Standard_Integer nF,
64 Standard_Boolean bToReverse, bIsDegenerated;
65 Standard_Integer iRankF, nE, nSp, aNbPB;
71 TopAbs_Orientation anOrF, anOrE;
73 TopExp_Explorer aExpW, aExpE;
74 BOPTools_ListIteratorOfListOfPaveBlock aItPB;
76 iRankF=myDS->Rank(nF);
77 aF=TopoDS::Face(myDS->Shape(nF));
78 anOrF=aF.Orientation();
79 aF.Orientation(TopAbs_FORWARD);
81 Handle(Geom_Surface) aS=BRep_Tool::Surface(aF, aLoc);
82 aTol=BRep_Tool::Tolerance(aF);
84 aBB.MakeFace (newFace, aS, aLoc, aTol);
86 aExpW.Init(aF, TopAbs_WIRE);
87 for (; aExpW.More(); aExpW.Next()) {
88 const TopoDS_Shape& aW=aExpW.Current();
89 aBB.MakeWire(newWire);
91 aExpE.Init(aW, TopAbs_EDGE);
92 for (; aExpE.More(); aExpE.Next()) {
93 const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current());
94 bIsDegenerated=BRep_Tool::Degenerated(aE);
95 anOrE=aE.Orientation();
97 nE=myDS->ShapeIndex(aE, iRankF);
98 const BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
101 aBB.Add(newWire, aE);
105 aItPB.Initialize(aLPB);
106 for (; aItPB.More(); aItPB.Next()) {
107 const BOPTools_PaveBlock& aPB=aItPB.Value();
108 const BOPTools_PaveBlock& aPBR=RealPaveBlock(aPB);
111 aSp=TopoDS::Edge(myDS->Shape(nSp));
112 if (!bIsDegenerated) {
113 bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, myContext);
119 aSp.Orientation(anOrE);
121 aBB.Add(newWire, aSp);
124 aBB.Add(newFace, newWire);
126 newFace.Orientation(anOrF);