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