1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: GEOMAlgo_Builder.cxx
24 // Author: Peter KURNEV
26 #ifndef _GEOMAlgo_Builder_HeaderFile
27 #define _GEOMAlgo_Builder_HeaderFile
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>
45 //=======================================================================
46 //function : GEOMAlgo_Builder
48 //=======================================================================
49 class GEOMAlgo_Builder : public GEOMAlgo_BuilderShape
52 //! Empty constructor <br>
57 virtual ~GEOMAlgo_Builder();
59 //! Performs calculations <br>
61 virtual void Perform() ;
63 //! Performs calculations using prepared PaveFiller <br>
64 //! object theDSF <br>
66 virtual void PerformWithFiller(const NMTTools_PaveFiller& theDSF) ;
68 //! Adds argument theShape of the operation <br>
70 virtual void AddShape(const TopoDS_Shape& theShape) ;
72 //! Clears internal fields and arguments <br>
74 virtual void Clear() ;
76 //! Returns the arguments of the operation <br>
78 const TopTools_ListOfShape& Shapes() const;
80 //! Returns the list of shapes generated from the <br>
83 virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;
85 //! Returns the list of shapes modified from the shape <br>
88 virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;
90 //! Returns true if the shape theS has been deleted. <br>
92 virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
94 //! Adds arguments of the operation as <br>
95 //! shapes of upper level of container shape theShape <br>
97 void AddCompound(const TopoDS_Shape& theShape) ;
99 //! Returns list of arguments of type theType <br>
101 const TopTools_ListOfShape& Shapes1(const Standard_Integer theType) const;
103 //! Returns image shapes <br>
105 const BRepAlgo_Image& Images() const;
107 //! Returns split-parts of shapes that have <br>
108 //! state IN for the domain of shape theShape <br>
110 const TopTools_ListOfShape& InParts(const TopoDS_Shape& theShape) const;
113 //! Performs calculations using prepared DSFiller <br>
114 //! object theDSF <br>
116 virtual void PerformInternal(const NMTTools_PaveFiller& theDSF) ;
118 //! Prepare information for history support <br>
120 virtual void PrepareHistory() ;
122 //! Clears internal fields <br>
124 virtual void ClearInternals() ;
126 //! Provides preparing actions <br>
128 virtual void Prepare() ;
130 //! Provides post-tratment actions <br>
132 virtual void PostTreat() ;
134 //! Append the argument theShape to <br>
135 //! typified lists of arguments myShapes1 <br>
137 void AddShape1(const TopoDS_Shape& theShape) ;
139 //! Build the resulting shapes of type theType <br>
141 virtual void BuildResult(const TopAbs_ShapeEnum theType) ;
143 //! Fill Images for vertices <br>
145 void FillImagesVertices() ;
147 //! Fill Images for edges <br>
149 void FillImagesEdges() ;
151 //! Fill Images for faces <br>
153 void FillImagesFaces() ;
155 //! For each interferred face find split edges <br>
156 //! that are in 2-D domain of the face <br>
158 void FillIn2DParts() ;
160 //! Build draft faces <br>
162 void BuildSplitFaces() ;
164 //! Among draft faces find same domain faces <br>
166 void FillSameDomainFaces() ;
168 //! Fill Images for faces <br>
169 //! taking into account same domain faces <br>
171 void FillImagesFaces1() ;
173 //! Update Images for faces by <br>
174 //! internal vertices <br>
176 void FillInternalVertices() ;
178 //! Fill Images for Wires, Shells, Compsolids, Compounds <br>
180 void FillImagesContainers(const TopAbs_ShapeEnum theType) ;
182 //! Fill Images for solids <br>
184 void FillImagesSolids() ;
186 //! For each interferred solid find split faces <br>
187 //! that are in 3-D domain of the solid <br>
189 void FillIn3DParts() ;
191 //! Build draft solids <br>
193 void BuildSplitSolids() ;
195 //! Update draft solids by <br>
196 //! internal shells, edges, vertices <br>
198 void FillInternalShapes() ;
200 //! Build solid theDraftSolid that consists of <br>
201 //! non-internal split faces of the solid <br>
203 //! All splits of internal faces of <br>
204 //! theSolid are in the list: theInternalFaces <br>
206 void BuildDraftSolid(const TopoDS_Shape& theSolid,
207 TopoDS_Shape& theDraftSolid,
208 TopTools_ListOfShape& theInternalFaces) ;
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;