00001 00005 #pragma once 00006 00007 #include "../common.hpp" 00008 00009 // unique_ptr 00010 #include <memory> 00011 #include "../iterators/submap_iterator.hpp" 00012 #include "../cost_map.hpp" 00013 00014 namespace cost_map { 00015 00019 class PolygonIterator 00020 { 00021 public: 00022 00028 PolygonIterator(const cost_map::CostMap& gridMap, const cost_map::Polygon& polygon); 00029 00035 PolygonIterator& operator =(const PolygonIterator& other); 00036 00041 bool operator !=(const PolygonIterator& other) const; 00042 00047 const Index& operator *() const; 00048 00053 PolygonIterator& operator ++(); 00054 00059 bool isPastEnd() const; 00060 00061 private: 00062 00067 bool isInside() const; 00068 00075 void findSubmapParameters(const cost_map::Polygon& polygon, Index& startIndex, Size& bufferSize) const; 00076 00078 cost_map::Polygon polygon_; 00079 00081 std::shared_ptr<SubmapIterator> internalIterator_; 00082 00084 Length mapLength_; 00085 Position mapPosition_; 00086 double resolution_; 00087 Size bufferSize_; 00088 Index bufferStartIndex_; 00089 }; 00090 00091 } /* namespace */