Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes | Friends
jafar::lgl::RasterRect Class Reference

RasterRect class. More...


Detailed Description

RasterRect class.

This object is used to deal with clusters of pixels. Its coordinates are pointed by the top left corner of its TOP-LEFT pixel and by the coordinates of the top-left corner of the BOTTOM-RIGHT pixel.

To correspond to GDAL Raster system the coordinates frame is the following : +----------- (+ x) ------> | | | | (+y) | | V

Definition at line 90 of file Raster.hpp.

#include <Raster.hpp>

List of all members.

Public Member Functions

 RasterRect (int _xroot, int _yroot, int _xsize, int _ysize)
bool isValid () const
 Valid rectangles return true if the bottom right corner is really at the bottom right or on the top left corner or at least the same.
int & rLeft ()
int & rTop ()
int & rRight ()
int & rBottom ()
int xroot () const
 Get the X coordinate of the top left corner of the top left pixel/cell of the current rectangle.
int yroot () const
 Get the Y coordinate of the top left corner of the top left pixel/cell of the current rectangle.
int xend () const
 Get the X coordinate of the top left corner of the bottom right pixel/cell of the current rectangle.
int yend () const
 Get the Y coordinate of the top left corner of the bottom right pixel/cell of the current rectangle.
void setXTopLeft (int pos)
void setYTopLeft (int pos)
void setXBottomRight (int pos)
void setYBottomRight (int pos)
void setX (int x)
void setY (int y)
RasterPoint topLeft () const
RasterPoint bottomRight () const
RasterPoint topRight () const
RasterPoint bottomLeft () const
RasterPoint center () const
 The center is calculated in integer values.
void rect (int &_xtopleft, int &_ytopleft, int &_xsize, int &_ysize) const
void coords (int &xtopleft, int &ytopleft, int &xbottomright, int &ybottomright) const
void setRect (int x, int y, int w, int h)
void setCoords (int xtopleft, int ytopleft, int xbottomright, int ybottomright)
int size () const
 Returns the total number of pixels inside the rectangle.
int xsize () const
 Returns xsize.
int ysize () const
 Returns ysize.
RasterRectoperator= (const RasterRect &rect)
bool contains (const RasterCellIndex &cell, bool inside=true) const
 This function tells (true) if the given cell index is part of the current raster rectangle (R.O.I.) Raster cells indexes are given as the top left coordinates of a cell.
bool contains (const RasterRect &r, bool inside=true) const
 This function tells (true) if the given RasterRect is part of the current raster rectangle (R.O.I.)
bool intersects (const RasterRect &r, RasterRect &result) const
 Test RasterRect intersection and creates resulting intersection.

Public Attributes

int xtopleft
 Top left corner X coordinate in raster cell number.
int ytopleft
 Top left corner Y coordinate in raster cell number.
int xbottomright
 Bottom right corner X coordinate in raster cell number.
int ybottomright
 Bottom right corner Y coordinate in raster cell number.
int xpsize
 Size in pixel units on X axis.
int ypsize
 Size in pixel units on Y axis.

Friends

bool operator== (const RasterRect &, const RasterRect &)
bool operator!= (const RasterRect &, const RasterRect &)
std::ostream & operator<< (std::ostream &, const RasterRect &)

Member Function Documentation

bool jafar::lgl::RasterRect::contains ( const RasterCellIndex cell,
bool  inside = true 
) const

This function tells (true) if the given cell index is part of the current raster rectangle (R.O.I.) Raster cells indexes are given as the top left coordinates of a cell.

So fully contained cells cannot have coordinates equal to right and bottom sides of the container.

Parameters:
cellRasterCellIndex to be checked if contained by the current rectangle
insideif true only fully contained cells are considered else cells origin contained in the rectangle and its borders are considered
Returns:
true if RasterCellIndex cell is included in this(RasterRect)

Referenced by jafar::lgl::QuadNode< T, RasterT >::contains().

bool jafar::lgl::RasterRect::contains ( const RasterRect r,
bool  inside = true 
) const

This function tells (true) if the given RasterRect is part of the current raster rectangle (R.O.I.)

Parameters:
rRasterRect to be checked if contained by the current rectangle
insideif true only fully contained rects are considered else rects origin contained in the rectangle and its borders are considered
Returns:
true if RasterRect r is included in this(RasterRect)

Valid rectangles return true if the bottom right corner is really at the bottom right or on the top left corner or at least the same.

Get the X coordinate of the top left corner of the bottom right pixel/cell of the current rectangle.

One should use (xend() + 1) to get the coordinate of the bottom right corner of the full rectangle

Referenced by jafar::lgl::Quadtree< T, RasterT >::setNewLeaf().

int jafar::lgl::RasterRect::xsize ( ) const [inline]

Get the Y coordinate of the top left corner of the bottom right pixel/cell of the current rectangle.

One should use (yend() + 1) to get the coordinate of the bottom right corner of the full rectangle

Referenced by jafar::lgl::Quadtree< T, RasterT >::setNewLeaf().

int jafar::lgl::RasterRect::ysize ( ) const [inline]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:42 for Jafar by doxygen 1.7.6.1
LAAS-CNRS