Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / ModelGeomAlgo / ModelGeomAlgo_Shape.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef ModelGeomAlgo_Shape_H
22 #define ModelGeomAlgo_Shape_H
23
24 #include "ModelGeomAlgo.h"
25 #include "GeomAPI_Shape.h"
26
27 #include <set>
28
29 class ModelAPI_Feature;
30 class ModelAPI_Result;
31
32 namespace ModelGeomAlgo_Shape {
33
34   /// Searches Shape results of the feature satisfied the given shape type
35   /// \param theFeature a feature to obtain AttributeRefAttr
36   /// \param theType shape type
37   /// \param theShapeResults a list of results
38   MODELGEOMALGO_EXPORT void shapesOfType(
39                               const std::shared_ptr<ModelAPI_Feature>& theFeature,
40                               const GeomAPI_Shape::ShapeType& theType,
41                               std::set<std::shared_ptr<ModelAPI_Result> >& theShapeResults);
42
43   struct SubshapeOfResult
44   {
45     std::shared_ptr<ModelAPI_Result> myResult;
46     std::shared_ptr<GeomAPI_Shape> mySubshape;
47     int myCenterType;
48   };
49
50   /// Searches a sub-shape in the results of the given features,
51   /// which contains the given point.
52   /// \param[in]  theFeature    feature, which results are being processed
53   /// \param[in]  thePoint      selected point which identifies the shape
54   /// \param[in]  theShapeType  type of the selected shape
55   /// \param[out] theSelected   applicable result, sub-shape of the found result and
56   ///                           type of the point if it is a center of circle or a focus of ellipse
57   /// \return \c true if the result and its applicable sub-shape are found
58   MODELGEOMALGO_EXPORT bool findSubshapeByPoint(
59                               const std::shared_ptr<ModelAPI_Feature>& theFeature,
60                               const std::shared_ptr<GeomAPI_Pnt>& thePoint,
61                               const GeomAPI_Shape::ShapeType& theShapeType,
62                               std::list<SubshapeOfResult>& theSelected);
63 }
64
65 #endif