1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_ShapeExplorer.cpp
4 // Created: 5 June 2015
5 // Author: Dmitry Bobylev
7 #include <GeomAPI_ShapeExplorer.h>
9 #include <Standard_NoMoreObject.hxx>
10 #include <TopExp_Explorer.hxx>
12 #define MY_EXPLORER implPtr<TopExp_Explorer>()
14 //=================================================================================================
15 GeomAPI_ShapeExplorer::GeomAPI_ShapeExplorer()
16 : GeomAPI_Interface(new TopExp_Explorer())
20 //=================================================================================================
21 GeomAPI_ShapeExplorer::GeomAPI_ShapeExplorer(const std::shared_ptr<GeomAPI_Shape>& theShape,
22 const GeomAPI_Shape::ShapeType toFind,
23 const GeomAPI_Shape::ShapeType toAvoid)
24 : GeomAPI_Interface(new TopExp_Explorer(theShape->impl<TopoDS_Shape>(),
25 (TopAbs_ShapeEnum)toFind,
26 (TopAbs_ShapeEnum)toAvoid))
30 //=================================================================================================
31 void GeomAPI_ShapeExplorer::init(const std::shared_ptr<GeomAPI_Shape>& theShape,
32 const GeomAPI_Shape::ShapeType toFind,
33 const GeomAPI_Shape::ShapeType toAvoid)
35 MY_EXPLORER->Init(theShape->impl<TopoDS_Shape>(),
36 (TopAbs_ShapeEnum)toFind,
37 (TopAbs_ShapeEnum)toAvoid);
40 //=================================================================================================
41 bool GeomAPI_ShapeExplorer::more() const
43 return MY_EXPLORER->More() == Standard_True;
46 //=================================================================================================
47 void GeomAPI_ShapeExplorer::next()
51 } catch (Standard_NoMoreObject) {
55 //=================================================================================================
56 std::shared_ptr<GeomAPI_Shape> GeomAPI_ShapeExplorer::current()
59 const TopoDS_Shape& aShape = MY_EXPLORER->Current();
60 std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape());
61 aGeomShape->setImpl(new TopoDS_Shape(aShape));
63 } catch (Standard_NoMoreObject) {
64 return std::shared_ptr<GeomAPI_Shape>();
68 //=================================================================================================
69 void GeomAPI_ShapeExplorer::reinit()
71 MY_EXPLORER->ReInit();
74 //=================================================================================================
75 int GeomAPI_ShapeExplorer::depth() const
77 return MY_EXPLORER->Depth();
80 //=================================================================================================
81 void GeomAPI_ShapeExplorer::clear()