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