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