Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CoordinateHandler2D Class Reference
Collaboration diagram for CoordinateHandler2D:
Collaboration graph
[legend]

Public Member Functions

 CoordinateHandler2D (const drain::image::AreaGeometry &area=AreaGeometry(), const CoordinatePolicy &policy=CoordinatePolicy())
 Default constructor.
 
 CoordinateHandler2D (const CoordinateHandler2D &handler)
 
 CoordinateHandler2D (const ImageFrame &src)
 
 CoordinateHandler2D (int xUpperLimit, int yUpperLimit, const CoordinatePolicy &policy=CoordinatePolicy())
 Constructor. More...
 
void set (const drain::image::ImageConf &src)
 
void set (const drain::image::AreaGeometry &area=AreaGeometry(), const CoordinatePolicy &p=CoordinatePolicy())
 
void setLimits (int xMin, int yMin, int xUpperLimit, int yUpperLimit)
 Sets minimum values and outer upper limits for x and y.
 
void setLimits (int xUpperLimit, int yUpperLimit)
 Sets outer upper limits for x and y.
 
const Range< int > & getXRange () const
 
const Range< int > & getYRange () const
 
void setPolicy (const CoordinatePolicy &p)
 Assigns internal function pointers.
 
void setPolicy (EdgePolicy::index_t xUnderFlowPolicy, EdgePolicy::index_t yUnderFlowPolicy, EdgePolicy::index_t xOverFlowPolicy, EdgePolicy::index_t yOverFlowPolicy)
 Assigns internal function pointers.
 
void setPolicy (EdgePolicy::index_t p)
 Set the same policy in all the directions.
 
const CoordinatePolicygetPolicy () const
 
virtual coord_overflow_t handle (int &x, int &y) const
 Ensures the validity of the coordinates. If inside limits, arguments (x,y) remain intact and 0 is returned. More...
 
coord_overflow_t handle (Point2D< int > &p) const
 Calls handle(int &x,int &y)
 
coord_overflow_t handle (Position &p) const
 
bool validate (Point2D< int > &p) const
 Handles the coordinate, returning true if the position is reversible.
 
bool validate (int &x, int &y) const
 Handles the coordinate, returning true if the position is reversible.
 

Public Attributes

CoordinatePolicy policy
 
drain::Frame2D< int > area
 

Static Public Attributes

static const drain::FlaggerBase< size_t >::dict_t dict
 
static const coord_overflow_t UNCHANGED = 0
 
static const coord_overflow_t X_OVERFLOW = 1
 
static const coord_overflow_t X_UNDERFLOW = 2
 
static const coord_overflow_t Y_OVERFLOW = 4
 
static const coord_overflow_t Y_UNDERFLOW = 8
 
static const coord_overflow_t IRREVERSIBLE = 128
 Equal move in inverse direction would not result original position.
 

Protected Member Functions

coord_overflow_t skipUndefined (int &x, int &y) const
 Does nothing to the coordinates.
 
coord_overflow_t limitXUnderFlow (int &x, int &y) const
 
coord_overflow_t limitYUnderFlow (int &x, int &y) const
 
coord_overflow_t limitXOverFlow (int &x, int &y) const
 
coord_overflow_t limitYOverFlow (int &x, int &y) const
 
coord_overflow_t wrapXUnderFlow (int &x, int &y) const
 
coord_overflow_t wrapYUnderFlow (int &x, int &y) const
 
coord_overflow_t wrapXOverFlow (int &x, int &y) const
 
coord_overflow_t wrapYOverFlow (int &x, int &y) const
 
coord_overflow_t mirrorXUnderFlow (int &x, int &y) const
 
coord_overflow_t mirrorYUnderFlow (int &x, int &y) const
 
coord_overflow_t mirrorXOverFlow (int &x, int &y) const
 
coord_overflow_t mirrorYOverFlow (int &x, int &y) const
 
coord_overflow_t polarXUnderFlow (int &x, int &y) const
 
coord_overflow_t polarYUnderFlow (int &x, int &y) const
 
coord_overflow_t polarXOverFlow (int &x, int &y) const
 
coord_overflow_t polarYOverFlow (int &x, int &y) const
 

Protected Attributes

drain::Range< int > xRange
 
drain::Range< int > yRange
 
coord_overflow_t(CoordinateHandler2D::* handleXUnderFlow )(int &x, int &y) const
 
coord_overflow_t(CoordinateHandler2D::* handleXOverFlow )(int &x, int &y) const
 
coord_overflow_t(CoordinateHandler2D::* handleYUnderFlow )(int &x, int &y) const
 
coord_overflow_t(CoordinateHandler2D::* handleYOverFlow )(int &x, int &y) const
 

Constructor & Destructor Documentation

◆ CoordinateHandler2D()

CoordinateHandler2D ( int  xUpperLimit,
int  yUpperLimit,
const CoordinatePolicy policy = CoordinatePolicy() 
)
inline

Constructor.

xUpperLimit - value one greater than maximum allowed value
xUpperLimit - value one greater than maximum allowed value

Member Function Documentation

◆ handle()

virtual coord_overflow_t handle ( int &  x,
int &  y 
) const
inlinevirtual

Ensures the validity of the coordinates. If inside limits, arguments (x,y) remain intact and 0 is returned.

Returns
- value that describes overflow; zero if no limits crossed and hence, x and y intact.
See also
CoordinateHandler2D::IRREVERSIBLE and str constants.
validate()

◆ polarXUnderFlow()

coord_overflow_t polarXUnderFlow ( int &  x,
int &  y 
) const
inlineprotected

Especially, maps x=-1 to x=0.

◆ polarYUnderFlow()

coord_overflow_t polarYUnderFlow ( int &  x,
int &  y 
) const
inlineprotected

Especially, maps y=-1 to y=0.

Member Data Documentation

◆ dict

const drain::FlagResolver::dict_t dict
static
Initial value:
= {
{"X_OVERFLOW", X_OVERFLOW},
{"X_UNDERFLOW", X_UNDERFLOW},
{"Y_OVERFLOW", Y_OVERFLOW},
{"Y_UNDERFLOW", Y_UNDERFLOW},
{"IRREVERSIBLE", IRREVERSIBLE}
}
static const coord_overflow_t IRREVERSIBLE
Equal move in inverse direction would not result original position.
Definition: CoordinateHandler.h:74

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