27 #include "../geometry/Coord2D.h" 
   28 #include "../geometry/Envelope.h" 
   67                     double resX, 
double resY,
 
   82                     double resX, 
double resY,
 
  146     m_nCols(rhs.m_nCols),
 
  147     m_nRows(rhs.m_nRows),
 
  180     memcpy(m_geoT, rhs.
m_geoT, 
sizeof(
double) * 6);
 
  226   m_geoT[5] = -1.0 * resY;
 
  229   m_geoT[0] = ulLocation.
x + ( m_geoT[1] / 2.0 );
 
  230   m_geoT[3] = ulLocation.
y + ( m_geoT[5] / 2.0 );
 
  241   m_geoT[0] = geoTrans[0];
 
  242   m_geoT[1] = geoTrans[1];
 
  243   m_geoT[2] = geoTrans[2];
 
  244   m_geoT[3] = geoTrans[3];
 
  245   m_geoT[4] = geoTrans[4];
 
  246   m_geoT[5] = geoTrans[5];
 
  258   return std::abs( m_geoT[1] );
 
  263   return ( -1.0 * m_geoT[5] );
 
  289   te::gm::Coord2D lr = gridToGeo( ((
double)m_nCols) - 0.5, ((
double)m_nRows) - 0.5 );
 
  296   m_extent->
init(std::min(ll.
x, ul.
x),
 
  297                  std::min(ll.
y, lr.
y),
 
  298                  std::max(ur.
x, lr.
x),
 
  299                  std::max(ul.
y, ur.
y));
 
  304   x = m_geoT[0] + col * m_geoT[1] + row * m_geoT[2];
 
  305   y = m_geoT[3] + col * m_geoT[4] + row * m_geoT[5];
 
  310   col = (m_geoT[5] * (x - m_geoT[0]) - m_geoT[2] * (y - m_geoT[3])) / (m_geoT[1] * m_geoT[5] - m_geoT[2] * m_geoT[4]);
 
  311   row = (y - m_geoT[3] - col * m_geoT[4]) / m_geoT[5];
 
  319   if (!m_extent->equals(*rhs.
m_extent) ||
 
double getWidth() const 
It returns the envelope width. 
 
void computeExtent() const 
Computes the geographic extension of the grid. 
 
te::gm::Envelope * m_extent
The grid extent. 
 
int m_srid
The associated SRS. 
 
void setNumberOfColumns(unsigned int nCols)
Sets the grid number of columns. 
 
double getResolutionY() const 
Returns the grid vertical (y-axis) resolution. 
 
double getHeight() const 
It returns the envelope height. 
 
A rectified grid is the spatial support for raster data. 
 
void setGeoreference(const te::gm::Coord2D &ulLocation, int srid, double resX, double resY)
Sets the information needed to georeference the grid. 
 
An utility struct for representing 2D coordinates. 
 
unsigned int getNumberOfRows() const 
Returns the grid number of rows. 
 
A rectified grid is the spatial support for raster data. 
 
double m_geoT[6]
A list of 6 coefficients describing an affine transformation to georeference a grid. In a north up image, m_geoT[1] is the pixel width, and m_geoT[5] is the pixel height. The upper left corner of the upper left pixel is at position (m_geoT[0],m_geoT[3]). 
 
double m_ury
Upper right corner y-coordinate. 
 
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid. 
 
void init(const double &llx, const double &lly, const double &urx, const double &ury)
It initializes (sets) the envelope bounds. 
 
Grid & operator=(const Grid &rhs)
Assignment operator. 
 
double getResolutionX() const 
Returns the grid horizontal (x-axis) resolution. 
 
Grid(unsigned int nCols=0, unsigned int nRows=0, te::gm::Envelope *mbr=0, int srid=TE_UNKNOWN_SRS)
Constructor. 
 
bool operator==(const Grid &rhs) const 
Equal operator. 
 
void gridToGeo(const double &col, const double &row, double &x, double &y) const 
Get the spatial location of a grid point. 
 
unsigned int m_nRows
Number of rows. 
 
double m_llx
Lower left corner x-coordinate. 
 
unsigned int getNumberOfColumns() const 
Returns the grid number of columns. 
 
int getSRID() const 
Returns the grid spatial reference system identifier. 
 
void setSRID(int srid)
Just sets the grid spatial reference system identifier. 
 
An Envelope defines a 2D rectangular region. 
 
void geoToGrid(const double &x, const double &y, double &col, double &row) const 
Get the grid point associated to a spatial location. 
 
const double * getGeoreference() const 
Returns a list of 6 coefficients describing an affine transformation to georeference a grid...
 
void setNumberOfRows(unsigned int nRows)
Sets the grid number of rows. 
 
unsigned int m_nCols
Number of columns.