Salome HOME
Update copyright: 2016
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_AlgoTools.hxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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_AlgoTools.hxx
23 //  Created :
24 //  Author  : Peter KURNEV
25
26 #ifndef _GEOMAlgo_AlgoTools_HeaderFile
27 #define _GEOMAlgo_AlgoTools_HeaderFile
28
29 #include <Basics_OCCTVersion.hxx>
30
31 #include <Standard.hxx>
32 #include <Standard_Macro.hxx>
33 #include <Standard_Boolean.hxx>
34 #if OCC_VERSION_LARGE > 0x06070100
35 #include <Handle_IntTools_Context.hxx>
36 #include <IntTools_Context.hxx>
37 #else
38 #include <Handle_BOPInt_Context.hxx>
39 #include <BOPInt_Context.hxx>
40 #endif
41 #include <Standard_Integer.hxx>
42
43 #include <gp_Pnt.hxx>
44 #include <gp_Pnt2d.hxx>
45
46 #include <Geom_Surface.hxx>
47
48 #include <TopAbs_ShapeEnum.hxx>
49
50 #include <TopoDS_Face.hxx>
51 #include <TopoDS_Shape.hxx>
52 #include <TopoDS_Edge.hxx>
53
54 #include <TopTools_ListOfShape.hxx>
55 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
56 #include <TopTools_ListOfShape.hxx>
57 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
58
59 #include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
60 #include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
61 #include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
62
63 //!  Auxiliary tools for Algorithms <br>
64 //=======================================================================
65 //class    : GEOMAlgo_AlgoTools
66 //purpose  :
67 //=======================================================================
68 class GEOMAlgo_AlgoTools  {
69  public:
70
71   Standard_EXPORT
72     static void FaceNormal (const TopoDS_Face& aF,
73                             const Standard_Real U,
74                             const Standard_Real V,
75                             gp_Vec& aN);
76
77   //! Computes a point <theP> inside the face <theF>. <br>
78   //!          <theP2D> -  2D  representation of <theP> <br>
79   //!          on the surface of <theF> <br>
80   //!          Returns 0 in case of success. <br>
81   Standard_EXPORT
82     static  Standard_Integer PntInFace(const TopoDS_Face& theF,
83                                        gp_Pnt& theP,
84                                        gp_Pnt2d& theP2D) ;
85
86   Standard_EXPORT
87     static  Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
88
89
90   Standard_EXPORT
91     static  Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
92
93   Standard_EXPORT
94     static  Standard_Integer RefineSDShapes
95       (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
96        const Standard_Real aTol,
97 #if OCC_VERSION_LARGE > 0x06070100
98        const Handle(IntTools_Context)& aCtx
99 #else
100        const Handle(BOPInt_Context)& aCtx
101 #endif
102        ) ;
103
104   Standard_EXPORT
105     static  Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
106                                           const Standard_Real aTol,
107                                           TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
108 #if OCC_VERSION_LARGE > 0x06070100
109                                           const Handle(IntTools_Context)& aCtx
110 #else
111                                           const Handle(BOPInt_Context)& aCtx
112 #endif
113                                           ) ;
114   Standard_EXPORT
115     static  Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
116                                           const TopTools_ListOfShape& aLE,
117                                           const Standard_Real aTol,
118                                           TopTools_ListOfShape& aLESD,
119 #if OCC_VERSION_LARGE > 0x06070100
120                                           const Handle(IntTools_Context)& aCtx
121 #else
122                                           const Handle(BOPInt_Context)& aCtx
123 #endif
124                                           ) ;
125
126   Standard_EXPORT
127     static  void PointOnShape(const TopoDS_Shape& aS,
128                               gp_Pnt& aP3D) ;
129
130   Standard_EXPORT
131     static  void PointOnEdge(const TopoDS_Edge& aE,
132                              gp_Pnt& aP3D) ;
133
134   Standard_EXPORT
135     static  void PointOnEdge(const TopoDS_Edge& aE,
136                              const Standard_Real aT,gp_Pnt& aP3D) ;
137
138   Standard_EXPORT
139     static  void PointOnFace(const TopoDS_Face& aF,
140                              gp_Pnt& aP3D) ;
141
142   Standard_EXPORT
143     static  void PointOnFace(const TopoDS_Face& aF,
144                              const Standard_Real aU,
145                              const Standard_Real aV,
146                              gp_Pnt& aP3D) ;
147   Standard_EXPORT
148     static  Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
149                                                  const TopoDS_Shape& aS,
150                                                  gp_Pnt& aP2,
151 #if OCC_VERSION_LARGE > 0x06070100
152                                                  const Handle(IntTools_Context)& aCtx
153 #else
154                                                  const Handle(BOPInt_Context)& aCtx
155 #endif
156                                                  ) ;
157
158   Standard_EXPORT
159     static void CorrectTolerances(const TopoDS_Shape& aShape,
160                                   const Standard_Real aMaxTol=0.0001);
161
162   Standard_EXPORT
163     static void CorrectPointOnCurve(const TopoDS_Shape& S,
164                                     const Standard_Real aMaxTol=0.0001);
165
166   Standard_EXPORT
167     static void CorrectCurveOnSurface(const TopoDS_Shape& S,
168                                       const Standard_Real aMaxTol=0.0001);
169
170
171   Standard_EXPORT
172     static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1,
173                                                const TopoDS_Edge& aEF2,
174 #if OCC_VERSION_LARGE > 0x06070100
175                                                const Handle(IntTools_Context)& aCtx
176 #else
177                                                const Handle(BOPInt_Context)& aCtx
178 #endif
179                                                ) ;
180   Standard_EXPORT
181     static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
182                                           const TopoDS_Face& aF,
183                                           const Standard_Real aUMin,
184                                           const Standard_Real aUMax);
185
186   Standard_EXPORT
187     static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS);
188   
189   Standard_EXPORT
190     static void MakeContainer(const TopAbs_ShapeEnum theType,
191                               TopoDS_Shape& theC);
192
193   Standard_EXPORT
194     static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
195                                              const TopoDS_Edge& theEdge,
196 #if OCC_VERSION_LARGE > 0x06070100
197                                              const Handle(IntTools_Context)& theCtx
198 #else
199                                              const Handle(BOPInt_Context)& theCtx
200 #endif
201                                              ) ;
202   
203   Standard_EXPORT
204     static Standard_Boolean IsSplitToReverse  (const TopoDS_Face& theFSp,
205                                                const TopoDS_Face& theFSr,
206 #if OCC_VERSION_LARGE > 0x06070100
207                                                const Handle(IntTools_Context)& theCtx
208 #else
209                                                const Handle(BOPInt_Context)& theCtx
210 #endif
211                                                ) ;
212   
213   Standard_EXPORT
214     static Standard_Boolean IsSplitToReverse  (const TopoDS_Shape& theSp,
215                                                const TopoDS_Shape& theSr,
216 #if OCC_VERSION_LARGE > 0x06070100
217                                                const Handle(IntTools_Context)& theCtx
218 #else
219                                                const Handle(BOPInt_Context)& theCtx
220 #endif
221                                                ) ;
222   Standard_EXPORT
223     static Standard_Integer BuildPCurveForEdgeOnFace  (const TopoDS_Edge& aEold,
224                                                        const TopoDS_Edge& aEnew,
225                                                        const TopoDS_Face& aF,
226 #if OCC_VERSION_LARGE > 0x06070100
227                                                        const Handle(IntTools_Context)& aCtx
228 #else
229                                                        const Handle(BOPInt_Context)& aCtx
230 #endif
231                                                        ) ;
232
233 //
234   Standard_EXPORT
235     static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
236                            GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
237
238   Standard_EXPORT
239     static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
240                            GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
241
242   Standard_EXPORT
243     static  void CopyShape(const TopoDS_Shape& aS,
244                            TopoDS_Shape& aSC) ;
245   
246   Standard_EXPORT
247     static  void CopyShape(const TopoDS_Shape& aS,
248                            TopoDS_Shape& aSC,
249                            TopTools_IndexedDataMapOfShapeShape& aMSS) ;
250 };
251 #endif