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