Salome HOME
Fix for bug PAL12858(EDF210 GEOM Preferences menu of GEOM: color of the wireframe?)
[modules/geom.git] / src / NMTTools / NMTTools_PaveFiller.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
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.
8 // 
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.
13 //
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
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 // File:        NMTTools_PaveFiller.cxx
21 // Created:     Fri Dec  5 14:58:54 2003
22 // Author:      Peter KURNEV
23 //              <pkv@irinox>
24 //
25 #include <NMTTools_PaveFiller.ixx>
26 //
27 #include <BOPTColStd_Failure.hxx>
28 #include <NMTDS_ShapesDataStructure.hxx>
29 #include <NMTTools_DEProcessor.hxx>
30 //QQ #include "utilities.h"
31
32 //=======================================================================
33 // function: NMTTools_PaveFiller::NMTTools_PaveFiller
34 // purpose: 
35 //=======================================================================
36   NMTTools_PaveFiller::NMTTools_PaveFiller()
37 {
38   myIntrPool=NULL;
39   myDS=NULL;
40   myIsDone=Standard_False;
41   myNbSources=0;
42   myNbEdges=0;
43 }
44 //=======================================================================
45 // function:NMTTools_PaveFiller::NMTTools_PaveFiller
46 // purpose: 
47 //=======================================================================
48   NMTTools_PaveFiller::NMTTools_PaveFiller(const BOPTools_InterferencePool& aIP)
49 {
50   SetInterferencePool(aIP);
51 }
52 //=======================================================================
53 // function: Destroy
54 // purpose: 
55 //=======================================================================
56   void NMTTools_PaveFiller::Destroy()
57 {
58 }
59 //=======================================================================
60 // function: SetInterferencePool
61 // purpose: 
62 //=======================================================================
63   void NMTTools_PaveFiller::SetInterferencePool(const BOPTools_InterferencePool& aIP)
64 {
65   myIsDone=Standard_False;
66   //
67   myIntrPool=(BOPTools_InterferencePool*)&aIP;
68   myDS=(NMTDS_ShapesDataStructure*)myIntrPool->DS();
69   myNbSources=myDS->NumberOfShapesOfTheObject()+myDS->NumberOfShapesOfTheTool();
70   myNbEdges=myDS->NbEdges();
71 }
72 //=======================================================================
73 // function:  InterfPool
74 // purpose: 
75 //=======================================================================
76   BOPTools_PInterferencePool NMTTools_PaveFiller::InterfPool()
77 {
78   return myIntrPool;
79 }
80 //=======================================================================
81 // function:IsDone
82 // purpose: 
83 //=======================================================================
84   Standard_Boolean NMTTools_PaveFiller::IsDone() const
85 {
86   return myIsDone;
87 }
88 //=======================================================================
89 // function:  DS
90 // purpose: 
91 //=======================================================================
92   NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS()
93 {
94   return myDS;
95 }
96 //=======================================================================
97 // function: Context
98 // purpose: 
99 //=======================================================================
100   const IntTools_Context& NMTTools_PaveFiller::Context() const
101 {
102   return myContext;
103 }
104 //=======================================================================
105 // function: ChangeContext
106 // purpose: 
107 //=======================================================================
108   IntTools_Context& NMTTools_PaveFiller::ChangeContext() 
109 {
110   return myContext;
111 }
112 //=======================================================================
113 // function: PavePool
114 // purpose: 
115 //=======================================================================
116   const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const
117 {
118   return myPavePool;
119 }
120 //=======================================================================
121 // function: ChangePavePool
122 // purpose: 
123 //=======================================================================
124   BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool()
125 {
126   return myPavePool;
127 }
128 //=======================================================================
129 // function:  CommonBlockPool
130 // purpose: 
131 //=======================================================================
132   const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const
133 {
134   return myCommonBlockPool;
135 }
136 //=======================================================================
137 // function:  ChangeCommonBlockPool
138 // purpose: 
139 //=======================================================================
140   NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool()
141 {
142   return myCommonBlockPool;
143 }
144 //=======================================================================
145 // function:  SplitShapesPool
146 // purpose: 
147 //=======================================================================
148   const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const
149 {
150   return mySplitShapesPool;
151 }
152
153 //=======================================================================
154 // function:  ChangeSplitShapesPool
155 // purpose: 
156 //=======================================================================
157   BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool()
158 {
159   return mySplitShapesPool;
160 }
161 //=======================================================================
162 // function: Init
163 // purpose: 
164 //=======================================================================
165   void NMTTools_PaveFiller::Init()
166 {
167   myDSIt.SetDS(myDS);
168 }
169 //=======================================================================
170 // function: Perform
171 // purpose: 
172 //=======================================================================
173   void NMTTools_PaveFiller::Perform()
174 {
175   try {
176     // 0.
177     Init();//myDSIt.SetDS(myDS);
178     //
179     //1.VV
180     PerformVV();
181     PerformNewVertices();
182     //
183     // 2.VE
184     myPavePool.Resize (myNbEdges);
185     PrepareEdges();
186     
187     PerformVE();
188     //
189     // 3.VF
190     PerformVF();
191     //
192     // 4.EE
193     myCommonBlockPool.Resize (myNbEdges);
194     mySplitShapesPool.Resize (myNbEdges);
195     myPavePoolNew    .Resize (myNbEdges);
196     
197     PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
198     PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
199     //
200     PerformEE();
201     //
202     RefinePavePool ();
203     //
204     myPavePoolNew.Destroy();
205     myPavePoolNew.Resize (myNbEdges);
206     //
207     // 5.EF
208     PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
209     PerformEF();
210     RefinePavePool();
211     //
212     myPavePoolNew.Destroy();
213     MakeSplitEdges();
214     UpdateCommonBlocks();
215     //
216     // 6. FF
217     PerformFF ();
218     MakeBlocks();
219     MakePCurves();
220     //
221     // 7.Postprocessing 
222     UpdatePaveBlocks();
223     //
224     NMTTools_DEProcessor aDEP(*this);
225     aDEP.Do();
226     //
227     myIsDone = Standard_True;
228   }
229   catch (BOPTColStd_Failure& /*x*/) {
230     //QQ MESSAGE(x.Message() << flush);
231     myIsDone = Standard_False;
232   }
233 }