Salome HOME
Fix compilation error (conflict of OK name between OCCT Plate_Plate.hxx and GEOM...
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_AlgoTools.hxx
1 // Copyright (C) 2007-2024  CEA, EDF, 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 <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <Standard_Boolean.hxx>
32 #include <IntTools_Context.hxx>
33 #include <Standard_Integer.hxx>
34
35 #include <gp_Pnt.hxx>
36 #include <gp_Pnt2d.hxx>
37
38 #include <Geom_Surface.hxx>
39
40 #include <TopAbs_ShapeEnum.hxx>
41
42 #include <TopoDS_Face.hxx>
43 #include <TopoDS_Shape.hxx>
44 #include <TopoDS_Edge.hxx>
45 #include <TopoDS_Compound.hxx>
46
47 #include <TopTools_ListOfShape.hxx>
48 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
49 #include <TopTools_ListOfShape.hxx>
50 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
51
52 #include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
53 #include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
54 #include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
55
56 //!  Auxiliary tools for Algorithms <br>
57 //=======================================================================
58 //class    : GEOMAlgo_AlgoTools
59 //purpose  :
60 //=======================================================================
61 class GEOMAlgo_AlgoTools  {
62  public:
63
64   Standard_EXPORT
65     static void FaceNormal (const TopoDS_Face& aF,
66                             const Standard_Real U,
67                             const Standard_Real V,
68                             gp_Vec& aN);
69
70   //! Computes a point <theP> inside the face <theF>. <br>
71   //!          <theP2D> - 2D representation of <theP> <br>
72   //!          on the surface of <theF> <br>
73   //!          Returns 0 in case of success. <br>
74   Standard_EXPORT
75     static  Standard_Integer PntInFace(const TopoDS_Face& theF,
76                                        gp_Pnt& theP,
77                                        gp_Pnt2d& theP2D) ;
78
79   //! Computes a set of points inside the face <theF>. <br>
80   //!          Returns 0 in case of success. <br>
81   Standard_EXPORT
82     static  Standard_Integer PointCloudInFace(const TopoDS_Face& theF,
83                                               const int          theNbPnts,
84                                               TopoDS_Compound&   theCompound) ;
85
86   Standard_EXPORT
87     static  Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
88
89
90   Standard_EXPORT
91     static  Standard_Integer RefineSDShapes
92       (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
93        const Standard_Real aTol,
94        const Handle(IntTools_Context)& aCtx) ;
95
96   Standard_EXPORT
97     static  Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
98                                           const Standard_Real aTol,
99                                           TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
100                                           const Handle(IntTools_Context)& aCtx) ;
101   Standard_EXPORT
102     static  Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
103                                           const TopTools_ListOfShape& aLE,
104                                           const Standard_Real aTol,
105                                           TopTools_ListOfShape& aLESD,
106                                           const Handle(IntTools_Context)& aCtx) ;
107
108   Standard_EXPORT
109     static  void PointOnShape(const TopoDS_Shape& aS,
110                               gp_Pnt& aP3D) ;
111
112   Standard_EXPORT
113     static  void PointOnEdge(const TopoDS_Edge& aE,
114                              gp_Pnt& aP3D) ;
115
116   Standard_EXPORT
117     static  void PointOnEdge(const TopoDS_Edge& aE,
118                              const Standard_Real aT,gp_Pnt& aP3D) ;
119
120   Standard_EXPORT
121     static  void PointOnFace(const TopoDS_Face& aF,
122                              gp_Pnt& aP3D) ;
123
124   Standard_EXPORT
125     static  void PointOnFace(const TopoDS_Face& aF,
126                              const Standard_Real aU,
127                              const Standard_Real aV,
128                              gp_Pnt& aP3D) ;
129   Standard_EXPORT
130     static  Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
131                                                  const TopoDS_Shape& aS,
132                                                  gp_Pnt& aP2,
133                                                  const Handle(IntTools_Context)& aCtx) ;
134
135   Standard_EXPORT
136     static void CorrectTolerances(const TopoDS_Shape& aShape,
137                                   const Standard_Real aMaxTol=0.0001);
138
139   Standard_EXPORT
140     static void CorrectPointOnCurve(const TopoDS_Shape& S,
141                                     const Standard_Real aMaxTol=0.0001);
142
143   Standard_EXPORT
144     static void CorrectCurveOnSurface(const TopoDS_Shape& S,
145                                       const Standard_Real aMaxTol=0.0001);
146
147
148   Standard_EXPORT
149     static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1,
150                                                const TopoDS_Edge& aEF2,
151                                                const Handle(IntTools_Context)& aCtx) ;
152   Standard_EXPORT
153     static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
154                                           const TopoDS_Face& aF,
155                                           const Standard_Real aUMin,
156                                           const Standard_Real aUMax);
157
158   Standard_EXPORT
159     static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS);
160   
161   Standard_EXPORT
162     static void MakeContainer(const TopAbs_ShapeEnum theType,
163                               TopoDS_Shape& theC);
164
165   Standard_EXPORT
166     static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
167                                              const TopoDS_Edge& theEdge,
168                                              const Handle(IntTools_Context)& theCtx) ;
169   
170   Standard_EXPORT
171     static Standard_Boolean IsSplitToReverse  (const TopoDS_Face& theFSp,
172                                                const TopoDS_Face& theFSr,
173                                                const Handle(IntTools_Context)& theCtx) ;
174   
175   Standard_EXPORT
176     static Standard_Boolean IsSplitToReverse  (const TopoDS_Shape& theSp,
177                                                const TopoDS_Shape& theSr,
178                                                const Handle(IntTools_Context)& theCtx) ;
179   Standard_EXPORT
180     static Standard_Integer BuildPCurveForEdgeOnFace  (const TopoDS_Edge& aEold,
181                                                        const TopoDS_Edge& aEnew,
182                                                        const TopoDS_Face& aF,
183                                                        const Handle(IntTools_Context)& aCtx) ;
184
185 //
186   Standard_EXPORT
187     static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
188                            GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
189
190   Standard_EXPORT
191     static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
192                            GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
193
194   Standard_EXPORT
195     static  void CopyShape(const TopoDS_Shape& aS,
196                            TopoDS_Shape& aSC) ;
197   
198   Standard_EXPORT
199     static  void CopyShape(const TopoDS_Shape& aS,
200                            TopoDS_Shape& aSC,
201                            TopTools_IndexedDataMapOfShapeShape& aMSS) ;
202 };
203 #endif