]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/GeomAPI_ShapeExplorer.h
Salome HOME
f83d4c6f5bb74cef8d6f3026fe36502c6597880c
[modules/shaper.git] / src / GeomAPI / GeomAPI_ShapeExplorer.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_ShapeExplorer.h
4 // Created:     5 June 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef GeomAPI_ShapeExplorer_H_
8 #define GeomAPI_ShapeExplorer_H_
9
10 #include <GeomAPI.h>
11 #include <GeomAPI_Shape.h>
12
13 /** \class GeomAPI_ShapeExplorer
14  *  \ingroup DataModel
15  *  \brief This class is used to explore subshapes on shape.
16  */
17
18 class GEOMAPI_EXPORT GeomAPI_ShapeExplorer : public GeomAPI_Interface
19 {
20 public:
21   /// Default constructor. Creates an empty explorer, becomes usefull after Init.
22   GeomAPI_ShapeExplorer();
23
24   /** \brief Constructs an explorer to search on theShape, for shapes of type toFind,
25    *  that are not part of a shape toAvoid. If the shape toAvoid is equal to GeomAPI_SHape::SHAPE,
26    *  or if it is the same as, or less complex than the shape toFind it has no effect on the search.
27       \param[in] toFind shape type to find.
28       \param[in] toAvoid shape type to avoid.
29    */
30   GeomAPI_ShapeExplorer(const std::shared_ptr<GeomAPI_Shape>& theShape,
31                         const GeomAPI_Shape::ShapeType toFind,
32                         const GeomAPI_Shape::ShapeType toAvoid = GeomAPI_Shape::SHAPE);
33
34   /** \brief Resets this explorer. It is initialized to search on theShape, for shapes of type toFind,
35    *  that are not part of a shape toAvoid. If the shape toAvoid is equal to GeomAPI_SHape::SHAPE,
36    *  or if it is the same as, or less complex than the shape toFind it has no effect on the search.
37       \param[in] toFind shape type to find.
38       \param[in] toAvoid shape type to avoid.
39    */
40   void init(const std::shared_ptr<GeomAPI_Shape>& theShape,
41             const GeomAPI_Shape::ShapeType toFind,
42             const GeomAPI_Shape::ShapeType toAvoid = GeomAPI_Shape::SHAPE);
43
44   /// \return true if there are more shapes in the exploration.
45   bool more() const;
46
47   /// Moves to the next Shape in the exploration or do nothing if there are no more shapes to explore.
48   void next();
49
50   /// Returns the current shape in the exploration or empty pointer if this explorer has no more shapes to explore.
51   std::shared_ptr<GeomAPI_Shape> current();
52
53   /// Reinitialize the exploration with the original arguments.
54   void reinit();
55
56   /// Returns the current depth of the exploration. 0 is the shape to explore itself.
57   int depth() const;
58
59   /// Clears the content of the explorer. It will return False on more().
60   void clear();
61
62 };
63
64 #endif