00001 /* 00002 * PolygonIterator.hpp 00003 * 00004 * Created on: Sep 19, 2014 00005 * Author: Péter Fankhauser 00006 * Institute: ETH Zurich, Autonomous Systems Lab 00007 */ 00008 00009 #pragma once 00010 00011 #include "grid_map_core/GridMap.hpp" 00012 #include "grid_map_core/Polygon.hpp" 00013 #include "grid_map_core/iterators/SubmapIterator.hpp" 00014 00015 #include <memory> 00016 00017 namespace grid_map { 00018 00022 class PolygonIterator 00023 { 00024 public: 00025 00031 PolygonIterator(const grid_map::GridMap& gridMap, const grid_map::Polygon& polygon); 00032 00038 PolygonIterator& operator =(const PolygonIterator& other); 00039 00044 bool operator !=(const PolygonIterator& other) const; 00045 00050 const Index& operator *() const; 00051 00056 PolygonIterator& operator ++(); 00057 00062 bool isPastEnd() const; 00063 00064 private: 00065 00070 bool isInside() const; 00071 00078 void findSubmapParameters(const grid_map::Polygon& polygon, Index& startIndex,Size& bufferSize) const; 00079 00081 grid_map::Polygon polygon_; 00082 00084 std::shared_ptr<SubmapIterator> internalIterator_; 00085 00087 Length mapLength_; 00088 Position mapPosition_; 00089 double resolution_; 00090 Size bufferSize_; 00091 Index bufferStartIndex_; 00092 00093 public: 00094 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00095 }; 00096 00097 } /* namespace */