Salome HOME
untabify
[modules/geom.git] / src / NMTTools / NMTTools_CheckerSI.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File:       NMTTools_CheckerSI.cxx
23 //  Created:    Mon Feb 19 11:32:08 2007
24 //  Author:     Peter KURNEV
25 //
26 #include <NMTTools_CheckerSI.ixx>
27
28 #include <NMTDS_ShapesDataStructure.hxx>
29 #include <NMTDS_IteratorCheckerSI.hxx>
30 #include <NMTDS_InterfPool.hxx>
31 #include <NMTTools_DEProcessor.hxx>
32
33 //=======================================================================
34 //function : 
35 //purpose  : 
36 //=======================================================================
37   NMTTools_CheckerSI::NMTTools_CheckerSI()
38 :
39   NMTTools_PaveFiller()
40 {
41   myStopStatus=0;
42 }
43 //=======================================================================
44 //function : ~
45 //purpose  : 
46 //=======================================================================
47   NMTTools_CheckerSI::~NMTTools_CheckerSI()
48 {
49 }
50 //=======================================================================
51 //function : Clear
52 //purpose  : 
53 //=======================================================================
54   void NMTTools_CheckerSI::Clear()
55 {
56   NMTTools_PaveFiller::Clear();
57 }
58 //=======================================================================
59 //function : StopStatus
60 //purpose  : 
61 //=======================================================================
62   Standard_Integer NMTTools_CheckerSI::StopStatus()const
63 {
64   return myStopStatus;
65 }
66 //=======================================================================
67 //function : Init
68 //purpose  : 
69 //=======================================================================
70   void NMTTools_CheckerSI::Init()
71 {
72   myIsDone=Standard_False;
73   if (myCompositeShape.IsNull()) {
74     return;
75   }
76   //
77   Clear();
78   // 1.
79   myDS=new NMTDS_ShapesDataStructure;
80   myDS->SetCompositeShape(myCompositeShape);
81   myDS->Init();
82   //
83   // 2.
84   myDSIt=new NMTDS_IteratorCheckerSI;
85   myDSIt->SetDS(myDS);
86   myDSIt->Prepare();
87   //
88   // 4.
89   myNbSources=myDS->NumberOfShapesOfTheObject()+
90               myDS->NumberOfShapesOfTheTool();
91   myNbEdges=myDS->NbEdges();
92   // 5
93   myIP=new NMTDS_InterfPool;
94 }
95 //=======================================================================
96 //function : Perform
97 //purpose  : 
98 //=======================================================================
99   void NMTTools_CheckerSI::Perform()
100 {
101   myIsDone=Standard_False;
102   myStopStatus=0;
103   //
104   Init();
105   //1.VV
106   //
107   PerformVV();
108   //
109   // 2.VE
110   myPavePool.Resize (myNbEdges);
111
112   PrepareEdges();
113   //
114   PerformVE();
115   //
116   // 3.VF
117   PerformVF();
118   //
119   // 4.EE
120   myCommonBlockPool.Resize (myNbEdges);
121   mySplitShapesPool.Resize (myNbEdges);
122   myPavePoolNew    .Resize (myNbEdges);
123   //
124   PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
125   if (myStopStatus) {
126     return;
127   }
128   PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
129   if (myStopStatus) {
130     return;
131   }
132   //
133   PerformEE();
134   //
135   RefinePavePool ();
136   if (myStopStatus) {
137     return;
138   }
139   //
140   myPavePoolNew.Destroy();
141   myPavePoolNew.Resize (myNbEdges);
142   //
143   // 5.EF
144   PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
145   if (myStopStatus) {
146     return;
147   }
148   //
149   PerformEF();
150   //
151   RefinePavePool();
152   if (myStopStatus) {
153     return;
154   }
155   //
156   myPavePoolNew.Destroy();
157   //
158   MakeSplitEdges();
159   //
160   UpdateCommonBlocks();
161   //
162   // 6. FF
163   PerformFF ();
164   //
165   MakeBlocks();
166   //
167   MakePCurves();
168   //
169   // 7. Postprocessing 
170   UpdatePaveBlocks();
171   //
172   NMTTools_DEProcessor aDEP(*this);
173   aDEP.Do();
174   //
175   MakeAloneVertices();
176   //
177   myIsDone=Standard_True;
178 }