Salome HOME
Fix for PAL12857.
[modules/geom.git] / src / NMTTools / NMTTools_DSFiller.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 // File:        NMTTools_DSFiller.cxx
21 // Created:     Fri Dec  5 14:06:34 2003
22 // Author:      Peter KURNEV
23 //              <pkv@irinox>
24
25
26 #include <NMTTools_DSFiller.ixx>
27 #include <NMTTools_PaveFiller.hxx>
28
29 //=======================================================================
30 // function: NMTTools_DSFiller::NMTTools_DSFiller
31 // purpose: 
32 //=======================================================================
33   NMTTools_DSFiller::NMTTools_DSFiller()
34 {
35   myPaveFiller=NULL;
36   myInterfPool=NULL;
37   myDS=NULL;
38   myIsNewFiller=Standard_True;
39   myIsDone=Standard_False;
40 }
41 //=======================================================================
42 // function:Destroy
43 // purpose:
44 //=======================================================================
45   void NMTTools_DSFiller::Destroy() 
46 {
47   Clear();
48 }
49 //=======================================================================
50 // function: Clear
51 // purpose: 
52 //=======================================================================
53   void NMTTools_DSFiller::Clear()
54 {
55   if (myPaveFiller!=NULL) {
56     delete myPaveFiller;
57   }
58   if (myInterfPool!=NULL) {
59     delete myInterfPool;
60   }
61   if (myDS!=NULL) {
62     delete myDS;
63   }
64   myPaveFiller=NULL;
65   myInterfPool=NULL;
66   myDS=NULL;
67 }
68 //=======================================================================
69 // function: SetCompositeShape
70 // purpose: 
71 //=======================================================================
72   void NMTTools_DSFiller::SetCompositeShape(const TopoDS_Shape& aS)
73 {
74   myCompositeShape=aS;
75 }
76 //=======================================================================
77 // function: CompositeShape
78 // purpose: 
79 //=======================================================================
80   const TopoDS_Shape& NMTTools_DSFiller::CompositeShape()const
81 {
82   return myCompositeShape;
83 }
84 //=======================================================================
85 // function:  SetNewFiller
86 // purpose: 
87 //=======================================================================
88   void NMTTools_DSFiller::SetNewFiller(const Standard_Boolean aFlag) const
89 {
90   NMTTools_DSFiller* pDSFiller=(NMTTools_DSFiller*)this;
91   pDSFiller->myIsNewFiller=aFlag;
92 }
93 //=======================================================================
94 // function: IsNewFiller 
95 // purpose: 
96 //=======================================================================
97   Standard_Boolean NMTTools_DSFiller::IsNewFiller() const
98 {
99   return myIsNewFiller;
100 }
101 //=======================================================================
102 // function: DS
103 // purpose: 
104 //=======================================================================
105   const NMTDS_ShapesDataStructure& NMTTools_DSFiller::DS () const 
106 {
107   return *myDS;
108 }
109 //=======================================================================
110 // function: InterfPool
111 // purpose: 
112 //=======================================================================
113   const BOPTools_InterferencePool& NMTTools_DSFiller::InterfPool () const
114 {
115   return *myInterfPool;
116 }
117 //=======================================================================
118 // function:  IsDone
119 // purpose: 
120 //=======================================================================
121   Standard_Boolean NMTTools_DSFiller::IsDone()const 
122 {
123   return myIsDone;
124 }
125 //=======================================================================
126 // function:  PaveFiller
127 // purpose: 
128 //=======================================================================
129   const NMTTools_PaveFiller& NMTTools_DSFiller::PaveFiller()const 
130 {
131   return *myPaveFiller;
132 }
133 //=======================================================================
134 // function:  ChangePaveFiller
135 // purpose: 
136 //=======================================================================
137   NMTTools_PaveFiller& NMTTools_DSFiller::ChangePaveFiller() 
138 {
139   return *myPaveFiller;
140 }
141 //=======================================================================
142 // function:  Perform
143 // purpose: 
144 //=======================================================================
145   void NMTTools_DSFiller::Perform()
146 {
147   myIsDone=Standard_False;
148   //
149   if (myCompositeShape.IsNull()) {
150     return;
151   }
152   //
153   //
154   // Clear contents of the DS if it was before
155   Clear();
156   //
157   myIsNewFiller=Standard_True;
158   //
159   myDS        = new NMTDS_ShapesDataStructure;
160   myDS->SetCompositeShape(myCompositeShape);
161   myDS->Init();
162   //
163   myInterfPool= new BOPTools_InterferencePool (*myDS);
164   //
165   myPaveFiller = new NMTTools_PaveFiller(*myInterfPool);
166   myPaveFiller->Perform();
167   myIsDone=myPaveFiller->IsDone();
168 }