1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_ShapeExplorer.h
4 // Created: 5 June 2015
5 // Author: Dmitry Bobylev
7 #ifndef GeomAPI_ShapeExplorer_H_
8 #define GeomAPI_ShapeExplorer_H_
11 #include <GeomAPI_Shape.h>
13 /** \class GeomAPI_ShapeExplorer
15 * \brief This class is used to explore subshapes on shape.
17 class GeomAPI_ShapeExplorer : public GeomAPI_Interface
20 /// Default constructor. Creates an empty explorer, becomes usefull after Init.
22 GeomAPI_ShapeExplorer();
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] theShape shape to explore.
28 * \param[in] toFind shape type to find.
29 * \param[in] toAvoid shape type to avoid.
32 GeomAPI_ShapeExplorer(const std::shared_ptr<GeomAPI_Shape>& theShape,
33 const GeomAPI_Shape::ShapeType toFind,
34 const GeomAPI_Shape::ShapeType toAvoid = GeomAPI_Shape::SHAPE);
36 /** \brief Resets this explorer. It is initialized to search on theShape, for shapes of type toFind,
37 * that are not part of a shape toAvoid. If the shape toAvoid is equal to GeomAPI_SHape::SHAPE,
38 * or if it is the same as, or less complex than the shape toFind it has no effect on the search.
39 * \param[in] theShape shape to explore.
40 * \param[in] toFind shape type to find.
41 * \param[in] toAvoid shape type to avoid.
44 void init(const std::shared_ptr<GeomAPI_Shape>& theShape,
45 const GeomAPI_Shape::ShapeType toFind,
46 const GeomAPI_Shape::ShapeType toAvoid = GeomAPI_Shape::SHAPE);
48 /// \return true if there are more shapes in the exploration.
52 /// Moves to the next Shape in the exploration or do nothing if there are no more shapes to explore.
56 /// \return the current shape in the exploration or empty pointer if this explorer has no more shapes to explore.
58 std::shared_ptr<GeomAPI_Shape> current();
60 /// Reinitialize the exploration with the original arguments.
64 /// \return the current depth of the exploration. 0 is the shape to explore itself.
68 /// Clears the content of the explorer. It will return False on more().