Salome HOME
7f8903748d7c381b634abed08042c4df98d0d729
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_GetInPlaceAPI.hxx
1 // Copyright (C) 2007-2015  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_GetInPlaceAPI.hxx
23 // Created:
24 // Author:      Sergey KHROMOV
25
26 #ifndef _GEOMAlgo_GetInPlaceAPI_HeaderFile
27 #define _GEOMAlgo_GetInPlaceAPI_HeaderFile
28
29
30 #include <gp_Vec.hxx>
31
32 class GEOMAlgo_GetInPlace;
33 class Handle_GEOM_Function;
34 class BRepExtrema_DistShapeShape;
35 class TopoDS_Face;
36 class TopoDS_Shape;
37 class TopTools_IndexedMapOfShape;
38 class TopTools_ListOfShape;
39
40
41 /**
42  * This is an API class for all GetInPlace algorithm.
43  * It facilitates using different GetInPlace algorithms:
44  * a new one(GEOMAlgo_GetInPlace), an old one and
45  * GetInPlaceByHistory.
46  */
47 class GEOMAlgo_GetInPlaceAPI
48 {
49
50 public:
51
52   /**
53    *  \brief New GetInPlace method implementation.
54    *  Initializes the GEOMAlgo_GetInPlace object with correct parameters and
55    *  performs computation (calls theGIP's method Perform. Returns
56    *  Standard_True in face of success; Standard_False otherwise.
57    */
58   Standard_EXPORT static Standard_Boolean GetInPlace
59                       (const TopoDS_Shape        &theWhere,
60                        const TopoDS_Shape        &theWhat,
61                              GEOMAlgo_GetInPlace &theGIP);
62
63   /*!
64    *  \brief Old implementation of GetInPlace algoritm.
65    *  This method searches among sub shapes of the shape theWhere parts that are
66    *  coincident with the shape theWhat. The result list of shape is returned as
67    *  an output parameter. It returns the error code with the following possible
68    *  values:
69    *    0 - Success;
70    *    1 - theWhere and/or theWhat TopoDS_Shape are Null;
71    *    2 - An attempt to extract a shape of not supported type;
72    *    3 - Not found any Results.
73    */
74   Standard_EXPORT static Standard_Integer GetInPlaceOld
75             (const TopoDS_Shape         &theWhere,
76              const TopoDS_Shape         &theWhat,
77                    TopTools_ListOfShape &theShapesInPlace);
78
79
80   /**
81    *  \brief GetInPlaceByHistory method implementation.
82    *  Returns Standard_True if something is found. Warning: theShapesInPlace
83    *  list is not cleared at first.
84    */
85   Standard_EXPORT static Standard_Boolean GetInPlaceByHistory
86                       (const Handle_GEOM_Function       &theWhereFunction,
87                        const TopTools_IndexedMapOfShape &theWhereIndices,
88                        const TopoDS_Shape               &theWhat,
89                              TopTools_ListOfShape       &theShapesInPlace);
90
91 protected:
92
93   /*!
94    * \brief Return normal to face at extrema point
95    */
96   static gp_Vec GetNormal(const TopoDS_Face                &theFace,
97                           const BRepExtrema_DistShapeShape &theExtrema);
98
99   /*!
100    * Return the global properties of the shape: center of mass and
101    * a size (length, area or volume depending on the shape type).
102    */
103   static void GetShapeProperties(const TopoDS_Shape  &theShape,
104                                        Standard_Real  theTab[],
105                                        gp_Pnt        &theVertex);
106
107 };
108
109
110
111 #endif