Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_Builder.hxx
1 // Copyright (C) 2007-2012  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:        GEOMAlgo_Builder.cxx
23 // Created:
24 // Author:      Peter KURNEV
25 //
26 #ifndef _GEOMAlgo_Builder_HeaderFile
27 #define _GEOMAlgo_Builder_HeaderFile
28
29 #include <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <NMTTools_PPaveFiller.hxx>
32 #include <TopTools_ListOfShape.hxx>
33 #include <Standard_Integer.hxx>
34 #include <TopTools_MapOfShape.hxx>
35 #include <BRepAlgo_Image.hxx>
36 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
37 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
38 #include <GEOMAlgo_BuilderShape.hxx>
39 #include <NMTTools_PaveFiller.hxx>
40 #include <Standard_Boolean.hxx>
41 #include <TopAbs_ShapeEnum.hxx>
42 #include <TopoDS_Shape.hxx>
43 #include <BRepAlgo_Image.hxx>
44
45 //=======================================================================
46 //function : GEOMAlgo_Builder
47 //purpose  :
48 //=======================================================================
49 class GEOMAlgo_Builder  : public GEOMAlgo_BuilderShape
50 {
51  public:
52   //!  Empty constructor <br>
53   Standard_EXPORT
54     GEOMAlgo_Builder();
55
56   Standard_EXPORT
57     virtual ~GEOMAlgo_Builder();
58
59   //!  Performs calculations <br>
60   Standard_EXPORT
61     virtual  void Perform() ;
62
63   //!  Performs calculations using prepared PaveFiller <br>
64   //!           object theDSF <br>
65   Standard_EXPORT
66     virtual  void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ;
67
68   //!  Adds argument theShape of the operation <br>
69   Standard_EXPORT
70     virtual  void AddShape(const TopoDS_Shape& theShape) ;
71
72   //!  Clears internal fields and arguments <br>
73   Standard_EXPORT
74     virtual  void Clear() ;
75
76   //!  Returns the arguments of the operation <br>
77   Standard_EXPORT
78     const TopTools_ListOfShape& Shapes() const;
79
80   //! Returns the  list of shapes generated from the <br>
81   //!          shape theS. <br>
82   Standard_EXPORT
83     virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;
84
85   //! Returns the list of shapes modified from the shape <br>
86   //!          theS. <br>
87   Standard_EXPORT
88     virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;
89
90   //! Returns true if the shape theS has been deleted. <br>
91   Standard_EXPORT
92     virtual  Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
93
94   //!  Adds arguments of the operation as <br>
95   //!           shapes of upper level of container shape theShape <br>
96   Standard_EXPORT
97     void AddCompound(const TopoDS_Shape& theShape) ;
98
99   //! Returns list of arguments of type theType <br>
100   Standard_EXPORT
101     const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const;
102
103   //! Returns image shapes <br>
104   Standard_EXPORT
105     const BRepAlgo_Image& Images() const;
106
107   //! Returns split-parts of shapes that have <br>
108   //!          state IN for the domain of shape theShape <br>
109   Standard_EXPORT
110     const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const;
111
112 protected:
113   //!  Performs calculations using prepared DSFiller <br>
114   //!           object theDSF <br>
115   Standard_EXPORT
116     virtual  void PerformInternal(const NMTTools_PaveFiller& theDSF) ;
117
118   //!  Prepare information for history support <br>
119   Standard_EXPORT
120     virtual  void PrepareHistory() ;
121
122   //!  Clears internal fields <br>
123   Standard_EXPORT
124     virtual  void ClearInternals() ;
125
126   //!  Provides preparing actions <br>
127   Standard_EXPORT
128     virtual  void Prepare() ;
129
130   //!  Provides post-tratment actions <br>
131   Standard_EXPORT
132     virtual  void PostTreat() ;
133
134   //!  Append the argument theShape to <br>
135   //!           typified lists of arguments myShapes1 <br>
136   Standard_EXPORT
137     void AddShape1(const TopoDS_Shape& theShape) ;
138
139   //! Build the resulting shapes of type theType <br>
140   Standard_EXPORT
141     virtual  void BuildResult(const TopAbs_ShapeEnum theType) ;
142
143   //! Fill Images for vertices <br>
144   Standard_EXPORT
145     void FillImagesVertices() ;
146
147   //! Fill Images for edges <br>
148   Standard_EXPORT
149     void FillImagesEdges() ;
150
151   //! Fill Images for faces <br>
152   Standard_EXPORT
153     void FillImagesFaces() ;
154
155   //! For each interferred face find split edges <br>
156   //!          that are in 2-D domain of the face <br>
157   Standard_EXPORT
158     void FillIn2DParts() ;
159
160   //! Build draft faces <br>
161   Standard_EXPORT
162     void BuildSplitFaces() ;
163
164   //! Among draft faces find same domain faces <br>
165   Standard_EXPORT
166     void FillSameDomainFaces() ;
167
168   //! Fill Images for faces <br>
169   //!          taking into account same domain faces <br>
170   Standard_EXPORT
171     void FillImagesFaces1() ;
172
173   //! Update Images for faces by <br>
174   //!          internal vertices <br>
175   Standard_EXPORT
176     void FillInternalVertices() ;
177
178   //!  Fill Images for Wires, Shells, Compsolids, Compounds <br>
179   Standard_EXPORT
180     void FillImagesContainers(const TopAbs_ShapeEnum theType) ;
181
182   //!  Fill Images for solids <br>
183   Standard_EXPORT
184     void FillImagesSolids() ;
185
186   //! For each interferred solid find split faces <br>
187   //!          that are in 3-D domain of the solid <br>
188   Standard_EXPORT
189     void FillIn3DParts() ;
190
191   //! Build draft solids <br>
192   Standard_EXPORT
193     void BuildSplitSolids() ;
194
195   //!  Update draft solids by <br>
196   //!           internal shells, edges, vertices <br>
197   Standard_EXPORT
198     void FillInternalShapes() ;
199
200   //!  Build solid theDraftSolid that consists of <br>
201   //!           non-internal split faces of the solid <br>
202   //!           theSolid. <br>
203   //!           All splits of internal faces of <br>
204   //!           theSolid are in the list: theInternalFaces <br>
205   Standard_EXPORT
206     void BuildDraftSolid(const TopoDS_Shape& theSolid,
207                          TopoDS_Shape& theDraftSolid,
208                          TopTools_ListOfShape& theInternalFaces) ;
209
210
211   NMTTools_PPaveFiller myPaveFiller;
212   TopTools_ListOfShape myShapes;
213   Standard_Integer myNbTypes;
214   TopTools_MapOfShape myMapFence;
215   TopTools_ListOfShape myShapes1[9];
216   BRepAlgo_Image myImages;
217   TopTools_IndexedDataMapOfShapeListOfShape myInParts;
218   BRepAlgo_Image mySplitFaces;
219   TopTools_IndexedDataMapOfShapeShape mySameDomainShapes;
220   TopTools_IndexedDataMapOfShapeShape myDraftSolids;
221   Standard_Integer myEntryPoint;
222
223 };
224 #endif