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.cxx
24 // Created: Fri Dec 5 14:58:54 2003
25 // Author: Peter KURNEV
28 #include <NMTTools_PaveFiller.ixx>
30 #include <BOPTColStd_Failure.hxx>
31 #include <NMTDS_ShapesDataStructure.hxx>
32 #include <NMTTools_DEProcessor.hxx>
33 #include <NMTDS_Iterator.hxx>
34 #include <NMTDS_InterfPool.hxx>
36 //=======================================================================
37 // function: NMTTools_PaveFiller::NMTTools_PaveFiller
39 //=======================================================================
40 NMTTools_PaveFiller::NMTTools_PaveFiller()
44 myIsDone=Standard_False;
49 //=======================================================================
52 //=======================================================================
53 NMTTools_PaveFiller::~NMTTools_PaveFiller()
57 //=======================================================================
60 //=======================================================================
61 void NMTTools_PaveFiller::Clear()
77 //=======================================================================
78 // function: SetCompositeShape
80 //=======================================================================
81 void NMTTools_PaveFiller::SetCompositeShape(const TopoDS_Shape& aS)
85 //=======================================================================
86 // function: CompositeShape
88 //=======================================================================
89 const TopoDS_Shape& NMTTools_PaveFiller::CompositeShape()const
91 return myCompositeShape;
93 //=======================================================================
96 //=======================================================================
97 NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS()
101 //=======================================================================
104 //=======================================================================
105 NMTDS_PIterator NMTTools_PaveFiller::DSIt()
109 //=======================================================================
112 //=======================================================================
113 NMTDS_PInterfPool NMTTools_PaveFiller::IP()
117 //=======================================================================
120 //=======================================================================
121 Standard_Boolean NMTTools_PaveFiller::IsDone() const
125 //=======================================================================
128 //=======================================================================
129 const IntTools_Context& NMTTools_PaveFiller::Context() const
133 //=======================================================================
134 // function: ChangeContext
136 //=======================================================================
137 IntTools_Context& NMTTools_PaveFiller::ChangeContext()
141 //=======================================================================
142 // function: PavePool
144 //=======================================================================
145 const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const
149 //=======================================================================
150 // function: ChangePavePool
152 //=======================================================================
153 BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool()
157 //=======================================================================
158 // function: ChangePavePoolNew
160 //=======================================================================
161 BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePoolNew()
163 return myPavePoolNew;
165 //=======================================================================
166 // function: CommonBlockPool
168 //=======================================================================
169 const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const
171 return myCommonBlockPool;
173 //=======================================================================
174 // function: ChangeCommonBlockPool
176 //=======================================================================
177 NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool()
179 return myCommonBlockPool;
181 //=======================================================================
182 // function: SplitShapesPool
184 //=======================================================================
185 const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const
187 return mySplitShapesPool;
189 //=======================================================================
190 // function: ChangeSplitShapesPool
192 //=======================================================================
193 BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool()
195 return mySplitShapesPool;
197 //=======================================================================
200 //=======================================================================
201 void NMTTools_PaveFiller::Init()
203 myIsDone=Standard_False;
204 if (myCompositeShape.IsNull()) {
210 myDS=new NMTDS_ShapesDataStructure;
211 myDS->SetCompositeShape(myCompositeShape);
215 myDSIt=new NMTDS_Iterator;
220 myNbSources=myDS->NumberOfShapesOfTheObject()+
221 myDS->NumberOfShapesOfTheTool();
222 myNbEdges=myDS->NbEdges();
225 myIP=new NMTDS_InterfPool;
228 //=======================================================================
231 //=======================================================================
232 void NMTTools_PaveFiller::Perform()
234 myIsDone=Standard_False;
245 myPavePool.Resize (myNbEdges);
255 myCommonBlockPool.Resize (myNbEdges);
256 mySplitShapesPool.Resize (myNbEdges);
257 myPavePoolNew .Resize (myNbEdges);
259 PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
260 PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
266 myPavePoolNew.Destroy();
267 myPavePoolNew.Resize (myNbEdges);
270 PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
275 myPavePoolNew.Destroy();
279 UpdateCommonBlocks();
291 NMTTools_DEProcessor aDEP(*this);
296 myIsDone=Standard_True;
298 catch (BOPTColStd_Failure& ) {