Salome HOME
This commit was generated by cvs2git to create tag 'TRIPOLI_323'.
[modules/geom.git] / src / NMTTools / NMTTools_CheckerSI.cxx
1 // Copyright (C) 2007-2012  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.hxx>
25
26 #include <NMTDS_ShapesDataStructure.hxx>
27 #include <NMTDS_IteratorCheckerSI.hxx>
28 #include <NMTDS_InterfPool.hxx>
29 #include <NMTTools_DEProcessor.hxx>
30 #include <IntTools_Context.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   // 3.
88   myNbSources=myDS->NumberOfShapesOfTheObject()+
89               myDS->NumberOfShapesOfTheTool();
90   myNbEdges=myDS->NbEdges();
91   // 4
92   myIP=new NMTDS_InterfPool;
93   //
94   // 5
95   myContext=new IntTools_Context;
96 }
97 //=======================================================================
98 //function : Perform
99 //purpose  :
100 //=======================================================================
101   void NMTTools_CheckerSI::Perform()
102 {
103   myIsDone=Standard_False;
104   myStopStatus=0;
105   //
106   Init();
107   //1.VV
108   //
109   PerformVV();
110   //
111   // 2.VE
112   myPavePool.Resize (myNbEdges);
113
114   PrepareEdges();
115   //
116   PerformVE();
117   //
118   // 3.VF
119   PerformVF();
120   //
121   // 4.EE
122   myCommonBlockPool.Resize (myNbEdges);
123   mySplitShapesPool.Resize (myNbEdges);
124   myPavePoolNew    .Resize (myNbEdges);
125   //
126   PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
127   if (myStopStatus) {
128     return;
129   }
130   PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
131   if (myStopStatus) {
132     return;
133   }
134   //
135   PerformEE();
136   //
137   RefinePavePool ();
138   if (myStopStatus) {
139     return;
140   }
141   //
142   myPavePoolNew.Destroy();
143   myPavePoolNew.Resize (myNbEdges);
144   //
145   // 5.EF
146   PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
147   if (myStopStatus) {
148     return;
149   }
150   //
151   PerformEF();
152   //
153   RefinePavePool();
154   if (myStopStatus) {
155     return;
156   }
157   //
158   myPavePoolNew.Destroy();
159   //
160   MakeSplitEdges();
161   //
162   UpdateCommonBlocks();
163   //
164   // 6. FF
165   PerformFF ();
166   //
167   MakeBlocks();
168   //
169   MakePCurves();
170   //
171   // 7. Postprocessing
172   UpdatePaveBlocks();
173   //
174   NMTTools_DEProcessor aDEP(*this);
175   aDEP.Do();
176   //
177   MakeAloneVertices();
178   //
179   myIsDone=Standard_True;
180 }