iLand
Public Member Functions | List of all members
GridRunner< T > Class Template Reference

helper class to iterate over a rectangular fraction of a grid More...

#include <grid.h>

Public Member Functions

 GridRunner (Grid< T > &target_grid, const QRectF &rectangle)
 
 GridRunner (const Grid< T > &target_grid, const QRectF &rectangle)
 
 GridRunner (Grid< T > *target_grid, const QRectF &rectangle)
 
 GridRunner (Grid< T > &target_grid, const QRect &rectangle)
 
 GridRunner (const Grid< T > &target_grid, const QRect &rectangle)
 
 GridRunner (Grid< T > *target_grid, const QRect &rectangle)
 
 GridRunner (Grid< T > *target_grid)
 
T * next ()
 to to next element, return NULL if finished More...
 
T * current () const
 return the current element, or NULL More...
 
T * first () const
 return the first element More...
 
T * last () const
 return the last element (not one element behind the last element!) More...
 
bool isValid () const
 checks if the state of the GridRunner is valid, returns false if out of scope More...
 
QPoint currentIndex () const
 return the (index) - coordinates of the current position in the grid More...
 
QPointF currentCoord () const
 return the coordinates of the cell center point of the current position in the grid. More...
 
void reset ()
 
void setPosition (QPoint new_index)
 set the internal pointer to the pixel at index 'new_index'. The index is relative to the base grid! More...
 
void neighbors4 (T **rArray)
 fill array with pointers to neighbors (north, east, west, south) or Null-pointers if out of range. More...
 
void neighbors8 (T **rArray)
 get pointers to the 8-neighbor-hood north/east/west/south/NE/NW/SE/SW 0-pointers are returned for edge pixels. More...
 

Detailed Description

template<class T>
class GridRunner< T >

helper class to iterate over a rectangular fraction of a grid

Constructor & Destructor Documentation

◆ GridRunner() [1/7]

template<class T >
GridRunner< T >::GridRunner ( Grid< T > &  target_grid,
const QRectF &  rectangle 
)
inline

◆ GridRunner() [2/7]

template<class T >
GridRunner< T >::GridRunner ( const Grid< T > &  target_grid,
const QRectF &  rectangle 
)
inline

◆ GridRunner() [3/7]

template<class T >
GridRunner< T >::GridRunner ( Grid< T > *  target_grid,
const QRectF &  rectangle 
)
inline

◆ GridRunner() [4/7]

template<class T >
GridRunner< T >::GridRunner ( Grid< T > &  target_grid,
const QRect &  rectangle 
)
inline

◆ GridRunner() [5/7]

template<class T >
GridRunner< T >::GridRunner ( const Grid< T > &  target_grid,
const QRect &  rectangle 
)
inline

◆ GridRunner() [6/7]

template<class T >
GridRunner< T >::GridRunner ( Grid< T > *  target_grid,
const QRect &  rectangle 
)
inline

◆ GridRunner() [7/7]

template<class T >
GridRunner< T >::GridRunner ( Grid< T > *  target_grid)
inline

Member Function Documentation

◆ current()

template<class T >
T * GridRunner< T >::current ( ) const
inline

return the current element, or NULL

◆ currentCoord()

template<class T >
QPointF GridRunner< T >::currentCoord ( ) const
inline

return the coordinates of the cell center point of the current position in the grid.

◆ currentIndex()

template<class T >
QPoint GridRunner< T >::currentIndex ( ) const
inline

return the (index) - coordinates of the current position in the grid

◆ first()

template<class T >
T * GridRunner< T >::first ( ) const
inline

return the first element

◆ isValid()

template<class T >
bool GridRunner< T >::isValid ( ) const
inline

checks if the state of the GridRunner is valid, returns false if out of scope

◆ last()

template<class T >
T * GridRunner< T >::last ( ) const
inline

return the last element (not one element behind the last element!)

◆ neighbors4()

template<class T >
void GridRunner< T >::neighbors4 ( T **  rArray)

fill array with pointers to neighbors (north, east, west, south) or Null-pointers if out of range.

get pointers the the 4-neighborhood north, east, west, south 0-pointers are returned for edge pixels.

the target array (rArray) is not checked and must be valid!

◆ neighbors8()

template<class T >
void GridRunner< T >::neighbors8 ( T **  rArray)

get pointers to the 8-neighbor-hood north/east/west/south/NE/NW/SE/SW 0-pointers are returned for edge pixels.

◆ next()

template<class T >
T * GridRunner< T >::next

to to next element, return NULL if finished

◆ reset()

template<class T >
void GridRunner< T >::reset ( )
inline

◆ setPosition()

template<class T >
void GridRunner< T >::setPosition ( QPoint  new_index)
inline

set the internal pointer to the pixel at index 'new_index'. The index is relative to the base grid!


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