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