QGIS API Documentation  master-59fd5e0
QgsRasterProjector Class Reference

#include <qgsrasterprojector.h>

+ Inheritance diagram for QgsRasterProjector:
+ Collaboration diagram for QgsRasterProjector:

List of all members.

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 (QgsCoordinateReferenceSystem theSrcCRS, QgsCoordinateReferenceSystem theDestCRS, double theMaxSrcXRes, double theMaxSrcYRes, QgsRectangle theExtent)
 QgsRasterProjector ()
 QgsRasterProjector (const QgsRasterProjector &projector)
 Copy constructor.
 ~QgsRasterProjector ()
 The destructor.
int bandCount () const
 Get number of bands.
QgsRasterBlockblock (int bandNo, const QgsRectangle &extent, int width, int height)
 Read block of data using given extent and size.
QgsRasterInterfaceclone () const
 Clone itself, create deep copy.
QGis::DataType dataType (int bandNo) const
 Returns data type for the band specified by number.
QgsCoordinateReferenceSystem destCrs () const
 Get destination CRS.
QgsRasterProjectoroperator= (const QgsRasterProjector &projector)
void setCRS (const QgsCoordinateReferenceSystem &theSrcCRS, const QgsCoordinateReferenceSystem &theDestCRS)
 set source and destination CRS
void setMaxSrcRes (double theMaxSrcXRes, double theMaxSrcYRes)
 set maximum source resolution
QgsCoordinateReferenceSystem srcCrs () const
 Get source CRS.

Private Member Functions

void approximateSrcRowCol (int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol)
 Get approximate source row and column indexes for current source extent and resolution.
void calc ()
 Calculate matrix.
bool calcCol (int theCol)
 calculate matrix column
void calcCP (int theRow, int theCol)
void calcHelper (int theMatrixRow, QgsPoint *thePoints)
 Calculate array of src helper points.
bool calcRow (int theRow)
 calculate matrix row
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
QString cpToString ()
 get mCPMatrix as string
void destPointOnCPMatrix (int theRow, int theCol, double *theX, double *theY)
 get destination point for _current_ destination position
int dstCols () const
int dstRows () const
void insertCols ()
 insert columns to matrix
void insertRows ()
 insert rows to matrix
int matrixCol (int theDestCol)
int matrixRow (int theDestRow)
 Get matrix upper left row/col indexes for destination row/col.
void nextHelper ()
 Calc / switch helper.
void preciseSrcRowCol (int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol)
 Get precise source row and column indexes for current source extent and resolution.
void setSrcCols (int theCols)
void setSrcRows (int theRows)
int srcCols ()
QgsRectangle srcExtent ()
 get source extent
QgsPoint srcPoint (int theRow, int theCol)
 get destination point for _current_ matrix position
void srcRowCol (int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol)
 Get source row and column indexes for current source extent and resolution.
int srcRows ()
 get/set source width/height

Private Attributes

bool mApproximate
 Use approximation.
QgsCoordinateTransform mCoordinateTransform
 Reverse coordinate transform (from destination to source)
int mCPCols
 Number of mCPMatrix columns.
QList< QList< bool > > mCPLegalMatrix
 Grid of source control points transformation possible indicator.
QList< QList< QgsPoint > > mCPMatrix
 Grid of source control points.
int mCPRows
 Number of mCPMatrix rows.
int mDestCols
 Number of destination columns.
double mDestColsPerMatrixCol
 number of destination cols per matrix col
QgsCoordinateReferenceSystem mDestCRS
 Destination CRS.
QgsRectangle mDestExtent
 Destination extent.
int mDestRows
 Number of destination rows.
double mDestRowsPerMatrixRow
 number of destination rows per matrix row
double mDestXRes
 Destination x resolution.
double mDestYRes
 Destination y resolution.
QgsRectangle mExtent
 Source raster extent.
int mHelperTopRow
 Current mHelperTop matrix row.
double mMaxSrcXRes
 Maximum source resolution.
double mMaxSrcYRes
double mSqrTolerance
 Maximum tolerance in destination units.
int mSrcCols
 Number of source columns.
QgsCoordinateReferenceSystem mSrcCRS
 Source CRS.
QgsRectangle mSrcExtent
 Source extent.
int mSrcRows
 Number of source rows.
double mSrcXRes
 Source x resolution.
double mSrcYRes
 Source y resolution.
QgsPointpHelperBottom
 Array of source points for each destination column on bottom of current CPMatrix grid row.
QgsPointpHelperTop
 Array of source points for each destination column on top of current CPMatrix grid row.

Detailed Description

Definition at line 38 of file qgsrasterprojector.h.


Constructor & Destructor Documentation

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 23 of file qgsrasterprojector.cpp.

References calc(), QgsDebugMsg, and QgsRectangle::toString().

QgsRasterProjector::QgsRasterProjector ( QgsCoordinateReferenceSystem  theSrcCRS,
QgsCoordinateReferenceSystem  theDestCRS,
double  theMaxSrcXRes,
double  theMaxSrcYRes,
QgsRectangle  theExtent 
)

Definition at line 46 of file qgsrasterprojector.cpp.

References QgsDebugMsg.

Definition at line 62 of file qgsrasterprojector.cpp.

References QgsDebugMsg.

Referenced by clone().

The destructor.

Definition at line 103 of file qgsrasterprojector.cpp.

References pHelperBottom, and pHelperTop.


Member Function Documentation

void QgsRasterProjector::approximateSrcRowCol ( int  theDestRow,
int  theDestCol,
int *  theSrcRow,
int *  theSrcCol 
) [inline, private]

Get approximate source row and column indexes for current source extent and resolution.

Definition at line 493 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().

int QgsRasterProjector::bandCount ( ) const [virtual]

Get number of bands.

Implements QgsRasterInterface.

Definition at line 109 of file qgsrasterprojector.cpp.

References QgsRasterInterface::bandCount(), and QgsRasterInterface::mInput.

QgsRasterBlock * QgsRasterProjector::block ( int  bandNo,
const QgsRectangle extent,
int  width,
int  height 
) [virtual]
bool QgsRasterProjector::calcCol ( int  theCol) [private]

calculate matrix column

Definition at line 619 of file qgsrasterprojector.cpp.

References calcCP(), mCPRows, and QgsDebugMsgLevel.

Referenced by insertCols().

void QgsRasterProjector::calcCP ( int  theRow,
int  theCol 
) [private]
void QgsRasterProjector::calcHelper ( int  theMatrixRow,
QgsPoint thePoints 
) [private]
bool QgsRasterProjector::calcRow ( int  theRow) [private]

calculate matrix row

Definition at line 608 of file qgsrasterprojector.cpp.

References calcCP(), mCPCols, and QgsDebugMsgLevel.

Referenced by calc(), and insertRows().

Clone itself, create deep copy.

Implements QgsRasterInterface.

Definition at line 96 of file qgsrasterprojector.cpp.

References mDestCRS, mExtent, mMaxSrcXRes, mMaxSrcYRes, mSrcCRS, QgsDebugMsg, and QgsRasterProjector().

QString QgsRasterProjector::cpToString ( ) [private]

get mCPMatrix as string

Definition at line 297 of file qgsrasterprojector.cpp.

References mCPCols, mCPLegalMatrix, mCPMatrix, mCPRows, and QgsPoint::toString().

Referenced by calc().

QGis::DataType QgsRasterProjector::dataType ( int  bandNo) const [virtual]

Returns data type for the band specified by number.

Implements QgsRasterInterface.

Definition at line 116 of file qgsrasterprojector.cpp.

References QgsRasterInterface::dataType(), QgsRasterInterface::mInput, and QGis::UnknownDataType.

Get destination CRS.

Definition at line 83 of file qgsrasterprojector.h.

Referenced by QgsRasterFileWriter::writeDataRaster().

void QgsRasterProjector::destPointOnCPMatrix ( int  theRow,
int  theCol,
double *  theX,
double *  theY 
) [inline, private]

get destination point for _current_ destination position

Definition at line 377 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().

int QgsRasterProjector::dstCols ( ) const [inline, private]

Definition at line 107 of file qgsrasterprojector.h.

int QgsRasterProjector::dstRows ( ) const [inline, private]

Definition at line 106 of file qgsrasterprojector.h.

void QgsRasterProjector::insertCols ( ) [private]

insert columns to matrix

Definition at line 570 of file qgsrasterprojector.cpp.

References calcCol(), mCPCols, mCPLegalMatrix, mCPMatrix, and mCPRows.

Referenced by calc().

void QgsRasterProjector::insertRows ( ) [private]

insert rows to matrix

Definition at line 548 of file qgsrasterprojector.cpp.

References calcRow(), mCPCols, mCPLegalMatrix, mCPMatrix, mCPRows, and QgsDebugMsgLevel.

Referenced by calc().

int QgsRasterProjector::matrixCol ( int  theDestCol) [inline, private]

Definition at line 387 of file qgsrasterprojector.cpp.

References mDestColsPerMatrixCol.

Referenced by approximateSrcRowCol(), and calcHelper().

int QgsRasterProjector::matrixRow ( int  theDestRow) [inline, private]

Get matrix upper left row/col indexes for destination row/col.

Definition at line 383 of file qgsrasterprojector.cpp.

References mDestRowsPerMatrixRow.

Referenced by approximateSrcRowCol().

void QgsRasterProjector::nextHelper ( ) [private]

Calc / switch helper.

Definition at line 424 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, private]

Get precise source row and column indexes for current source extent and resolution.

Definition at line 447 of file qgsrasterprojector.cpp.

References mCoordinateTransform, mDestExtent, mDestXRes, mDestYRes, mSrcCols, mSrcExtent, mSrcRows, mSrcXRes, mSrcYRes, QgsDebugMsgLevel, QgsCoordinateTransform::transformInPlace(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().

Referenced by srcRowCol().

void QgsRasterProjector::setCRS ( const QgsCoordinateReferenceSystem theSrcCRS,
const QgsCoordinateReferenceSystem theDestCRS 
)
void QgsRasterProjector::setMaxSrcRes ( double  theMaxSrcXRes,
double  theMaxSrcYRes 
) [inline]

set maximum source resolution

Definition at line 86 of file qgsrasterprojector.h.

void QgsRasterProjector::setSrcCols ( int  theCols) [inline, private]

Definition at line 101 of file qgsrasterprojector.h.

void QgsRasterProjector::setSrcRows ( int  theRows) [inline, private]

Definition at line 100 of file qgsrasterprojector.h.

int QgsRasterProjector::srcCols ( ) [inline, private]

Definition at line 99 of file qgsrasterprojector.h.

Referenced by block().

Get source CRS.

Definition at line 80 of file qgsrasterprojector.h.

Referenced by QgsRasterFileWriter::writeDataRaster().

get source extent

Definition at line 95 of file qgsrasterprojector.h.

Referenced by block().

QgsPoint QgsRasterProjector::srcPoint ( int  theRow,
int  theCol 
) [private]

get destination point for _current_ matrix position

Definition at line 392 of file qgsrasterprojector.cpp.

void QgsRasterProjector::srcRowCol ( int  theDestRow,
int  theDestCol,
int *  theSrcRow,
int *  theSrcCol 
) [private]

Get source row and column indexes for current source extent and resolution.

Definition at line 435 of file qgsrasterprojector.cpp.

References approximateSrcRowCol(), mApproximate, and preciseSrcRowCol().

Referenced by block().

int QgsRasterProjector::srcRows ( ) [inline, private]

get/set source width/height

Definition at line 98 of file qgsrasterprojector.h.

Referenced by block().


Member Data Documentation

Use approximation.

Definition at line 245 of file qgsrasterprojector.h.

Referenced by calc(), and srcRowCol().

Reverse coordinate transform (from destination to source)

Definition at line 173 of file qgsrasterprojector.h.

Referenced by calcCP(), checkCols(), checkRows(), operator=(), preciseSrcRowCol(), QgsRasterProjector(), and setCRS().

QList< QList<bool> > QgsRasterProjector::mCPLegalMatrix [private]

Grid of source control points transformation possible indicator.

Definition at line 219 of file qgsrasterprojector.h.

Referenced by calc(), calcCP(), calcSrcExtent(), calcSrcRowsCols(), checkCols(), checkRows(), cpToString(), insertCols(), and insertRows().

QList< QList<QgsPoint> > QgsRasterProjector::mCPMatrix [private]

Grid of source control points.

Definition at line 215 of file qgsrasterprojector.h.

Referenced by calc(), calcCP(), calcHelper(), calcSrcExtent(), calcSrcRowsCols(), checkCols(), checkRows(), cpToString(), insertCols(), and insertRows().

Number of destination columns.

Definition at line 188 of file qgsrasterprojector.h.

Referenced by block(), calc(), calcHelper(), and calcSrcRowsCols().

number of destination cols per matrix col

Definition at line 212 of file qgsrasterprojector.h.

Referenced by calc(), and matrixCol().

Destination CRS.

Definition at line 170 of file qgsrasterprojector.h.

Referenced by block(), clone(), operator=(), QgsRasterProjector(), and setCRS().

Number of destination rows.

Definition at line 185 of file qgsrasterprojector.h.

Referenced by block(), calc(), and calcSrcRowsCols().

number of destination rows per matrix row

Definition at line 209 of file qgsrasterprojector.h.

Referenced by calc(), and matrixRow().

Destination x resolution.

Definition at line 191 of file qgsrasterprojector.h.

Referenced by calc(), calcHelper(), and preciseSrcRowCol().

Destination y resolution.

Definition at line 194 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), calc(), and preciseSrcRowCol().

Source raster extent.

Definition at line 182 of file qgsrasterprojector.h.

Referenced by calc(), calcSrcExtent(), clone(), operator=(), and QgsRasterProjector().

Current mHelperTop matrix row.

Definition at line 230 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), calc(), and nextHelper().

Maximum source resolution.

Definition at line 241 of file qgsrasterprojector.h.

Referenced by calc(), calcSrcExtent(), calcSrcRowsCols(), clone(), operator=(), and QgsRasterProjector().

Maximum tolerance in destination units.

Definition at line 238 of file qgsrasterprojector.h.

Referenced by calc(), checkCols(), and checkRows().

Number of source columns.

Definition at line 200 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), block(), calc(), calcSrcRowsCols(), and preciseSrcRowCol().

Number of source rows.

Definition at line 197 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), calc(), calcSrcRowsCols(), and preciseSrcRowCol().

double QgsRasterProjector::mSrcXRes [private]

Source x resolution.

Definition at line 203 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), calc(), and preciseSrcRowCol().

double QgsRasterProjector::mSrcYRes [private]

Source y resolution.

Definition at line 206 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), calc(), and preciseSrcRowCol().

Array of source points for each destination column on bottom of current CPMatrix grid row.

Definition at line 227 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), calc(), nextHelper(), and ~QgsRasterProjector().

Array of source points for each destination column on top of current CPMatrix grid row.

Definition at line 223 of file qgsrasterprojector.h.

Referenced by approximateSrcRowCol(), calc(), nextHelper(), and ~QgsRasterProjector().


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