Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/geom.git] / src / PARTITION / Partition_Spliter.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  GEOM PARTITION : partition algorithm
21 //
22 //  File   : Partition_Spliter.hxx
23 //  Module : GEOM
24
25 #ifndef _Partition_Spliter_HeaderFile
26 #define _Partition_Spliter_HeaderFile
27
28 #ifndef _TopAbs_ShapeEnum_HeaderFile
29 #include <TopAbs_ShapeEnum.hxx>
30 #endif
31 #ifndef _TopoDS_Compound_HeaderFile
32 #include <TopoDS_Compound.hxx>
33 #endif
34 #ifndef _BRep_Builder_HeaderFile
35 #include <BRep_Builder.hxx>
36 #endif
37 #ifndef _TopTools_ListOfShape_HeaderFile
38 #include <TopTools_ListOfShape.hxx>
39 #endif
40 #ifndef _TopTools_MapOfShape_HeaderFile
41 #include <TopTools_MapOfShape.hxx>
42 #endif
43 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
44 #include <TopTools_DataMapOfShapeShape.hxx>
45 #endif
46 #ifndef _Handle_BRepAlgo_AsDes_HeaderFile
47 #include <Handle_BRepAlgo_AsDes.hxx>
48 #endif
49 #ifndef _BRepAlgo_Image_HeaderFile
50 #include <BRepAlgo_Image.hxx>
51 #endif
52 #ifndef _Partition_Inter3d_HeaderFile
53 #include "Partition_Inter3d.hxx"
54 #endif
55 #ifndef _TopTools_MapOfOrientedShape_HeaderFile
56 #include <TopTools_MapOfOrientedShape.hxx>
57 #endif
58 #ifndef _Standard_Boolean_HeaderFile
59 #include <Standard_Boolean.hxx>
60 #endif
61 class BRepAlgo_AsDes;
62 class TopoDS_Shape;
63 class TopTools_ListOfShape;
64 class TopoDS_Edge;
65
66
67 #ifndef _Standard_HeaderFile
68 #include <Standard.hxx>
69 #endif
70 #ifndef _Standard_Macro_HeaderFile
71 #include <Standard_Macro.hxx>
72 #endif
73
74 class Partition_Spliter  {
75
76 public:
77
78     void* operator new(size_t,void* anAddress) 
79       {
80         return anAddress;
81       }
82     void* operator new(size_t size) 
83       { 
84         return Standard::Allocate(size); 
85       }
86     void  operator delete(void *anAddress) 
87       { 
88         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
89       }
90  // Methods PUBLIC
91  // 
92 Standard_EXPORT Partition_Spliter();
93 Standard_EXPORT   void AddShape(const TopoDS_Shape& S) ;
94 Standard_EXPORT   void AddTool(const TopoDS_Shape& S) ;
95 Standard_EXPORT   void Compute(const TopAbs_ShapeEnum Limit = TopAbs_SHAPE) ;
96 Standard_EXPORT   void KeepShapesInside(const TopoDS_Shape& S) ;
97 Standard_EXPORT   void RemoveShapesInside(const TopoDS_Shape& S) ;
98 Standard_EXPORT   TopoDS_Shape Shape() const;
99 Standard_EXPORT   void Clear() ;
100
101
102
103
104
105 protected:
106
107  // Methods PROTECTED
108  // 
109
110
111  // Fields PROTECTED
112  //
113
114
115 private: 
116
117  // Methods PRIVATE
118  // 
119 Standard_EXPORT   void MakeSolids(const TopoDS_Shape& Solid,TopTools_ListOfShape& Shells) ;
120 Standard_EXPORT   void MakeShells(const TopoDS_Shape& S,TopTools_ListOfShape& NS) ;
121 Standard_EXPORT   TopoDS_Shape MakeFaces(const TopoDS_Shape& S) ;
122 Standard_EXPORT   void MakeEdges(const TopoDS_Edge& E,const TopTools_ListOfShape& VOnE,TopTools_ListOfShape& NE) const;
123 Standard_EXPORT   TopoDS_Shape FindFacesInside(const TopoDS_Shape& S,const Standard_Boolean CheckClosed = Standard_False,const Standard_Boolean All = Standard_False) ;
124 Standard_EXPORT   Standard_Boolean CheckTool(const TopoDS_Shape& S) ;
125 Standard_EXPORT   void MergeEqualEdges(const TopTools_ListOfShape& LE) ;
126 Standard_EXPORT static  Standard_Boolean IsInside(const TopoDS_Shape& S1,const TopoDS_Shape& S2) ;
127 Standard_EXPORT   TopoDS_Shape GetOriginalShape(const TopoDS_Shape& aShape) const;
128 Standard_EXPORT   void FindToolsToReconstruct() ;
129
130
131  // Fields PRIVATE
132  //
133 TopAbs_ShapeEnum myDoneStep;
134 TopoDS_Compound myShape;
135 BRep_Builder myBuilder;
136 TopTools_ListOfShape myListShapes;
137 TopTools_MapOfShape myMapFaces;
138 TopTools_MapOfShape myMapTools;
139 TopTools_MapOfShape myEqualEdges;
140 TopTools_MapOfShape myNewSection;
141 TopTools_MapOfShape myClosedShapes;
142 TopTools_MapOfShape mySharedFaces;
143 TopTools_MapOfShape myWrappingSolid;
144 TopTools_DataMapOfShapeShape myFaceShapeMap;
145 TopTools_DataMapOfShapeShape myInternalFaces;
146 TopTools_DataMapOfShapeShape myIntNotClFaces;
147 Handle_BRepAlgo_AsDes myAsDes;
148 BRepAlgo_Image myImagesFaces;
149 BRepAlgo_Image myImagesEdges;
150 BRepAlgo_Image myImageShape;
151 Partition_Inter3d myInter3d;
152 TopTools_MapOfOrientedShape myAddedFacesMap;
153
154
155 };
156
157
158
159
160
161 // other Inline functions and methods (like "C++: function call" methods)
162 //
163
164
165 #endif