Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nav_grid_iterators::PolygonOutline Class Reference

Iterates over all of the valid indexes on the outline of a polygon. More...

#include <polygon_outline.h>

Inheritance diagram for nav_grid_iterators::PolygonOutline:
Inheritance graph
[legend]

Public Member Functions

PolygonOutlineoperator= (const PolygonOutline &other)
 Assignment Operator Required to ensure unique_ptr is set properly. More...
 
 PolygonOutline (const nav_grid::NavGridInfo *info, nav_2d_msgs::Polygon2D polygon, bool bresenham=true)
 Public Constructor. More...
 
 PolygonOutline (const PolygonOutline &other)
 Copy Constructor Required to ensure unique_ptr is set properly. More...
 
Standard BaseIterator Interface
PolygonOutline begin () const override
 Helper function for range-style iteration Equivalent to the above constructor. More...
 
PolygonOutline end () const override
 Helper function for range-style iteration. More...
 
void increment () override
 Increase the iterator to the next element. More...
 
bool fieldsEqual (const PolygonOutline &other) override
 Additional check for whether fields of derived iterators are equal. More...
 
- Public Member Functions inherited from nav_grid_iterators::BaseIterator< PolygonOutline >
 BaseIterator (const nav_grid::NavGridInfo *info)
 Public Constructor. Takes in a pointer to the info and starts at the minimum index. More...
 
 BaseIterator (const nav_grid::NavGridInfo &info)
 Public Constructor. Takes in a reference to the info and starts at the minimum index. More...
 
bool operator!= (const PolygonOutline &other)
 Test if two iterators are not equivalent - required for testing if iterator is at the end. More...
 
const nav_grid::Indexoperator* () const
 Dereference the iterator. More...
 
PolygonOutlineoperator++ ()
 Increase the iterator to the next element. More...
 
bool operator== (const PolygonOutline &other)
 Test if two iterators are equivalent. More...
 
virtual ~BaseIterator ()=default
 Destructor. More...
 

Protected Member Functions

void loadSide ()
 Given a new side index, loads the internal iterator. If there are no valid values in the internal iterator, increases the side index. More...
 
 PolygonOutline (const nav_grid::NavGridInfo *info, const nav_grid::Index &index, nav_2d_msgs::Polygon2D polygon, bool bresenham, unsigned int side_index)
 Protected constructor that takes in an arbitrary index and other internal parameters. More...
 
- Protected Member Functions inherited from nav_grid_iterators::BaseIterator< PolygonOutline >
 BaseIterator (const nav_grid::NavGridInfo *info, const nav_grid::Index &index)
 Protected constructor that takes in an arbitrary index. More...
 

Protected Attributes

bool bresenham_
 
std::unique_ptr< Lineinternal_iterator_
 
nav_2d_msgs::Polygon2D polygon_
 
unsigned int side_index_
 
nav_grid::Index start_index_
 
- Protected Attributes inherited from nav_grid_iterators::BaseIterator< PolygonOutline >
nav_grid::Index index_
 
const nav_grid::NavGridInfoinfo_
 

Additional Inherited Members

- Public Types inherited from nav_grid_iterators::BaseIterator< PolygonOutline >
using difference_type = int
 
using iterator_category = std::input_iterator_tag
 
using pointer = nav_grid::Index *
 
using reference = nav_grid::Index &
 
using self_type = PolygonOutline
 
using value_type = nav_grid::Index
 

Detailed Description

Iterates over all of the valid indexes on the outline of a polygon.

Definition at line 49 of file polygon_outline.h.

Constructor & Destructor Documentation

nav_grid_iterators::PolygonOutline::PolygonOutline ( const nav_grid::NavGridInfo info,
nav_2d_msgs::Polygon2D  polygon,
bool  bresenham = true 
)

Public Constructor.

Parameters
infoNavGridInfo for the grid to iterate over
polygonPolygon to iterate over

Definition at line 41 of file polygon_outline.cpp.

nav_grid_iterators::PolygonOutline::PolygonOutline ( const PolygonOutline other)

Copy Constructor Required to ensure unique_ptr is set properly.

Definition at line 56 of file polygon_outline.cpp.

nav_grid_iterators::PolygonOutline::PolygonOutline ( const nav_grid::NavGridInfo info,
const nav_grid::Index index,
nav_2d_msgs::Polygon2D  polygon,
bool  bresenham,
unsigned int  side_index 
)
protected

Protected constructor that takes in an arbitrary index and other internal parameters.

Parameters
infoNavGridInfo for the grid to iterate over
indexInitial index
polygonPolygon to iterate over
side_indexWhich side we are currently iterating over

Definition at line 61 of file polygon_outline.cpp.

Member Function Documentation

PolygonOutline nav_grid_iterators::PolygonOutline::begin ( ) const
overridevirtual

Helper function for range-style iteration Equivalent to the above constructor.

Returns
Iterator representing beginning of the iteration

Implements nav_grid_iterators::BaseIterator< PolygonOutline >.

Definition at line 101 of file polygon_outline.cpp.

PolygonOutline nav_grid_iterators::PolygonOutline::end ( ) const
overridevirtual

Helper function for range-style iteration.

Returns
Iterator representing end of the iteration, with an invalid index

Implements nav_grid_iterators::BaseIterator< PolygonOutline >.

Definition at line 106 of file polygon_outline.cpp.

bool nav_grid_iterators::PolygonOutline::fieldsEqual ( const PolygonOutline other)
overridevirtual

Additional check for whether fields of derived iterators are equal.

Helps make overriding the == operator easy.

Reimplemented from nav_grid_iterators::BaseIterator< PolygonOutline >.

Definition at line 129 of file polygon_outline.cpp.

void nav_grid_iterators::PolygonOutline::increment ( )
overridevirtual

Increase the iterator to the next element.

Implements nav_grid_iterators::BaseIterator< PolygonOutline >.

Definition at line 113 of file polygon_outline.cpp.

void nav_grid_iterators::PolygonOutline::loadSide ( )
protected

Given a new side index, loads the internal iterator. If there are no valid values in the internal iterator, increases the side index.

Definition at line 79 of file polygon_outline.cpp.

PolygonOutline & nav_grid_iterators::PolygonOutline::operator= ( const PolygonOutline other)

Assignment Operator Required to ensure unique_ptr is set properly.

Definition at line 68 of file polygon_outline.cpp.

Member Data Documentation

bool nav_grid_iterators::PolygonOutline::bresenham_
protected

Definition at line 99 of file polygon_outline.h.

std::unique_ptr<Line> nav_grid_iterators::PolygonOutline::internal_iterator_
protected

Definition at line 96 of file polygon_outline.h.

nav_2d_msgs::Polygon2D nav_grid_iterators::PolygonOutline::polygon_
protected

Definition at line 97 of file polygon_outline.h.

unsigned int nav_grid_iterators::PolygonOutline::side_index_
protected

Definition at line 100 of file polygon_outline.h.

nav_grid::Index nav_grid_iterators::PolygonOutline::start_index_
protected

Definition at line 98 of file polygon_outline.h.


The documentation for this class was generated from the following files:


nav_grid_iterators
Author(s):
autogenerated on Sun Jan 10 2021 04:08:42