Quantum GIS API Documentation
1.7.4
|
#include <qgsrasterprojector.h>
Public Member Functions | |
QgsRasterProjector (QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, QgsRectangle theDestExtent, int theDestRows, int theDestCols, double theMaxSrcXRes, double theMaxSrcYRes, QgsRectangle theExtent) | |
QgsRasterProjector implements approximate projection support for it calculates grid of points in source CRS for target CRS + extent which are used to calculate affine transformation matrices. | |
~QgsRasterProjector () | |
The destructor. | |
void | destPointOnCPMatrix (int theRow, int theCol, double *theX, double *theY) |
get destination point for _current_ destination position | |
int | matrixRow (int theDestRow) |
Get matrix upper left row/col indexes for destination row/col. | |
int | matrixCol (int theDestCol) |
QgsPoint | srcPoint (int theRow, int theCol) |
get destination point for _current_ matrix position | |
void | preciseSrcRowCol (int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol) |
Get precise source row and column indexes for current source extent and resolution. | |
void | approximateSrcRowCol (int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol) |
Get approximate source row and column indexes for current source extent and resolution. | |
void | srcRowCol (int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol) |
Get source row and column indexes for current source extent and resolution. | |
void | insertRows () |
insert rows to matrix | |
void | insertCols () |
insert columns to matrix | |
void | calcCP (int theRow, int theCol) |
bool | calcRow (int theRow) |
calculate matrix row | |
bool | calcCol (int theCol) |
calculate matrix column | |
void | calcSrcExtent () |
calculate source extent | |
void | calcSrcRowsCols () |
calculate minimum source width and height | |
bool | checkCols () |
check error along columns returns true if within threshold | |
bool | checkRows () |
check error along rows returns true if within threshold | |
void | calcHelper (int theMatrixRow, QgsPoint *thePoints) |
Calculate array of src helper points. | |
void | nextHelper () |
Calc / switch helper. | |
QgsRectangle | srcExtent () |
get source extent | |
int | srcRows () |
get/set source width/height | |
int | srcCols () |
void | setSrcRows (int theRows) |
void | setSrcCols (int theCols) |
QString | cpToString () |
get mCPMatrix as string | |
Private Attributes | |
QgsCoordinateReferenceSystem | mSrcCRS |
Source CRS. | |
QgsCoordinateReferenceSystem | mDestCRS |
Destination CRS. | |
QgsCoordinateTransform | mCoordinateTransform |
Coordinate transform. | |
QgsRectangle | mDestExtent |
Destination extent. | |
QgsRectangle | mSrcExtent |
Source extent. | |
QgsRectangle | mExtent |
Source raster extent. | |
int | mDestRows |
Number of destination rows. | |
int | mDestCols |
Number of destination columns. | |
double | mDestXRes |
Destination x resolution. | |
double | mDestYRes |
Destination y resolution. | |
int | mSrcRows |
Number of source rows. | |
int | mSrcCols |
Number of source columns. | |
double | mSrcXRes |
Source x resolution. | |
double | mSrcYRes |
Source y resolution. | |
double | mDestRowsPerMatrixRow |
number of destination rows per matrix row | |
double | mDestColsPerMatrixCol |
number of destination cols per matrix col | |
QList< QList< QgsPoint > > | mCPMatrix |
Grid of source control points. | |
QgsPoint * | pHelperTop |
Array of source points for each destination column on top of current CPMatrix grid row. | |
QgsPoint * | pHelperBottom |
Array of source points for each destination column on bottom of current CPMatrix grid row. | |
int | mHelperTopRow |
Current mHelperTop matrix row. | |
int | mCPCols |
Number of mCPMatrix columns. | |
int | mCPRows |
Number of mCPMatrix rows. | |
double | mSqrTolerance |
Maximum tolerance in destination units. | |
double | mMaxSrcXRes |
Maximum source resolution. | |
double | mMaxSrcYRes |
bool | mApproximate |
Use approximation. |
Definition at line 41 of file qgsrasterprojector.h.
QgsRasterProjector::QgsRasterProjector | ( | QgsCoordinateReferenceSystem | theSrcCRS, |
QgsCoordinateReferenceSystem | theDestCRS, | ||
QgsRectangle | theDestExtent, | ||
int | theDestRows, | ||
int | theDestCols, | ||
double | theMaxSrcXRes, | ||
double | theMaxSrcYRes, | ||
QgsRectangle | theExtent | ||
) |
QgsRasterProjector implements approximate projection support for it calculates grid of points in source CRS for target CRS + extent which are used to calculate affine transformation matrices.
Definition at line 25 of file qgsrasterprojector.cpp.
References calcHelper(), calcRow(), calcSrcExtent(), calcSrcRowsCols(), checkCols(), checkRows(), QgsRectangle::height(), insertCols(), insertRows(), mApproximate, mCPCols, mCPMatrix, mCPRows, mDestCols, mDestColsPerMatrixCol, mDestExtent, mDestRows, mDestRowsPerMatrixRow, mDestXRes, mDestYRes, mHelperTopRow, mSqrTolerance, mSrcCols, mSrcExtent, mSrcRows, mSrcXRes, mSrcYRes, pHelperBottom, pHelperTop, QgsDebugMsg, QgsRectangle::toString(), and QgsRectangle::width().
The destructor.
Definition at line 116 of file qgsrasterprojector.cpp.
void QgsRasterProjector::approximateSrcRowCol | ( | int | theDestRow, |
int | theDestCol, | ||
int * | theSrcRow, | ||
int * | theSrcCol | ||
) | [inline] |
Get approximate source row and column indexes for current source extent and resolution.
Definition at line 333 of file qgsrasterprojector.cpp.
References destPointOnCPMatrix(), matrixCol(), matrixRow(), mDestExtent, mDestYRes, mHelperTopRow, mSrcCols, mSrcExtent, mSrcRows, mSrcXRes, mSrcYRes, nextHelper(), pHelperBottom, pHelperTop, QgsPoint::x(), QgsRectangle::xMinimum(), QgsPoint::y(), and QgsRectangle::yMaximum().
Referenced by srcRowCol().
bool QgsRasterProjector::calcCol | ( | int | theCol | ) |
calculate matrix column
Definition at line 441 of file qgsrasterprojector.cpp.
References calcCP(), mCPRows, and QgsDebugMsgLevel.
Referenced by insertCols().
void QgsRasterProjector::calcCP | ( | int | theRow, |
int | theCol | ||
) |
Definition at line 421 of file qgsrasterprojector.cpp.
References destPointOnCPMatrix(), mCoordinateTransform, mCPMatrix, and QgsCoordinateTransform::transform().
void QgsRasterProjector::calcHelper | ( | int | theMatrixRow, |
QgsPoint * | thePoints | ||
) |
Calculate array of src helper points.
Definition at line 260 of file qgsrasterprojector.cpp.
References destPointOnCPMatrix(), matrixCol(), mCPMatrix, mDestCols, mDestExtent, mDestXRes, QgsPoint::setX(), QgsPoint::setY(), QgsPoint::x(), QgsRectangle::xMinimum(), and QgsPoint::y().
Referenced by nextHelper(), and QgsRasterProjector().
bool QgsRasterProjector::calcRow | ( | int | theRow | ) |
calculate matrix row
Definition at line 430 of file qgsrasterprojector.cpp.
References calcCP(), mCPCols, and QgsDebugMsgLevel.
Referenced by insertRows(), and QgsRasterProjector().
void QgsRasterProjector::calcSrcExtent | ( | ) |
calculate source extent
Definition at line 121 of file qgsrasterprojector.cpp.
References QgsRectangle::combineExtentWith(), mCPCols, mCPMatrix, mCPRows, mExtent, mMaxSrcXRes, mMaxSrcYRes, mSrcExtent, QgsDebugMsg, QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsRectangle::toString(), QgsPoint::x(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsPoint::y(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by QgsRasterProjector().
void QgsRasterProjector::calcSrcRowsCols | ( | ) |
calculate minimum source width and height
Definition at line 190 of file qgsrasterprojector.cpp.
References QgsRectangle::height(), mCPCols, mCPMatrix, mCPRows, mDestCols, mDestRows, mMaxSrcXRes, mMaxSrcYRes, mSrcCols, mSrcExtent, mSrcRows, QgsDebugMsg, QgsPoint::sqrDist(), and QgsRectangle::width().
Referenced by QgsRasterProjector().
bool QgsRasterProjector::checkCols | ( | ) |
check error along columns returns true if within threshold
Definition at line 452 of file qgsrasterprojector.cpp.
References destPointOnCPMatrix(), mCoordinateTransform, mCPCols, mCPMatrix, mCPRows, mSqrTolerance, QgsCoordinateTransform::ReverseTransform, QgsPoint::sqrDist(), QgsCoordinateTransform::transform(), QgsPoint::x(), and QgsPoint::y().
Referenced by QgsRasterProjector().
bool QgsRasterProjector::checkRows | ( | ) |
check error along rows returns true if within threshold
Definition at line 475 of file qgsrasterprojector.cpp.
References destPointOnCPMatrix(), mCoordinateTransform, mCPCols, mCPMatrix, mCPRows, mSqrTolerance, QgsCoordinateTransform::ReverseTransform, QgsPoint::sqrDist(), QgsCoordinateTransform::transform(), QgsPoint::x(), and QgsPoint::y().
Referenced by QgsRasterProjector().
QString QgsRasterProjector::cpToString | ( | ) |
get mCPMatrix as string
Definition at line 174 of file qgsrasterprojector.cpp.
References mCPCols, mCPMatrix, mCPRows, and QgsPoint::toString().
void QgsRasterProjector::destPointOnCPMatrix | ( | int | theRow, |
int | theCol, | ||
double * | theX, | ||
double * | theY | ||
) | [inline] |
get destination point for _current_ destination position
Definition at line 240 of file qgsrasterprojector.cpp.
References QgsRectangle::height(), mCPCols, mCPRows, mDestExtent, QgsRectangle::width(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().
Referenced by approximateSrcRowCol(), calcCP(), calcHelper(), checkCols(), and checkRows().
void QgsRasterProjector::insertCols | ( | ) |
insert columns to matrix
Definition at line 403 of file qgsrasterprojector.cpp.
References calcCol(), mCPCols, mCPMatrix, and mCPRows.
Referenced by QgsRasterProjector().
void QgsRasterProjector::insertRows | ( | ) |
insert rows to matrix
Definition at line 384 of file qgsrasterprojector.cpp.
References calcRow(), mCPCols, mCPMatrix, mCPRows, and QgsDebugMsgLevel.
Referenced by QgsRasterProjector().
int QgsRasterProjector::matrixCol | ( | int | theDestCol | ) | [inline] |
Definition at line 250 of file qgsrasterprojector.cpp.
References mDestColsPerMatrixCol.
Referenced by approximateSrcRowCol(), and calcHelper().
int QgsRasterProjector::matrixRow | ( | int | theDestRow | ) | [inline] |
Get matrix upper left row/col indexes for destination row/col.
Definition at line 246 of file qgsrasterprojector.cpp.
References mDestRowsPerMatrixRow.
Referenced by approximateSrcRowCol().
void QgsRasterProjector::nextHelper | ( | ) |
Calc / switch helper.
Definition at line 285 of file qgsrasterprojector.cpp.
References calcHelper(), mHelperTopRow, pHelperBottom, and pHelperTop.
Referenced by approximateSrcRowCol().
void QgsRasterProjector::preciseSrcRowCol | ( | int | theDestRow, |
int | theDestCol, | ||
int * | theSrcRow, | ||
int * | theSrcCol | ||
) | [inline] |
Get precise source row and column indexes for current source extent and resolution.
Definition at line 301 of file qgsrasterprojector.cpp.
References mCoordinateTransform, mDestExtent, mDestXRes, mDestYRes, mSrcCols, mSrcExtent, mSrcRows, mSrcXRes, mSrcYRes, QgsCoordinateTransform::transformInPlace(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().
Referenced by srcRowCol().
void QgsRasterProjector::setSrcCols | ( | int | theCols | ) | [inline] |
Definition at line 124 of file qgsrasterprojector.h.
References mSrcCols, mSrcExtent, mSrcYRes, and QgsRectangle::width().
void QgsRasterProjector::setSrcRows | ( | int | theRows | ) | [inline] |
Definition at line 123 of file qgsrasterprojector.h.
References QgsRectangle::height(), mSrcExtent, mSrcRows, and mSrcXRes.
int QgsRasterProjector::srcCols | ( | ) | [inline] |
Definition at line 122 of file qgsrasterprojector.h.
References mSrcCols.
Referenced by QgsRasterDataProvider::readBlock().
QgsRectangle QgsRasterProjector::srcExtent | ( | ) | [inline] |
get source extent
Definition at line 118 of file qgsrasterprojector.h.
References mSrcExtent.
Referenced by QgsRasterDataProvider::readBlock().
QgsPoint QgsRasterProjector::srcPoint | ( | int | theRow, |
int | theCol | ||
) |
get destination point for _current_ matrix position
Definition at line 255 of file qgsrasterprojector.cpp.
void QgsRasterProjector::srcRowCol | ( | int | theDestRow, |
int | theDestCol, | ||
int * | theSrcRow, | ||
int * | theSrcCol | ||
) |
Get source row and column indexes for current source extent and resolution.
Definition at line 295 of file qgsrasterprojector.cpp.
References approximateSrcRowCol(), mApproximate, and preciseSrcRowCol().
Referenced by QgsRasterDataProvider::readBlock().
int QgsRasterProjector::srcRows | ( | ) | [inline] |
get/set source width/height
Definition at line 121 of file qgsrasterprojector.h.
References mSrcRows.
Referenced by QgsRasterDataProvider::readBlock().
bool QgsRasterProjector::mApproximate [private] |
Use approximation.
Definition at line 205 of file qgsrasterprojector.h.
Referenced by QgsRasterProjector(), and srcRowCol().
Coordinate transform.
Definition at line 137 of file qgsrasterprojector.h.
Referenced by calcCP(), checkCols(), checkRows(), and preciseSrcRowCol().
int QgsRasterProjector::mCPCols [private] |
Number of mCPMatrix columns.
Definition at line 193 of file qgsrasterprojector.h.
Referenced by calcRow(), calcSrcExtent(), calcSrcRowsCols(), checkCols(), checkRows(), cpToString(), destPointOnCPMatrix(), insertCols(), insertRows(), and QgsRasterProjector().
QList< QList<QgsPoint> > QgsRasterProjector::mCPMatrix [private] |
Grid of source control points.
Definition at line 179 of file qgsrasterprojector.h.
Referenced by calcCP(), calcHelper(), calcSrcExtent(), calcSrcRowsCols(), checkCols(), checkRows(), cpToString(), insertCols(), insertRows(), and QgsRasterProjector().
int QgsRasterProjector::mCPRows [private] |
Number of mCPMatrix rows.
Definition at line 195 of file qgsrasterprojector.h.
Referenced by calcCol(), calcSrcExtent(), calcSrcRowsCols(), checkCols(), checkRows(), cpToString(), destPointOnCPMatrix(), insertCols(), insertRows(), and QgsRasterProjector().
int QgsRasterProjector::mDestCols [private] |
Number of destination columns.
Definition at line 152 of file qgsrasterprojector.h.
Referenced by calcHelper(), calcSrcRowsCols(), and QgsRasterProjector().
double QgsRasterProjector::mDestColsPerMatrixCol [private] |
number of destination cols per matrix col
Definition at line 176 of file qgsrasterprojector.h.
Referenced by matrixCol(), and QgsRasterProjector().
Destination CRS.
Definition at line 134 of file qgsrasterprojector.h.
QgsRectangle QgsRasterProjector::mDestExtent [private] |
Destination extent.
Definition at line 140 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), calcHelper(), destPointOnCPMatrix(), preciseSrcRowCol(), and QgsRasterProjector().
int QgsRasterProjector::mDestRows [private] |
Number of destination rows.
Definition at line 149 of file qgsrasterprojector.h.
Referenced by calcSrcRowsCols(), and QgsRasterProjector().
double QgsRasterProjector::mDestRowsPerMatrixRow [private] |
number of destination rows per matrix row
Definition at line 173 of file qgsrasterprojector.h.
Referenced by matrixRow(), and QgsRasterProjector().
double QgsRasterProjector::mDestXRes [private] |
Destination x resolution.
Definition at line 155 of file qgsrasterprojector.h.
Referenced by calcHelper(), preciseSrcRowCol(), and QgsRasterProjector().
double QgsRasterProjector::mDestYRes [private] |
Destination y resolution.
Definition at line 158 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), preciseSrcRowCol(), and QgsRasterProjector().
QgsRectangle QgsRasterProjector::mExtent [private] |
Source raster extent.
Definition at line 146 of file qgsrasterprojector.h.
Referenced by calcSrcExtent().
int QgsRasterProjector::mHelperTopRow [private] |
Current mHelperTop matrix row.
Definition at line 190 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), nextHelper(), and QgsRasterProjector().
double QgsRasterProjector::mMaxSrcXRes [private] |
Maximum source resolution.
Definition at line 201 of file qgsrasterprojector.h.
Referenced by calcSrcExtent(), and calcSrcRowsCols().
double QgsRasterProjector::mMaxSrcYRes [private] |
Definition at line 202 of file qgsrasterprojector.h.
Referenced by calcSrcExtent(), and calcSrcRowsCols().
double QgsRasterProjector::mSqrTolerance [private] |
Maximum tolerance in destination units.
Definition at line 198 of file qgsrasterprojector.h.
Referenced by checkCols(), checkRows(), and QgsRasterProjector().
int QgsRasterProjector::mSrcCols [private] |
Number of source columns.
Definition at line 164 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), calcSrcRowsCols(), preciseSrcRowCol(), QgsRasterProjector(), setSrcCols(), and srcCols().
Source CRS.
Definition at line 131 of file qgsrasterprojector.h.
QgsRectangle QgsRasterProjector::mSrcExtent [private] |
Source extent.
Definition at line 143 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), calcSrcExtent(), calcSrcRowsCols(), preciseSrcRowCol(), QgsRasterProjector(), setSrcCols(), setSrcRows(), and srcExtent().
int QgsRasterProjector::mSrcRows [private] |
Number of source rows.
Definition at line 161 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), calcSrcRowsCols(), preciseSrcRowCol(), QgsRasterProjector(), setSrcRows(), and srcRows().
double QgsRasterProjector::mSrcXRes [private] |
Source x resolution.
Definition at line 167 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), preciseSrcRowCol(), QgsRasterProjector(), and setSrcRows().
double QgsRasterProjector::mSrcYRes [private] |
Source y resolution.
Definition at line 170 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), preciseSrcRowCol(), QgsRasterProjector(), and setSrcCols().
QgsPoint* QgsRasterProjector::pHelperBottom [private] |
Array of source points for each destination column on bottom of current CPMatrix grid row.
Definition at line 187 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), nextHelper(), and QgsRasterProjector().
QgsPoint* QgsRasterProjector::pHelperTop [private] |
Array of source points for each destination column on top of current CPMatrix grid row.
Definition at line 183 of file qgsrasterprojector.h.
Referenced by approximateSrcRowCol(), nextHelper(), and QgsRasterProjector().