Salome HOME
Fix for bug 0019870(Import/Export should show current directory).
[modules/geom.git] / src / NMTTools / NMTTools_CheckerSI.cxx
1 // Copyright (C) 2006 SAMTECH
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File:        NMTTools_CheckerSI.cxx
20 // Created:     Mon Feb 19 11:32:08 2007
21 // Author:      Peter KURNEV
22 //              <pkv@irinox>
23
24
25 #include <NMTTools_CheckerSI.ixx>
26
27 #include <NMTDS_ShapesDataStructure.hxx>
28 #include <NMTDS_IteratorCheckerSI.hxx>
29 #include <NMTDS_InterfPool.hxx>
30 #include <NMTTools_DEProcessor.hxx>
31
32 //=======================================================================
33 //function : 
34 //purpose  : 
35 //=======================================================================
36   NMTTools_CheckerSI::NMTTools_CheckerSI()
37 :
38   NMTTools_PaveFiller()
39 {
40   myStopStatus=0;
41 }
42 //=======================================================================
43 //function : ~
44 //purpose  : 
45 //=======================================================================
46   NMTTools_CheckerSI::~NMTTools_CheckerSI()
47 {
48 }
49 //=======================================================================
50 //function : Clear
51 //purpose  : 
52 //=======================================================================
53   void NMTTools_CheckerSI::Clear()
54 {
55   NMTTools_PaveFiller::Clear();
56 }
57 //=======================================================================
58 //function : StopStatus
59 //purpose  : 
60 //=======================================================================
61   Standard_Integer NMTTools_CheckerSI::StopStatus()const
62 {
63   return myStopStatus;
64 }
65 //=======================================================================
66 //function : Init
67 //purpose  : 
68 //=======================================================================
69   void NMTTools_CheckerSI::Init()
70 {
71   myIsDone=Standard_False;
72   if (myCompositeShape.IsNull()) {
73     return;
74   }
75   //
76   Clear();
77   // 1.
78   myDS=new NMTDS_ShapesDataStructure;
79   myDS->SetCompositeShape(myCompositeShape);
80   myDS->Init();
81   //
82   // 2.
83   myDSIt=new NMTDS_IteratorCheckerSI;
84   myDSIt->SetDS(myDS);
85   myDSIt->Prepare();
86   //
87   // 4.
88   myNbSources=myDS->NumberOfShapesOfTheObject()+
89               myDS->NumberOfShapesOfTheTool();
90   myNbEdges=myDS->NbEdges();
91   // 5
92   myIP=new NMTDS_InterfPool;
93 }
94 //=======================================================================
95 //function : Perform
96 //purpose  : 
97 //=======================================================================
98   void NMTTools_CheckerSI::Perform()
99 {
100   myIsDone=Standard_False;
101   myStopStatus=0;
102   //
103   Init();
104   //1.VV
105   //
106   PerformVV();
107   //
108   // 2.VE
109   myPavePool.Resize (myNbEdges);
110
111   PrepareEdges();
112   //
113   PerformVE();
114   //
115   // 3.VF
116   PerformVF();
117   //
118   // 4.EE
119   myCommonBlockPool.Resize (myNbEdges);
120   mySplitShapesPool.Resize (myNbEdges);
121   myPavePoolNew    .Resize (myNbEdges);
122   //
123   PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
124   if (myStopStatus) {
125     return;
126   }
127   PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
128   if (myStopStatus) {
129     return;
130   }
131   //
132   PerformEE();
133   //
134   RefinePavePool ();
135   if (myStopStatus) {
136     return;
137   }
138   //
139   myPavePoolNew.Destroy();
140   myPavePoolNew.Resize (myNbEdges);
141   //
142   // 5.EF
143   PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
144   if (myStopStatus) {
145     return;
146   }
147   //
148   PerformEF();
149   //
150   RefinePavePool();
151   if (myStopStatus) {
152     return;
153   }
154   //
155   myPavePoolNew.Destroy();
156   //
157   MakeSplitEdges();
158   //
159   UpdateCommonBlocks();
160   //
161   // 6. FF
162   PerformFF ();
163   //
164   MakeBlocks();
165   //
166   MakePCurves();
167   //
168   // 7. Postprocessing 
169   UpdatePaveBlocks();
170   //
171   NMTTools_DEProcessor aDEP(*this);
172   aDEP.Do();
173   //
174   MakeAloneVertices();
175   //
176   myIsDone=Standard_True;
177 }