Salome HOME
Internal issue 0022865: Restructurization of Partition packages.
[modules/geom.git] / src / GEOMAlgo_NEW / GEOMAlgo_Builder.hxx
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE\r
2 //\r
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS\r
5 //\r
6 // This library is free software; you can redistribute it and/or\r
7 // modify it under the terms of the GNU Lesser General Public\r
8 // License as published by the Free Software Foundation; either\r
9 // version 2.1 of the License.\r
10 //\r
11 // This library is distributed in the hope that it will be useful,\r
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
14 // Lesser General Public License for more details.\r
15 //\r
16 // You should have received a copy of the GNU Lesser General Public\r
17 // License along with this library; if not, write to the Free Software\r
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
19 //\r
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
21 //\r
22 // File:        GEOMAlgo_Builder.cxx\r
23 // Created:     \r
24 // Author:      Peter KURNEV \r
25 //\r
26 #ifndef _GEOMAlgo_Builder_HeaderFile\r
27 #define _GEOMAlgo_Builder_HeaderFile\r
28 \r
29 #include <Standard.hxx>\r
30 #include <Standard_Macro.hxx>\r
31 #include <NMTTools_PPaveFiller.hxx>\r
32 #include <TopTools_ListOfShape.hxx>\r
33 #include <Standard_Integer.hxx>\r
34 #include <TopTools_MapOfShape.hxx>\r
35 #include <BRepAlgo_Image.hxx>\r
36 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>\r
37 #include <TopTools_IndexedDataMapOfShapeShape.hxx>\r
38 #include <GEOMAlgo_BuilderShape.hxx>\r
39 #include <NMTTools_PaveFiller.hxx>\r
40 #include <Standard_Boolean.hxx>\r
41 #include <TopAbs_ShapeEnum.hxx>\r
42 #include <TopoDS_Shape.hxx>\r
43 #include <BRepAlgo_Image.hxx>\r
44 \r
45 //=======================================================================\r
46 //function : GEOMAlgo_Builder\r
47 //purpose  : \r
48 //=======================================================================\r
49 class GEOMAlgo_Builder  : public GEOMAlgo_BuilderShape \r
50 {\r
51  public:\r
52   //!  Empty constructor <br>\r
53   Standard_EXPORT\r
54     GEOMAlgo_Builder();\r
55   \r
56   Standard_EXPORT\r
57     virtual ~GEOMAlgo_Builder();\r
58   \r
59   //!  Performs calculations <br>\r
60   Standard_EXPORT\r
61     virtual  void Perform() ;\r
62   \r
63   //!  Performs calculations using prepared PaveFiller <br>\r
64   //!           object theDSF <br>\r
65   Standard_EXPORT\r
66     virtual  void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ;\r
67   \r
68   //!  Adds argument theShape of the operation <br>\r
69   Standard_EXPORT\r
70     virtual  void AddShape(const TopoDS_Shape& theShape) ;\r
71   \r
72   //!  Clears internal fields and arguments <br>\r
73   Standard_EXPORT\r
74     virtual  void Clear() ;\r
75   \r
76   //!  Returns the arguments of the operation <br>\r
77   Standard_EXPORT\r
78     const TopTools_ListOfShape& Shapes() const;\r
79   \r
80   //! Returns the  list of shapes generated from the <br>\r
81   //!          shape theS. <br>\r
82   Standard_EXPORT\r
83     virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;\r
84   \r
85   //! Returns the list of shapes modified from the shape <br>\r
86   //!          theS. <br>\r
87   Standard_EXPORT\r
88     virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;\r
89   \r
90   //! Returns true if the shape theS has been deleted. <br>\r
91   Standard_EXPORT   \r
92     virtual  Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;\r
93   \r
94   //!  Adds arguments of the operation as <br>\r
95   //!           shapes of upper level of container shape theShape <br>\r
96   Standard_EXPORT\r
97     void AddCompound(const TopoDS_Shape& theShape) ;\r
98   \r
99   //! Returns list of arguments of type theType <br>\r
100   Standard_EXPORT\r
101     const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const;\r
102   \r
103   //! Returns image shapes <br>\r
104   Standard_EXPORT\r
105     const BRepAlgo_Image& Images() const;\r
106   \r
107   //! Returns split-parts of shapes that have <br>\r
108   //!          state IN for the domain of shape theShape <br>\r
109   Standard_EXPORT\r
110     const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const;\r
111 \r
112 protected:\r
113   //!  Performs calculations using prepared DSFiller <br>\r
114   //!           object theDSF <br>\r
115   Standard_EXPORT\r
116     virtual  void PerformInternal(const NMTTools_PaveFiller& theDSF) ;\r
117   \r
118   //!  Prepare information for history support <br>\r
119   Standard_EXPORT   \r
120     virtual  void PrepareHistory() ;\r
121   \r
122   //!  Clears internal fields <br>\r
123   Standard_EXPORT\r
124     virtual  void ClearInternals() ;\r
125   \r
126   //!  Provides preparing actions <br>\r
127   Standard_EXPORT\r
128     virtual  void Prepare() ;\r
129   \r
130   //!  Provides post-tratment actions <br>\r
131   Standard_EXPORT\r
132     virtual  void PostTreat() ;\r
133   \r
134   //!  Append the argument theShape to <br>\r
135   //!           typified lists of arguments myShapes1 <br>\r
136   Standard_EXPORT\r
137     void AddShape1(const TopoDS_Shape& theShape) ;\r
138   \r
139   //! Build the resulting shapes of type theType <br>\r
140   Standard_EXPORT\r
141     virtual  void BuildResult(const TopAbs_ShapeEnum theType) ;\r
142   \r
143   //! Fill Images for vertices <br>\r
144   Standard_EXPORT\r
145     void FillImagesVertices() ;\r
146   \r
147   //! Fill Images for edges <br>\r
148   Standard_EXPORT\r
149     void FillImagesEdges() ;\r
150   \r
151   //! Fill Images for faces <br>\r
152   Standard_EXPORT\r
153     void FillImagesFaces() ;\r
154   \r
155   //! For each interferred face find split edges <br>\r
156   //!          that are in 2-D domain of the face <br>\r
157   Standard_EXPORT\r
158     void FillIn2DParts() ;\r
159   \r
160   //! Build draft faces <br>\r
161   Standard_EXPORT\r
162     void BuildSplitFaces() ;\r
163   \r
164   //! Among draft faces find same domain faces <br>\r
165   Standard_EXPORT\r
166     void FillSameDomainFaces() ;\r
167   \r
168   //! Fill Images for faces <br>\r
169   //!          taking into account same domain faces <br>\r
170   Standard_EXPORT\r
171     void FillImagesFaces1() ;\r
172   \r
173   //! Update Images for faces by <br>\r
174   //!          internal vertices <br>\r
175   Standard_EXPORT\r
176     void FillInternalVertices() ;\r
177   \r
178   //!  Fill Images for Wires, Shells, Compsolids, Compounds <br>\r
179   Standard_EXPORT\r
180     void FillImagesContainers(const TopAbs_ShapeEnum theType) ;\r
181   \r
182   //!  Fill Images for solids <br>\r
183   Standard_EXPORT\r
184     void FillImagesSolids() ;\r
185   \r
186   //! For each interferred solid find split faces <br>\r
187   //!          that are in 3-D domain of the solid <br>\r
188   Standard_EXPORT\r
189     void FillIn3DParts() ;\r
190   \r
191   //! Build draft solids <br>\r
192   Standard_EXPORT\r
193     void BuildSplitSolids() ;\r
194   \r
195   //!  Update draft solids by <br>\r
196   //!           internal shells, edges, vertices <br>\r
197   Standard_EXPORT\r
198     void FillInternalShapes() ;\r
199   \r
200   //!  Build solid theDraftSolid that consists of <br>\r
201   //!           non-internal split faces of the solid <br>\r
202   //!           theSolid. <br>\r
203   //!           All splits of internal faces of <br>\r
204   //!           theSolid are in the list: theInternalFaces <br>\r
205   Standard_EXPORT     \r
206     void BuildDraftSolid(const TopoDS_Shape& theSolid,\r
207                          TopoDS_Shape& theDraftSolid,\r
208                          TopTools_ListOfShape& theInternalFaces) ;\r
209 \r
210 \r
211   NMTTools_PPaveFiller myPaveFiller;\r
212   TopTools_ListOfShape myShapes;\r
213   Standard_Integer myNbTypes;\r
214   TopTools_MapOfShape myMapFence;\r
215   TopTools_ListOfShape myShapes1[9];\r
216   BRepAlgo_Image myImages;\r
217   TopTools_IndexedDataMapOfShapeListOfShape myInParts;\r
218   BRepAlgo_Image mySplitFaces;\r
219   TopTools_IndexedDataMapOfShapeShape mySameDomainShapes;\r
220   TopTools_IndexedDataMapOfShapeShape myDraftSolids;\r
221   Standard_Integer myEntryPoint;\r
222 \r
223 };\r
224 #endif\r