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

Iterates over all of the valid indexes that lie within an arbitrary polygon in row major order. More...

#include <polygon_fill.h>

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

Public Member Functions

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

Protected Member Functions

bool isInside (unsigned int x, unsigned int y) const
 Check if given index is inside the polygon. More...
 
 PolygonFill (const nav_grid::NavGridInfo *info, const nav_grid::Index &index, nav_2d_msgs::Polygon2D polygon, unsigned int min_x, unsigned int min_y, unsigned int width, unsigned int height, const nav_grid::Index &start_index)
 Protected constructor that takes in an arbitrary index and other internal parameters. More...
 
- Protected Member Functions inherited from nav_grid_iterators::BaseIterator< PolygonFill >
 BaseIterator (const nav_grid::NavGridInfo *info, const nav_grid::Index &index)
 Protected constructor that takes in an arbitrary index. More...
 

Protected Attributes

unsigned int height_
 
std::unique_ptr< SubGridinternal_iterator_
 
unsigned int min_x_
 
unsigned int min_y_
 
nav_2d_msgs::Polygon2D polygon_
 
nav_grid::Index start_index_
 
unsigned int width_
 
- Protected Attributes inherited from nav_grid_iterators::BaseIterator< PolygonFill >
nav_grid::Index index_
 
const nav_grid::NavGridInfoinfo_
 

Additional Inherited Members

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

Detailed Description

Iterates over all of the valid indexes that lie within an arbitrary polygon in row major order.

Definition at line 49 of file polygon_fill.h.

Constructor & Destructor Documentation

◆ PolygonFill() [1/3]

nav_grid_iterators::PolygonFill::PolygonFill ( const nav_grid::NavGridInfo info,
nav_2d_msgs::Polygon2D  polygon 
)

Public Constructor.

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

Definition at line 42 of file polygon_fill.cpp.

◆ PolygonFill() [2/3]

nav_grid_iterators::PolygonFill::PolygonFill ( const PolygonFill other)

Copy Constructor Required to ensure unique_ptr is set properly.

Definition at line 86 of file polygon_fill.cpp.

◆ PolygonFill() [3/3]

nav_grid_iterators::PolygonFill::PolygonFill ( const nav_grid::NavGridInfo info,
const nav_grid::Index index,
nav_2d_msgs::Polygon2D  polygon,
unsigned int  min_x,
unsigned int  min_y,
unsigned int  width,
unsigned int  height,
const nav_grid::Index start_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
min_xMinimum valid index that is within the polygon (x coordinate)
min_yMinimum valid index that is within the polygon (y coordinate)
widthMaximum number of valid indexes in a row of the polygon
heightMaximum number of of valid indexes in a column of the polygon
start_indexThe first valid index in the minimum row

Definition at line 92 of file polygon_fill.cpp.

Member Function Documentation

◆ begin()

PolygonFill nav_grid_iterators::PolygonFill::begin ( ) const
override

Definition at line 124 of file polygon_fill.cpp.

◆ end()

PolygonFill nav_grid_iterators::PolygonFill::end ( ) const
override

Definition at line 129 of file polygon_fill.cpp.

◆ fieldsEqual()

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

Additional check for whether fields of derived iterators are equal.

Helps make overriding the == operator easy.

Reimplemented from nav_grid_iterators::BaseIterator< PolygonFill >.

Definition at line 148 of file polygon_fill.cpp.

◆ increment()

void nav_grid_iterators::PolygonFill::increment ( )
overridevirtual

Increase the iterator to the next element.

Implements nav_grid_iterators::BaseIterator< PolygonFill >.

Definition at line 135 of file polygon_fill.cpp.

◆ isInside()

bool nav_grid_iterators::PolygonFill::isInside ( unsigned int  x,
unsigned int  y 
) const
protected

Check if given index is inside the polygon.

Returns
true if inside, false otherwise.

Definition at line 116 of file polygon_fill.cpp.

◆ operator=()

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

Assignment Operator Required to ensure unique_ptr is set properly.

Definition at line 102 of file polygon_fill.cpp.

Member Data Documentation

◆ height_

unsigned int nav_grid_iterators::PolygonFill::height_
protected

Definition at line 103 of file polygon_fill.h.

◆ internal_iterator_

std::unique_ptr<SubGrid> nav_grid_iterators::PolygonFill::internal_iterator_
protected

Definition at line 105 of file polygon_fill.h.

◆ min_x_

unsigned int nav_grid_iterators::PolygonFill::min_x_
protected

Definition at line 103 of file polygon_fill.h.

◆ min_y_

unsigned int nav_grid_iterators::PolygonFill::min_y_
protected

Definition at line 103 of file polygon_fill.h.

◆ polygon_

nav_2d_msgs::Polygon2D nav_grid_iterators::PolygonFill::polygon_
protected

Definition at line 102 of file polygon_fill.h.

◆ start_index_

nav_grid::Index nav_grid_iterators::PolygonFill::start_index_
protected

Definition at line 104 of file polygon_fill.h.

◆ width_

unsigned int nav_grid_iterators::PolygonFill::width_
protected

Definition at line 103 of file polygon_fill.h.


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


nav_grid_iterators
Author(s):
autogenerated on Sun May 18 2025 02:47:32