src/lib/iterators/submap_iterator.cpp
Go to the documentation of this file.
1 
4 /*****************************************************************************
5 ** Includes
6 *****************************************************************************/
7 
9 #include "../../../include/cost_map_core/iterators/submap_iterator.hpp"
10 
11 
12 using namespace std;
13 
14 namespace cost_map {
15 
16 SubmapIterator::SubmapIterator(const cost_map::SubmapGeometry& submap)
17  : SubmapIterator(submap.getGridMap(), submap.getStartIndex(), submap.getSize())
18 {
19 }
20 
22  const cost_map::BufferRegion& bufferRegion)
23  : SubmapIterator(gridMap, bufferRegion.getStartIndex(), bufferRegion.getSize())
24 {
25 }
26 
27 
28 SubmapIterator::SubmapIterator(const cost_map::CostMap& gridMap, const Index& submapStartIndex,
29  const Size& submapSize)
30 {
31  size_ = gridMap.getSize();
32  startIndex_ = gridMap.getStartIndex();
33  index_ = submapStartIndex;
34  submapSize_ = submapSize;
35  submapStartIndex_ = submapStartIndex;
36  submapIndex_.setZero();
37  isPastEnd_ = false;
38 }
39 
41 {
42  size_ = other->size_;
43  startIndex_ = other->startIndex_;
44  submapSize_ = other->submapSize_;
46  index_ = other->index_;
47  submapIndex_ = other->submapIndex_;
48  isPastEnd_ = other->isPastEnd_;
49 }
50 
52 {
53  size_ = other.size_;
54  startIndex_ = other.startIndex_;
55  submapSize_ = other.submapSize_;
57  index_ = other.index_;
58  submapIndex_ = other.submapIndex_;
59  isPastEnd_ = other.isPastEnd_;
60  return *this;
61 }
62 
64 {
65  return (index_ != other.index_).any();
66 }
67 
68 const Eigen::Array2i& SubmapIterator::operator *() const
69 {
70  return index_;
71 }
72 
73 const Eigen::Array2i& SubmapIterator::getSubmapIndex() const
74 {
75  return submapIndex_;
76 }
77 
79 {
82  return *this;
83 }
84 
86 {
87  return isPastEnd_;
88 }
89 
90 } /* namespace cost_map */
91 
SubmapIterator & operator=(const SubmapIterator &other)
bool incrementIndexForSubmap(Index &submapIndex, Index &index, const Index &submapTopLeftIndex, const Size &submapBufferSize, const Size &bufferSize, const Index &bufferStartIndex=Index::Zero())
bool operator!=(const SubmapIterator &other) const
const Size & getSize() const
Index submapIndex_
Current index in the submap.
Size submapSize_
Submap buffer size.
grid_map::Size Size
Definition: common.hpp:46
SubmapIterator(const cost_map::SubmapGeometry &submap)
bool isPastEnd_
Is iterator out of scope.
Index startIndex_
Start index of the circular buffer.
Index submapStartIndex_
Top left index of the submap.
Size size_
Size of the buffer.
grid_map::Index Index
Definition: common.hpp:45
Index index_
Current index.
const Index & getStartIndex() const


cost_map_core
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:03:41