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( nullptr ), pHelperBottom( nullptr )
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( nullptr ), pHelperBottom( nullptr )
69 , mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
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( nullptr ), pHelperBottom( nullptr )
104 , mSqrTolerance( 0.0 )
105 , mMaxSrcXRes( theMaxSrcXRes )
106 , mMaxSrcYRes( theMaxSrcYRes )
108 , mApproximate( false )
115 , mSrcDatumTransform( -1 )
116 , mDestDatumTransform( -1 )
125 , mDestRowsPerMatrixRow( 0.0 )
126 , mDestColsPerMatrixCol( 0.0 )
127 , pHelperTop( nullptr )
128 , pHelperBottom( nullptr )
132 , mSqrTolerance( 0.0 )
136 , mApproximate( false )
143 , pHelperTop( nullptr )
144 , pHelperBottom( nullptr )
149 , mApproximate( false )
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();
231 pHelperTop =
nullptr;
232 delete[] pHelperBottom;
233 pHelperBottom =
nullptr;
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;
274 mApproximate =
false;
279 mCPCols = mCPRows = 3;
280 for (
int i = 0; i < mCPRows; i++ )
286 mCPMatrix.
insert( i, myRow );
289 myLegalRow.
append(
bool(
false ) );
290 myLegalRow.
append(
bool(
false ) );
291 myLegalRow.
append(
bool(
false ) );
292 mCPLegalMatrix.
insert( i, myLegalRow );
294 for (
int i = 0; i < mCPRows; i++ )
296 calcRow( i, inverseCt );
301 bool myColsOK = checkCols( inverseCt );
304 insertRows( inverseCt );
306 bool myRowsOK = checkRows( inverseCt );
309 insertCols( inverseCt );
311 if ( myColsOK && myRowsOK )
318 if ( mCPRows * mCPCols > 0.25 * mDestRows * mDestCols )
322 mApproximate =
false;
327 mDestRowsPerMatrixRow =
static_cast< float >( mDestRows ) / ( mCPRows - 1 );
328 mDestColsPerMatrixCol =
static_cast< float >( mDestCols ) / ( mCPCols - 1 );
334 pHelperTop =
new QgsPoint[mDestCols];
335 pHelperBottom =
new QgsPoint[mDestCols];
336 calcHelper( 0, pHelperTop );
337 calcHelper( 1, pHelperBottom );
343 mSrcYRes = mSrcExtent.
height() / mSrcRows;
344 mSrcXRes = mSrcExtent.
width() / mSrcCols;
347 void QgsRasterProjector::calcSrcExtent()
358 mSrcExtent =
QgsRectangle( myPoint.
x(), myPoint.
y(), myPoint.
x(), myPoint.
y() );
359 for (
int i = 0; i < mCPRows; i++ )
361 for (
int j = 0; j < mCPCols ; j++ )
363 myPoint = mCPMatrix[i][j];
364 if ( mCPLegalMatrix[i][j] )
373 mSrcExtent = mSrcExtent.
intersect( &mExtent );
386 if ( mMaxSrcXRes > 0 )
389 double col = floor(( mSrcExtent.
xMinimum() - mExtent.
xMinimum() ) / mMaxSrcXRes );
390 double x = mExtent.
xMinimum() + col * mMaxSrcXRes;
394 x = mExtent.
xMinimum() + col * mMaxSrcXRes;
397 if ( mMaxSrcYRes > 0 )
399 double row = floor(( mExtent.
yMaximum() - mSrcExtent.
yMaximum() ) / mMaxSrcYRes );
400 double y = mExtent.
yMaximum() - row * mMaxSrcYRes;
404 y = mExtent.
yMaximum() - row * mMaxSrcYRes;
411 QString QgsRasterProjector::cpToString()
414 for (
int i = 0; i < mCPRows; i++ )
418 for (
int j = 0; j < mCPCols; j++ )
423 if ( mCPLegalMatrix[i][j] )
436 void QgsRasterProjector::calcSrcRowsCols()
449 double myDestColsPerMatrixCell =
static_cast< double >( mDestCols ) / mCPCols;
450 double myDestRowsPerMatrixCell =
static_cast< double >( mDestRows ) / mCPRows;
451 QgsDebugMsgLevel(
QString(
"myDestColsPerMatrixCell = %1 myDestRowsPerMatrixCell = %2" ).arg( myDestColsPerMatrixCell ).arg( myDestRowsPerMatrixCell ), 4 );
452 for (
int i = 0; i < mCPRows - 1; i++ )
454 for (
int j = 0; j < mCPCols - 1; j++ )
456 QgsPoint myPointA = mCPMatrix[i][j];
457 QgsPoint myPointB = mCPMatrix[i][j+1];
458 QgsPoint myPointC = mCPMatrix[i+1][j];
459 if ( mCPLegalMatrix[i][j] && mCPLegalMatrix[i][j+1] && mCPLegalMatrix[i+1][j] )
461 double mySize = sqrt( myPointA.
sqrDist( myPointB ) ) / myDestColsPerMatrixCell;
462 if ( mySize < myMinSize )
465 mySize = sqrt( myPointA.
sqrDist( myPointC ) ) / myDestRowsPerMatrixCell;
466 if ( mySize < myMinSize )
478 int srcXSize, srcYSize;
479 if (
extentSize( inverseCt, mDestExtent, mDestCols, mDestRows, srcExtent, srcXSize, srcYSize ) )
481 double srcXRes = srcExtent.
width() / srcXSize;
482 double srcYRes = srcExtent.
height() / srcYSize;
483 myMinSize =
std::min( srcXRes, srcYRes );
498 double myMinXSize = mMaxSrcXRes > myMinSize ? mMaxSrcXRes : myMinSize;
499 double myMinYSize = mMaxSrcYRes > myMinSize ? mMaxSrcYRes : myMinSize;
504 mSrcRows =
static_cast< int >( qRound( mSrcExtent.
height() / myMinYSize ) );
505 mSrcCols =
static_cast< int >( qRound( mSrcExtent.
width() / myMinXSize ) );
511 inline void QgsRasterProjector::destPointOnCPMatrix(
int theRow,
int theCol,
double *theX,
double *theY )
513 *theX = mDestExtent.
xMinimum() + theCol * mDestExtent.
width() / ( mCPCols - 1 );
514 *theY = mDestExtent.
yMaximum() - theRow * mDestExtent.
height() / ( mCPRows - 1 );
517 inline int QgsRasterProjector::matrixRow(
int theDestRow )
519 return static_cast< int >( floor(( theDestRow + 0.5 ) / mDestRowsPerMatrixRow ) );
521 inline int QgsRasterProjector::matrixCol(
int theDestCol )
523 return static_cast< int >( floor(( theDestCol + 0.5 ) / mDestColsPerMatrixCol ) );
526 QgsPoint QgsRasterProjector::srcPoint(
int theDestRow,
int theCol )
528 Q_UNUSED( theDestRow );
533 void QgsRasterProjector::calcHelper(
int theMatrixRow,
QgsPoint *thePoints )
536 for (
int myDestCol = 0; myDestCol < mDestCols; myDestCol++ )
538 double myDestX = mDestExtent.
xMinimum() + ( myDestCol + 0.5 ) * mDestXRes;
540 int myMatrixCol = matrixCol( myDestCol );
542 double myDestXMin, myDestYMin, myDestXMax, myDestYMax;
544 destPointOnCPMatrix( theMatrixRow, myMatrixCol, &myDestXMin, &myDestYMin );
545 destPointOnCPMatrix( theMatrixRow, myMatrixCol + 1, &myDestXMax, &myDestYMax );
547 double xfrac = ( myDestX - myDestXMin ) / ( myDestXMax - myDestXMin );
549 QgsPoint &mySrcPoint0 = mCPMatrix[theMatrixRow][myMatrixCol];
550 QgsPoint &mySrcPoint1 = mCPMatrix[theMatrixRow][myMatrixCol+1];
551 double s = mySrcPoint0.
x() + ( mySrcPoint1.
x() - mySrcPoint0.
x() ) * xfrac;
552 double t = mySrcPoint0.
y() + ( mySrcPoint1.
y() - mySrcPoint0.
y() ) * xfrac;
554 thePoints[myDestCol].
setX( s );
555 thePoints[myDestCol].
setY( t );
558 void QgsRasterProjector::nextHelper()
563 pHelperTop = pHelperBottom;
565 calcHelper( mHelperTopRow + 2, pHelperBottom );
569 bool QgsRasterProjector::srcRowCol(
int theDestRow,
int theDestCol,
int *theSrcRow,
int *theSrcCol,
const QgsCoordinateTransform* ct )
573 return approximateSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol );
577 return preciseSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol, ct );
581 bool QgsRasterProjector::preciseSrcRowCol(
int theDestRow,
int theDestCol,
int *theSrcRow,
int *theSrcCol,
const QgsCoordinateTransform* ct )
585 QgsDebugMsgLevel(
QString(
"theDestRow = %1 mDestExtent.yMaximum() = %2 mDestYRes = %3" ).arg( theDestRow ).arg( mDestExtent.
yMaximum() ).arg( mDestYRes ), 5 );
589 double x = mDestExtent.
xMinimum() + ( theDestCol + 0.5 ) * mDestXRes;
590 double y = mDestExtent.
yMaximum() - ( theDestRow + 0.5 ) * mDestYRes;
611 *theSrcRow =
static_cast< int >( floor(( mSrcExtent.
yMaximum() - y ) / mSrcYRes ) );
612 *theSrcCol =
static_cast< int >( floor(( x - mSrcExtent.
xMinimum() ) / mSrcXRes ) );
622 if ( *theSrcRow >= mSrcRows )
return false;
623 if ( *theSrcRow < 0 )
return false;
624 if ( *theSrcCol >= mSrcCols )
return false;
625 if ( *theSrcCol < 0 )
return false;
630 bool QgsRasterProjector::approximateSrcRowCol(
int theDestRow,
int theDestCol,
int *theSrcRow,
int *theSrcCol )
632 int myMatrixRow = matrixRow( theDestRow );
633 int myMatrixCol = matrixCol( theDestCol );
635 if ( myMatrixRow > mHelperTopRow )
641 double myDestY = mDestExtent.
yMaximum() - ( theDestRow + 0.5 ) * mDestYRes;
645 double myDestXMin, myDestYMin, myDestXMax, myDestYMax;
647 destPointOnCPMatrix( myMatrixRow + 1, myMatrixCol, &myDestXMin, &myDestYMin );
648 destPointOnCPMatrix( myMatrixRow, myMatrixCol + 1, &myDestXMax, &myDestYMax );
650 double yfrac = ( myDestY - myDestYMin ) / ( myDestYMax - myDestYMin );
652 QgsPoint &myTop = pHelperTop[theDestCol];
653 QgsPoint &myBot = pHelperBottom[theDestCol];
659 double tx = myTop.
x();
660 double ty = myTop.
y();
661 double bx = myBot.
x();
662 double by = myBot.
y();
663 double mySrcX = bx + ( tx - bx ) * yfrac;
664 double mySrcY = by + ( ty - by ) * yfrac;
673 *theSrcRow =
static_cast< int >( floor(( mSrcExtent.
yMaximum() - mySrcY ) / mSrcYRes ) );
674 *theSrcCol =
static_cast< int >( floor(( mySrcX - mSrcExtent.
xMinimum() ) / mSrcXRes ) );
679 if ( *theSrcRow >= mSrcRows )
return false;
680 if ( *theSrcRow < 0 )
return false;
681 if ( *theSrcCol >= mSrcCols )
return false;
682 if ( *theSrcCol < 0 )
return false;
689 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++ )
715 for (
int c = 0; c < mCPCols - 1; c++ )
718 mCPLegalMatrix[r].
insert( 1 + c*2,
false );
721 mCPCols += mCPCols - 1;
722 for (
int c = 1; c < mCPCols - 1; c += 2 )
731 double myDestX, myDestY;
732 destPointOnCPMatrix( theRow, theCol, &myDestX, &myDestY );
733 QgsPoint myDestPoint( myDestX, myDestY );
738 mCPMatrix[theRow][theCol] = ct->
transform( myDestPoint );
739 mCPLegalMatrix[theRow][theCol] =
true;
743 mCPLegalMatrix[theRow][theCol] =
false;
750 mCPLegalMatrix[theRow][theCol] =
false;
757 for (
int i = 0; i < mCPCols; i++ )
759 calcCP( theRow, i, ct );
768 for (
int i = 0; i < mCPRows; i++ )
770 calcCP( i, theCol, ct );
783 for (
int c = 0; c < mCPCols; c++ )
785 for (
int r = 1; r < mCPRows - 1; r += 2 )
787 double myDestX, myDestY;
788 destPointOnCPMatrix( r, c, &myDestX, &myDestY );
789 QgsPoint myDestPoint( myDestX, myDestY );
791 QgsPoint mySrcPoint1 = mCPMatrix[r-1][c];
792 QgsPoint mySrcPoint2 = mCPMatrix[r][c];
793 QgsPoint mySrcPoint3 = mCPMatrix[r+1][c];
795 QgsPoint mySrcApprox(( mySrcPoint1.
x() + mySrcPoint3.
x() ) / 2, ( mySrcPoint1.
y() + mySrcPoint3.
y() ) / 2 );
796 if ( !mCPLegalMatrix[r-1][c] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r+1][c] )
804 double mySqrDist = myDestApprox.
sqrDist( myDestPoint );
805 if ( mySqrDist > mSqrTolerance )
828 for (
int r = 0; r < mCPRows; r++ )
830 for (
int c = 1; c < mCPCols - 1; c += 2 )
832 double myDestX, myDestY;
833 destPointOnCPMatrix( r, c, &myDestX, &myDestY );
835 QgsPoint myDestPoint( myDestX, myDestY );
836 QgsPoint mySrcPoint1 = mCPMatrix[r][c-1];
837 QgsPoint mySrcPoint2 = mCPMatrix[r][c];
838 QgsPoint mySrcPoint3 = mCPMatrix[r][c+1];
840 QgsPoint mySrcApprox(( mySrcPoint1.
x() + mySrcPoint3.
x() ) / 2, ( mySrcPoint1.
y() + mySrcPoint3.
y() ) / 2 );
841 if ( !mCPLegalMatrix[r][c-1] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r][c+1] )
849 double mySqrDist = myDestApprox.
sqrDist( myDestPoint );
850 if ( mySqrDist > mSqrTolerance )
871 return tr(
"Approximate" );
873 return tr(
"Exact" );
888 if ( ! mSrcCRS.
isValid() || ! mDestCRS.
isValid() || mSrcCRS == mDestCRS )
891 return mInput->
block( bandNo, extent, width, height );
903 if ( srcRows() <= 0 || srcCols() <= 0 )
910 if ( !inputBlock || inputBlock->
isEmpty() )
928 if ( !outputBlock->isValid() )
956 outputBlock->setIsNoData();
959 for (
int i = 0; i < height; ++i )
961 for (
int j = 0; j < width; ++j )
963 bool inside = srcRowCol( i, j, &srcRow, &srcCol, inverseCt );
964 if ( !inside )
continue;
966 qgssize srcIndex =
static_cast< qgssize >( srcRow ) * mSrcCols + srcCol;
967 QgsDebugMsgLevel(
QString(
"row = %1 col = %2 srcRow = %3 srcCol = %4" ).arg( i ).arg( j ).arg( srcRow ).arg( srcCol ), 5 );
970 if ( doNoData && inputBlock->
isNoData( srcRow, srcCol ) )
972 outputBlock->setIsNoData( i, j );
977 char *srcBits = inputBlock->
bits( srcIndex );
978 char *destBits = outputBlock->bits( destIndex );
981 QgsDebugMsg(
QString(
"Cannot get input block data: row = %1 col = %2" ).arg( i ).arg( j ) );
986 QgsDebugMsg(
QString(
"Cannot set output block data: srcRow = %1 srcCol = %2" ).arg( srcRow ).arg( srcCol ) );
989 memcpy( destBits, srcBits, pixelSize );
990 outputBlock->setIsData( i, j );
1000 QgsRectangle& theDestExtent,
int& theDestXSize,
int& theDestYSize )
1002 if ( theSrcExtent.
isEmpty() || theSrcXSize <= 0 || theSrcYSize <= 0 )
1008 return extentSize( ct, theSrcExtent, theSrcXSize, theSrcYSize, theDestExtent, theDestXSize, theDestYSize );
1012 const QgsRectangle& theSrcExtent,
int theSrcXSize,
int theSrcYSize,
1013 QgsRectangle& theDestExtent,
int& theDestXSize,
int& theDestYSize )
1015 if ( theSrcExtent.
isEmpty() || theSrcXSize <= 0 || theSrcYSize <= 0 )
1024 double srcXStep = theSrcExtent.
width() / 3;
1025 double srcYStep = theSrcExtent.
height() / 3;
1026 double srcXRes = theSrcExtent.
width() / theSrcXSize;
1027 double srcYRes = theSrcExtent.
height() / theSrcYSize;
1031 for (
int i = 0; i < 3; i++ )
1033 double x = theSrcExtent.
xMinimum() + i * srcXStep;
1034 for (
int j = 0; j < 3; j++ )
1036 double y = theSrcExtent.
yMinimum() + j * srcYStep;
1037 QgsRectangle srcRectangle( x - srcXRes / 2, y - srcYRes / 2, x + srcXRes / 2, y + srcYRes / 2 );
1039 if ( destRectangle.
width() > 0 )
1043 if ( destRectangle.
height() > 0 )
1049 theDestXSize =
std::max( 1, static_cast< int >( theDestExtent.
width() / destYRes ) );
1050 theDestYSize =
std::max( 1, static_cast< int >( theDestExtent.
height() / destYRes ) );
virtual int bandCount() const =0
Get number of bands.
A rectangle specified with double values.
Precision precision() const
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
Unknown or unspecified type.
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.
double x() const
Get the x value of the point.
virtual int ySize() const
bool setIsNoData(int row, int column)
Set no data on pixel.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
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.
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...
void setX(double x)
Sets the x value of the point.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
void setY(double y)
Sets the y value of the point.
virtual QgsRectangle extent() override=0
Get the extent of the data source.
virtual QgsRectangle extent()
Get the extent of the interface.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
bool hasNoDataValue() const
True if the block has no data value.
char * bits(int row, int column)
Get pointer to data.
QgsRasterProjector * clone() const override
Clone itself, create deep copy.
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.
QString authid() const
Returns the authority identifier for the CRS, which includes both the authority (eg EPSG) and the CRS...
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.
double y() const
Get the y value of the point.
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 ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
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.