Salome HOME
Merge from V5_1_4_BR 07/05/2010
[modules/geom.git] / src / NMTTools / NMTTools_DSFiller.cxx
1 //  Copyright (C) 2007-2010  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
23 // File:        NMTTools_DSFiller.cxx
24 // Created:     Fri Dec  5 14:06:34 2003
25 // Author:      Peter KURNEV
26 //              <pkv@irinox>
27 //
28 #include <NMTTools_DSFiller.ixx>
29 #include <NMTTools_PaveFiller.hxx>
30
31 //=======================================================================
32 // function: NMTTools_DSFiller::NMTTools_DSFiller
33 // purpose: 
34 //=======================================================================
35   NMTTools_DSFiller::NMTTools_DSFiller()
36 {
37   myPaveFiller=NULL;
38   myInterfPool=NULL;
39   myDS=NULL;
40   myIsNewFiller=Standard_True;
41   myIsDone=Standard_False;
42 }
43 //=======================================================================
44 // function:Destroy
45 // purpose:
46 //=======================================================================
47   void NMTTools_DSFiller::Destroy() 
48 {
49   Clear();
50 }
51 //=======================================================================
52 // function: Clear
53 // purpose: 
54 //=======================================================================
55   void NMTTools_DSFiller::Clear()
56 {
57   if (myPaveFiller!=NULL) {
58     delete myPaveFiller;
59   }
60   if (myInterfPool!=NULL) {
61     delete myInterfPool;
62   }
63   if (myDS!=NULL) {
64     delete myDS;
65   }
66   myPaveFiller=NULL;
67   myInterfPool=NULL;
68   myDS=NULL;
69 }
70 //=======================================================================
71 // function: SetCompositeShape
72 // purpose: 
73 //=======================================================================
74   void NMTTools_DSFiller::SetCompositeShape(const TopoDS_Shape& aS)
75 {
76   myCompositeShape=aS;
77 }
78 //=======================================================================
79 // function: CompositeShape
80 // purpose: 
81 //=======================================================================
82   const TopoDS_Shape& NMTTools_DSFiller::CompositeShape()const
83 {
84   return myCompositeShape;
85 }
86 //=======================================================================
87 // function:  SetNewFiller
88 // purpose: 
89 //=======================================================================
90   void NMTTools_DSFiller::SetNewFiller(const Standard_Boolean aFlag) const
91 {
92   NMTTools_DSFiller* pDSFiller=(NMTTools_DSFiller*)this;
93   pDSFiller->myIsNewFiller=aFlag;
94 }
95 //=======================================================================
96 // function: IsNewFiller 
97 // purpose: 
98 //=======================================================================
99   Standard_Boolean NMTTools_DSFiller::IsNewFiller() const
100 {
101   return myIsNewFiller;
102 }
103 //=======================================================================
104 // function: DS
105 // purpose: 
106 //=======================================================================
107   const NMTDS_ShapesDataStructure& NMTTools_DSFiller::DS () const 
108 {
109   return *myDS;
110 }
111 //=======================================================================
112 // function: InterfPool
113 // purpose: 
114 //=======================================================================
115   const BOPTools_InterferencePool& NMTTools_DSFiller::InterfPool () const
116 {
117   return *myInterfPool;
118 }
119 //=======================================================================
120 // function:  IsDone
121 // purpose: 
122 //=======================================================================
123   Standard_Boolean NMTTools_DSFiller::IsDone()const 
124 {
125   return myIsDone;
126 }
127 //=======================================================================
128 // function:  PaveFiller
129 // purpose: 
130 //=======================================================================
131   const NMTTools_PaveFiller& NMTTools_DSFiller::PaveFiller()const 
132 {
133   return *myPaveFiller;
134 }
135 //=======================================================================
136 // function:  ChangePaveFiller
137 // purpose: 
138 //=======================================================================
139   NMTTools_PaveFiller& NMTTools_DSFiller::ChangePaveFiller() 
140 {
141   return *myPaveFiller;
142 }
143 //=======================================================================
144 // function:  Perform
145 // purpose: 
146 //=======================================================================
147   void NMTTools_DSFiller::Perform()
148 {
149   myIsDone=Standard_False;
150   //
151   if (myCompositeShape.IsNull()) {
152     return;
153   }
154   //
155   //
156   // Clear contents of the DS if it was before
157   Clear();
158   //
159   myIsNewFiller=Standard_True;
160   //
161   myDS        = new NMTDS_ShapesDataStructure;
162   myDS->SetCompositeShape(myCompositeShape);
163   myDS->Init();
164   //
165   myInterfPool= new BOPTools_InterferencePool (*myDS);
166   //
167   myPaveFiller = new NMTTools_PaveFiller(*myInterfPool);
168   myPaveFiller->Perform();
169   myIsDone=myPaveFiller->IsDone();
170 }