28 int theSrcDatumTransform,
29 int theDestDatumTransform,
31 int theDestRows,
int theDestCols,
32 double theMaxSrcXRes,
double theMaxSrcYRes,
35 , mSrcCRS( theSrcCRS )
36 , mDestCRS( theDestCRS )
37 , mSrcDatumTransform( theSrcDatumTransform )
38 , mDestDatumTransform( theDestDatumTransform )
39 , mDestExtent( theDestExtent )
40 , mExtent( theExtent )
41 , mDestRows( theDestRows ), mDestCols( theDestCols )
42 , pHelperTop( 0 ), pHelperBottom( 0 )
43 , mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
44 , mPrecision( Approximate )
45 , mApproximate( true )
57 int theDestRows,
int theDestCols,
58 double theMaxSrcXRes,
double theMaxSrcYRes,
61 , mSrcCRS( theSrcCRS )
62 , mDestCRS( theDestCRS )
63 , mSrcDatumTransform( -1 )
64 , mDestDatumTransform( -1 )
65 , mDestExtent( theDestExtent )
66 , mExtent( theExtent )
67 , mDestRows( theDestRows ), mDestCols( theDestCols )
68 , pHelperTop( 0 ), pHelperBottom( 0 )
69 , mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
70 , mPrecision( Approximate )
71 , mApproximate( false )
82 double theMaxSrcXRes,
double theMaxSrcYRes,
85 , mSrcCRS( theSrcCRS )
86 , mDestCRS( theDestCRS )
87 , mSrcDatumTransform( -1 )
88 , mDestDatumTransform( -1 )
89 , mExtent( theExtent )
98 , mDestRowsPerMatrixRow( 0.0 )
99 , mDestColsPerMatrixCol( 0.0 )
100 , pHelperTop( 0 ), pHelperBottom( 0 )
104 , mSqrTolerance( 0.0 )
105 , mMaxSrcXRes( theMaxSrcXRes )
106 , mMaxSrcYRes( theMaxSrcYRes )
107 , mPrecision( Approximate )
108 , mApproximate( false )
115 , mSrcDatumTransform( -1 )
116 , mDestDatumTransform( -1 )
125 , mDestRowsPerMatrixRow( 0.0 )
126 , mDestColsPerMatrixCol( 0.0 )
132 , mSqrTolerance( 0.0 )
135 , mPrecision( Approximate )
136 , mApproximate( false )
144 , pHelperBottom( NULL )
149 , mApproximate( true )
151 mSrcCRS = projector.mSrcCRS;
152 mDestCRS = projector.mDestCRS;
153 mSrcDatumTransform = projector.mSrcDatumTransform;
154 mDestDatumTransform = projector.mDestDatumTransform;
155 mMaxSrcXRes = projector.mMaxSrcXRes;
156 mMaxSrcYRes = projector.mMaxSrcYRes;
157 mExtent = projector.mExtent;
158 mDestRows = projector.mDestRows;
159 mDestCols = projector.mDestCols;
160 mDestXRes = projector.mDestXRes;
161 mDestYRes = projector.mDestYRes;
162 mSrcRows = projector.mSrcRows;
163 mSrcCols = projector.mSrcCols;
164 mSrcXRes = projector.mSrcXRes;
165 mSrcYRes = projector.mSrcYRes;
166 mDestRowsPerMatrixRow = projector.mDestRowsPerMatrixRow;
167 mDestColsPerMatrixCol = projector.mDestColsPerMatrixCol;
168 mPrecision = projector.mPrecision;
173 if ( &projector !=
this )
175 mSrcCRS = projector.mSrcCRS;
176 mDestCRS = projector.mDestCRS;
177 mSrcDatumTransform = projector.mSrcDatumTransform;
178 mDestDatumTransform = projector.mDestDatumTransform;
179 mMaxSrcXRes = projector.mMaxSrcXRes;
180 mMaxSrcYRes = projector.mMaxSrcYRes;
181 mExtent = projector.mExtent;
182 mPrecision = projector.mPrecision;
191 projector->mSrcDatumTransform = mSrcDatumTransform;
192 projector->mDestDatumTransform = mDestDatumTransform;
193 projector->mPrecision = mPrecision;
200 delete[] pHelperBottom;
220 mDestCRS = theDestCRS;
221 mSrcDatumTransform = srcDatumTransform;
222 mDestDatumTransform = destDatumTransform;
225 void QgsRasterProjector::calc()
229 mCPLegalMatrix.
clear();
232 delete[] pHelperBottom;
251 mExtent = provider->
extent();
256 mDestXRes = mDestExtent.
width() / ( mDestCols );
257 mDestYRes = mDestExtent.
height() / ( mDestRows );
263 double myDestRes = mDestXRes < mDestYRes ? mDestXRes : mDestYRes;
264 mSqrTolerance = myDestRes * myDestRes;
271 mCPCols = mCPRows = 3;
273 for (
int i = 0; i < mCPRows; i++ )
279 mCPMatrix.
insert( i, myRow );
282 myLegalRow.
append(
bool(
false ) );
283 myLegalRow.
append(
bool(
false ) );
284 myLegalRow.
append(
bool(
false ) );
285 mCPLegalMatrix.
insert( i, myLegalRow );
287 for (
int i = 0; i < mCPRows; i++ )
289 calcRow( i, inverseCt );
294 bool myColsOK = checkCols( inverseCt );
297 insertRows( inverseCt );
299 bool myRowsOK = checkRows( inverseCt );
302 insertCols( inverseCt );
304 if ( myColsOK && myRowsOK )
311 if ( mCPRows * mCPCols > 0.25 * mDestRows * mDestCols )
314 mApproximate =
false;
318 QgsDebugMsg(
QString(
"CPMatrix size: mCPRows = %1 mCPCols = %2" ).arg( mCPRows ).arg( mCPCols ) );
319 mDestRowsPerMatrixRow = ( float )mDestRows / ( mCPRows - 1 );
320 mDestColsPerMatrixCol = ( float )mDestCols / ( mCPCols - 1 );
326 pHelperTop =
new QgsPoint[mDestCols];
327 pHelperBottom =
new QgsPoint[mDestCols];
328 calcHelper( 0, pHelperTop );
329 calcHelper( 1, pHelperBottom );
334 mApproximate =
false;
339 mSrcYRes = mSrcExtent.
height() / mSrcRows;
340 mSrcXRes = mSrcExtent.
width() / mSrcCols;
343 void QgsRasterProjector::calcSrcExtent()
354 mSrcExtent =
QgsRectangle( myPoint.
x(), myPoint.
y(), myPoint.
x(), myPoint.
y() );
355 for (
int i = 0; i < mCPRows; i++ )
357 for (
int j = 0; j < mCPCols ; j++ )
359 myPoint = mCPMatrix[i][j];
360 if ( mCPLegalMatrix[i][j] )
375 mSrcExtent = mSrcExtent.
intersect( &mExtent );
388 if ( mMaxSrcXRes > 0 )
391 double col = floor(( mSrcExtent.
xMinimum() - mExtent.
xMinimum() ) / mMaxSrcXRes );
392 double x = mExtent.
xMinimum() + col * mMaxSrcXRes;
396 x = mExtent.
xMinimum() + col * mMaxSrcXRes;
399 if ( mMaxSrcYRes > 0 )
401 double row = floor(( mExtent.
yMaximum() - mSrcExtent.
yMaximum() ) / mMaxSrcYRes );
402 double y = mExtent.
yMaximum() - row * mMaxSrcYRes;
406 y = mExtent.
yMaximum() - row * mMaxSrcYRes;
413 QString QgsRasterProjector::cpToString()
416 for (
int i = 0; i < mCPRows; i++ )
420 for (
int j = 0; j < mCPCols; j++ )
425 if ( mCPLegalMatrix[i][j] )
438 void QgsRasterProjector::calcSrcRowsCols()
451 double myDestColsPerMatrixCell = ( double )mDestCols / mCPCols;
452 double myDestRowsPerMatrixCell = ( double )mDestRows / mCPRows;
453 QgsDebugMsg(
QString(
"myDestColsPerMatrixCell = %1 myDestRowsPerMatrixCell = %2" ).arg( myDestColsPerMatrixCell ).arg( myDestRowsPerMatrixCell ) );
454 for (
int i = 0; i < mCPRows - 1; i++ )
456 for (
int j = 0; j < mCPCols - 1; j++ )
458 QgsPoint myPointA = mCPMatrix[i][j];
459 QgsPoint myPointB = mCPMatrix[i][j+1];
460 QgsPoint myPointC = mCPMatrix[i+1][j];
461 if ( mCPLegalMatrix[i][j] && mCPLegalMatrix[i][j+1] && mCPLegalMatrix[i+1][j] )
463 double mySize = sqrt( myPointA.
sqrDist( myPointB ) ) / myDestColsPerMatrixCell;
464 if ( mySize < myMinSize )
467 mySize = sqrt( myPointA.
sqrDist( myPointC ) ) / myDestRowsPerMatrixCell;
468 if ( mySize < myMinSize )
480 int srcXSize, srcYSize;
481 if (
extentSize( inverseCt, mDestExtent, mDestCols, mDestRows, srcExtent, srcXSize, srcYSize ) )
483 double srcXRes = srcExtent.
width() / srcXSize;
484 double srcYRes = srcExtent.
height() / srcYSize;
485 myMinSize =
std::min( srcXRes, srcYRes );
498 QgsDebugMsg(
QString(
"mMaxSrcXRes = %1 mMaxSrcYRes = %2" ).arg( mMaxSrcXRes ).arg( mMaxSrcYRes ) );
500 double myMinXSize = mMaxSrcXRes > myMinSize ? mMaxSrcXRes : myMinSize;
501 double myMinYSize = mMaxSrcYRes > myMinSize ? mMaxSrcYRes : myMinSize;
502 QgsDebugMsg(
QString(
"myMinXSize = %1 myMinYSize = %2" ).arg( myMinXSize ).arg( myMinYSize ) );
506 mSrcRows = ( int ) qRound( mSrcExtent.
height() / myMinYSize );
507 mSrcCols = ( int ) qRound( mSrcExtent.
width() / myMinXSize );
509 QgsDebugMsg(
QString(
"mSrcRows = %1 mSrcCols = %2" ).arg( mSrcRows ).arg( mSrcCols ) );
513 inline void QgsRasterProjector::destPointOnCPMatrix(
int theRow,
int theCol,
double *theX,
double *theY )
515 *theX = mDestExtent.
xMinimum() + theCol * mDestExtent.
width() / ( mCPCols - 1 );
516 *theY = mDestExtent.
yMaximum() - theRow * mDestExtent.
height() / ( mCPRows - 1 );
519 inline int QgsRasterProjector::matrixRow(
int theDestRow )
521 return (
int )( floor(( theDestRow + 0.5 ) / mDestRowsPerMatrixRow ) );
523 inline int QgsRasterProjector::matrixCol(
int theDestCol )
525 return (
int )( floor(( theDestCol + 0.5 ) / mDestColsPerMatrixCol ) );
528 QgsPoint QgsRasterProjector::srcPoint(
int theDestRow,
int theCol )
530 Q_UNUSED( theDestRow );
535 void QgsRasterProjector::calcHelper(
int theMatrixRow,
QgsPoint *thePoints )
538 for (
int myDestCol = 0; myDestCol < mDestCols; myDestCol++ )
540 double myDestX = mDestExtent.
xMinimum() + ( myDestCol + 0.5 ) * mDestXRes;
542 int myMatrixCol = matrixCol( myDestCol );
544 double myDestXMin, myDestYMin, myDestXMax, myDestYMax;
546 destPointOnCPMatrix( theMatrixRow, myMatrixCol, &myDestXMin, &myDestYMin );
547 destPointOnCPMatrix( theMatrixRow, myMatrixCol + 1, &myDestXMax, &myDestYMax );
549 double xfrac = ( myDestX - myDestXMin ) / ( myDestXMax - myDestXMin );
551 QgsPoint &mySrcPoint0 = mCPMatrix[theMatrixRow][myMatrixCol];
552 QgsPoint &mySrcPoint1 = mCPMatrix[theMatrixRow][myMatrixCol+1];
553 double s = mySrcPoint0.
x() + ( mySrcPoint1.
x() - mySrcPoint0.
x() ) * xfrac;
554 double t = mySrcPoint0.
y() + ( mySrcPoint1.
y() - mySrcPoint0.
y() ) * xfrac;
556 thePoints[myDestCol].
setX( s );
557 thePoints[myDestCol].
setY( t );
560 void QgsRasterProjector::nextHelper()
565 pHelperTop = pHelperBottom;
567 calcHelper( mHelperTopRow + 2, pHelperBottom );
571 bool QgsRasterProjector::srcRowCol(
int theDestRow,
int theDestCol,
int *theSrcRow,
int *theSrcCol,
const QgsCoordinateTransform* ct )
575 return approximateSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol );
579 return preciseSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol, ct );
583 bool QgsRasterProjector::preciseSrcRowCol(
int theDestRow,
int theDestCol,
int *theSrcRow,
int *theSrcCol,
const QgsCoordinateTransform* ct )
587 QgsDebugMsgLevel(
QString(
"theDestRow = %1 mDestExtent.yMaximum() = %2 mDestYRes = %3" ).arg( theDestRow ).arg( mDestExtent.
yMaximum() ).arg( mDestYRes ), 5 );
591 double x = mDestExtent.
xMinimum() + ( theDestCol + 0.5 ) * mDestXRes;
592 double y = mDestExtent.
yMaximum() - ( theDestRow + 0.5 ) * mDestYRes;
613 *theSrcRow = ( int ) floor(( mSrcExtent.
yMaximum() - y ) / mSrcYRes );
614 *theSrcCol = ( int ) floor(( x - mSrcExtent.
xMinimum() ) / mSrcXRes );
624 if ( *theSrcRow >= mSrcRows )
return false;
625 if ( *theSrcRow < 0 )
return false;
626 if ( *theSrcCol >= mSrcCols )
return false;
627 if ( *theSrcCol < 0 )
return false;
632 bool QgsRasterProjector::approximateSrcRowCol(
int theDestRow,
int theDestCol,
int *theSrcRow,
int *theSrcCol )
634 int myMatrixRow = matrixRow( theDestRow );
635 int myMatrixCol = matrixCol( theDestCol );
637 if ( myMatrixRow > mHelperTopRow )
643 double myDestY = mDestExtent.
yMaximum() - ( theDestRow + 0.5 ) * mDestYRes;
647 double myDestXMin, myDestYMin, myDestXMax, myDestYMax;
649 destPointOnCPMatrix( myMatrixRow + 1, myMatrixCol, &myDestXMin, &myDestYMin );
650 destPointOnCPMatrix( myMatrixRow, myMatrixCol + 1, &myDestXMax, &myDestYMax );
652 double yfrac = ( myDestY - myDestYMin ) / ( myDestYMax - myDestYMin );
654 QgsPoint &myTop = pHelperTop[theDestCol];
655 QgsPoint &myBot = pHelperBottom[theDestCol];
661 double tx = myTop.
x();
662 double ty = myTop.
y();
663 double bx = myBot.
x();
664 double by = myBot.
y();
665 double mySrcX = bx + ( tx - bx ) * yfrac;
666 double mySrcY = by + ( ty - by ) * yfrac;
675 *theSrcRow = ( int ) floor(( mSrcExtent.
yMaximum() - mySrcY ) / mSrcYRes );
676 *theSrcCol = ( int ) floor(( mySrcX - mSrcExtent.
xMinimum() ) / mSrcXRes );
681 if ( *theSrcRow >= mSrcRows )
return false;
682 if ( *theSrcRow < 0 )
return false;
683 if ( *theSrcCol >= mSrcCols )
return false;
684 if ( *theSrcCol < 0 )
return false;
691 for (
int r = 0; r < mCPRows - 1; r++ )
695 for (
int c = 0; c < mCPCols; c++ )
698 myLegalRow.
append(
false );
701 mCPMatrix.
insert( 1 + r*2, myRow );
702 mCPLegalMatrix.
insert( 1 + r*2, myLegalRow );
704 mCPRows += mCPRows - 1;
705 for (
int r = 1; r < mCPRows - 1; r += 2 )
713 for (
int r = 0; r < mCPRows; r++ )
717 for (
int c = 0; c < mCPCols - 1; c++ )
720 mCPLegalMatrix[r].
insert( 1 + c*2,
false );
723 mCPCols += mCPCols - 1;
724 for (
int c = 1; c < mCPCols - 1; c += 2 )
733 double myDestX, myDestY;
734 destPointOnCPMatrix( theRow, theCol, &myDestX, &myDestY );
735 QgsPoint myDestPoint( myDestX, myDestY );
740 mCPMatrix[theRow][theCol] = ct->
transform( myDestPoint );
741 mCPLegalMatrix[theRow][theCol] =
true;
745 mCPLegalMatrix[theRow][theCol] =
false;
752 mCPLegalMatrix[theRow][theCol] =
false;
759 for (
int i = 0; i < mCPCols; i++ )
761 calcCP( theRow, i, ct );
770 for (
int i = 0; i < mCPRows; i++ )
772 calcCP( i, theCol, ct );
785 for (
int c = 0; c < mCPCols; c++ )
787 for (
int r = 1; r < mCPRows - 1; r += 2 )
789 double myDestX, myDestY;
790 destPointOnCPMatrix( r, c, &myDestX, &myDestY );
791 QgsPoint myDestPoint( myDestX, myDestY );
793 QgsPoint mySrcPoint1 = mCPMatrix[r-1][c];
794 QgsPoint mySrcPoint2 = mCPMatrix[r][c];
795 QgsPoint mySrcPoint3 = mCPMatrix[r+1][c];
797 QgsPoint mySrcApprox(( mySrcPoint1.
x() + mySrcPoint3.
x() ) / 2, ( mySrcPoint1.
y() + mySrcPoint3.
y() ) / 2 );
798 if ( !mCPLegalMatrix[r-1][c] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r+1][c] )
806 double mySqrDist = myDestApprox.
sqrDist( myDestPoint );
807 if ( mySqrDist > mSqrTolerance )
830 for (
int r = 0; r < mCPRows; r++ )
832 for (
int c = 1; c < mCPCols - 1; c += 2 )
834 double myDestX, myDestY;
835 destPointOnCPMatrix( r, c, &myDestX, &myDestY );
837 QgsPoint myDestPoint( myDestX, myDestY );
838 QgsPoint mySrcPoint1 = mCPMatrix[r][c-1];
839 QgsPoint mySrcPoint2 = mCPMatrix[r][c];
840 QgsPoint mySrcPoint3 = mCPMatrix[r][c+1];
842 QgsPoint mySrcApprox(( mySrcPoint1.
x() + mySrcPoint3.
x() ) / 2, ( mySrcPoint1.
y() + mySrcPoint3.
y() ) / 2 );
843 if ( !mCPLegalMatrix[r][c-1] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r][c+1] )
851 double mySqrDist = myDestApprox.
sqrDist( myDestPoint );
852 if ( mySqrDist > mSqrTolerance )
873 return tr(
"Approximate" );
875 return tr(
"Exact" );
890 if ( ! mSrcCRS.
isValid() || ! mDestCRS.
isValid() || mSrcCRS == mDestCRS )
893 return mInput->
block( bandNo, extent, width, height );
902 QgsDebugMsg(
QString(
"srcCols = %1 srcRows = %2" ).arg( srcCols() ).arg( srcRows() ) );
905 if ( srcRows() <= 0 || srcCols() <= 0 )
912 if ( !inputBlock || inputBlock->
isEmpty() )
930 if ( !outputBlock->isValid() )
958 outputBlock->setIsNoData();
961 for (
int i = 0; i < height; ++i )
963 for (
int j = 0; j < width; ++j )
965 bool inside = srcRowCol( i, j, &srcRow, &srcCol, inverseCt );
966 if ( !inside )
continue;
969 QgsDebugMsgLevel(
QString(
"row = %1 col = %2 srcRow = %3 srcCol = %4" ).arg( i ).arg( j ).arg( srcRow ).arg( srcCol ), 5 );
972 if ( doNoData && inputBlock->
isNoData( srcRow, srcCol ) )
974 outputBlock->setIsNoData( i, j );
979 char *srcBits = inputBlock->
bits( srcIndex );
980 char *destBits = outputBlock->bits( destIndex );
983 QgsDebugMsg(
QString(
"Cannot get input block data: row = %1 col = %2" ).arg( i ).arg( j ) );
988 QgsDebugMsg(
QString(
"Cannot set output block data: srcRow = %1 srcCol = %2" ).arg( srcRow ).arg( srcCol ) );
991 memcpy( destBits, srcBits, pixelSize );
992 outputBlock->setIsData( i, j );
1002 QgsRectangle& theDestExtent,
int& theDestXSize,
int& theDestYSize )
1004 if ( theSrcExtent.
isEmpty() || theSrcXSize <= 0 || theSrcYSize <= 0 )
1010 return extentSize( ct, theSrcExtent, theSrcXSize, theSrcYSize, theDestExtent, theDestXSize, theDestYSize );
1014 const QgsRectangle& theSrcExtent,
int theSrcXSize,
int theSrcYSize,
1015 QgsRectangle& theDestExtent,
int& theDestXSize,
int& theDestYSize )
1017 if ( theSrcExtent.
isEmpty() || theSrcXSize <= 0 || theSrcYSize <= 0 )
1026 double srcXStep = theSrcExtent.
width() / 3;
1027 double srcYStep = theSrcExtent.
height() / 3;
1028 double srcXRes = theSrcExtent.
width() / theSrcXSize;
1029 double srcYRes = theSrcExtent.
height() / theSrcYSize;
1033 for (
int i = 0; i < 3; i++ )
1035 double x = theSrcExtent.
xMinimum() + i * srcXStep;
1036 for (
int j = 0; j < 3; j++ )
1038 double y = theSrcExtent.
yMinimum() + j * srcYStep;
1039 QgsRectangle srcRectangle( x - srcXRes / 2, y - srcYRes / 2, x + srcXRes / 2, y + srcYRes / 2 );
1041 if ( destRectangle.
width() > 0 )
1045 if ( destRectangle.
height() > 0 )
1051 theDestXSize =
std::max( 1, (
int )( theDestExtent.
width() / destYRes ) );
1052 theDestYSize =
std::max( 1, (
int )( theDestExtent.
height() / destYRes ) );
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
bool isEmpty() const
test if rectangle is empty.
void setCRS(const QgsCoordinateReferenceSystem &theSrcCRS, const QgsCoordinateReferenceSystem &theDestCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
set source and destination CRS
void setXMaximum(double x)
Set the maximum x value.
Approximate (default), fast but possibly inaccurate.
double yMaximum() const
Get the y maximum value (top side of rectangle)
static bool typeIsNumeric(QGis::DataType type)
Returns true if data type is numeric.
bool contains(const QgsRectangle &rect) const
return true when rectangle contains other rectangle
virtual const QgsRasterInterface * srcInput() const
Get source / raw input, the first in pipe, usually provider.
double noDataValue() const
Return no data value.
QGis::DataType dataType() const
Returns data type.
double sqrDist(double x, double y) const
Returns the squared distance between this point and x,y.
bool isNoData(int row, int column)
Check if value at position is no data.
virtual int ySize() const
bool setIsNoData(int row, int column)
Set no data on pixel.
void combineExtentWith(QgsRectangle *rect)
expand the rectangle so that covers both the original rectangle and the given rectangle ...
void append(const T &value)
~QgsRasterProjector()
The destructor.
bool hasNoData() const
Returns true if the block may contain no data.
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height) override
Read block of data using given extent and size.
double xMaximum() const
Get the x maximum value (right side of rectangle)
#define QgsDebugMsgLevel(str, level)
void setYMinimum(double y)
Set the minimum y value.
QString toString() const
String representation of the point (x,y)
static int typeSize(int dataType)
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
QgsRasterInterface * clone() const override
Clone itself, create deep copy.
Base class for processing filters like renderers, reprojector, resampler etc.
A class to represent a point.
unsigned long long qgssize
qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
virtual QgsRectangle extent() override=0
Get the extent of the data source.
virtual QgsRectangle extent()
Get the extent of the interface.
bool hasNoDataValue() const
True if the block has no data value.
char * bits(int row, int column)
Get pointer to data.
Precision
Precison defines if each pixel is reprojected or approximate reprojection based on an approximation m...
virtual int xSize() const
Get raster size.
void insert(int i, const T &value)
void setYMaximum(double y)
Set the maximum y value.
QgsRectangle intersect(const QgsRectangle *rect) const
return the intersection with the given rectangle
Class for storing a coordinate reference system (CRS)
DataType
Raster data types.
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height)=0
Read block of data using given extent and size.
static bool extentSize(const QgsCoordinateTransform *ct, const QgsRectangle &theSrcExtent, int theSrcXSize, int theSrcYSize, QgsRectangle &theDestExtent, int &theDestXSize, int &theDestYSize)
Calculate destination extent and size from source extent and size.
Custom exception class for Coordinate Reference System related exceptions.
QGis::DataType dataType(int bandNo) const override
Returns data type for the band specified by number.
double width() const
Width of the rectangle.
bool destExtentSize(const QgsRectangle &theSrcExtent, int theSrcXSize, int theSrcYSize, QgsRectangle &theDestExtent, int &theDestXSize, int &theDestYSize)
Calculate destination extent and size from source extent and size.
QgsRasterInterface * mInput
QgsRasterProjector & operator=(const QgsRasterProjector &projector)
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
double xMinimum() const
Get the x minimum value (left side of rectangle)
static QString precisionLabel(Precision precision)
void setXMinimum(double x)
Set the minimum x value.
double height() const
Height of the rectangle.
bool isEmpty() const
Returns true if block is empty, i.e.
int bandCount() const override
Get number of bands.
Base class for raster data providers.