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