1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_ShapeIterator.cpp
4 // Created: 27 April 2016
5 // Author: Dmitry Bobylev
7 #include "GeomAPI_ShapeIterator.h"
9 #include <Standard_NoMoreObject.hxx>
10 #include <TopoDS_Iterator.hxx>
12 #define MY_ITERATOR implPtr<TopoDS_Iterator>()
14 //==================================================================================================
15 GeomAPI_ShapeIterator::GeomAPI_ShapeIterator()
16 : GeomAPI_Interface(new TopoDS_Iterator())
20 //==================================================================================================
21 GeomAPI_ShapeIterator::GeomAPI_ShapeIterator(const std::shared_ptr<GeomAPI_Shape> theShape)
22 : GeomAPI_Interface(new TopoDS_Iterator())
27 //==================================================================================================
28 void GeomAPI_ShapeIterator::init(const std::shared_ptr<GeomAPI_Shape> theShape)
33 MY_ITERATOR->Initialize(theShape->impl<TopoDS_Shape>());
36 //==================================================================================================
37 bool GeomAPI_ShapeIterator::more() const
39 return MY_ITERATOR->More() == Standard_True;
42 //==================================================================================================
43 void GeomAPI_ShapeIterator::next()
47 } catch (Standard_NoMoreObject) {
51 //==================================================================================================
52 std::shared_ptr<GeomAPI_Shape> GeomAPI_ShapeIterator::current()
55 const TopoDS_Shape& aShape = MY_ITERATOR->Value();
56 std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape());
57 aGeomShape->setImpl(new TopoDS_Shape(aShape));
59 } catch (Standard_NoMoreObject) {
60 return std::shared_ptr<GeomAPI_Shape>();