22#include "moc_qgsrasterprojector.cpp"
39 projector->mSrcCRS = mSrcCRS;
40 projector->mDestCRS = mDestCRS;
41 projector->mTransformContext = mTransformContext;
44 projector->mSrcDatumTransform = mSrcDatumTransform;
45 projector->mDestDatumTransform = mDestDatumTransform;
48 projector->mPrecision = mPrecision;
71 int srcDatumTransform,
72 int destDatumTransform )
77 mSrcDatumTransform = srcDatumTransform;
78 mDestDatumTransform = destDatumTransform;
86 mTransformContext = transformContext;
88 mSrcDatumTransform = -1;
89 mDestDatumTransform = -1;
95 : mApproximate( false )
96 , mInverseCt( inverseCt )
97 , mDestExtent( extent )
106 , mDestRowsPerMatrixRow( 0.0 )
107 , mDestColsPerMatrixCol( 0.0 )
111 , mSqrTolerance( 0.0 )
134 if ( mExtent.isEmpty() )
136 mExtent = provider->
extent();
141 mDestXRes = mDestExtent.
width() / ( mDestCols );
142 mDestYRes = mDestExtent.height() / ( mDestRows );
148 const double myDestRes = mDestXRes < mDestYRes ? mDestXRes : mDestYRes;
149 mSqrTolerance = myDestRes * myDestRes;
157 mApproximate =
false;
162 mCPCols = mCPRows = 3;
170 if ( std::fabs( -mDestExtent.yMinimum() - mDestExtent.yMaximum() ) / height < 0.5 * mDestYRes )
173 for (
int i = 0; i < mCPRows; i++ )
175 QList<QgsPointXY> myRow;
179 mCPMatrix.insert( i, myRow );
181 QList<bool> myLegalRow;
182 myLegalRow.append(
bool(
false ) );
183 myLegalRow.append(
bool(
false ) );
184 myLegalRow.append(
bool(
false ) );
185 mCPLegalMatrix.insert( i, myLegalRow );
187 for (
int i = 0; i < mCPRows; i++ )
189 calcRow( i, inverseCt );
194 const bool myColsOK = checkCols( inverseCt );
197 insertRows( inverseCt );
199 const bool myRowsOK = checkRows( inverseCt );
202 insertCols( inverseCt );
204 if ( myColsOK && myRowsOK )
211 if ( mCPRows * mCPCols > 0.25 * mDestRows * mDestCols )
215 mApproximate =
false;
223 QgsDebugMsgLevel( QStringLiteral(
"CPMatrix size: mCPRows = %1 mCPCols = %2" ).arg( mCPRows ).arg( mCPCols ), 4 );
224 mDestRowsPerMatrixRow =
static_cast< double >( mDestRows ) / ( mCPRows - 1 );
225 mDestColsPerMatrixCol =
static_cast< double >( mDestCols ) / ( mCPCols - 1 );
235 calcHelper( 0, pHelperTop );
236 calcHelper( 1, pHelperBottom );
242 mSrcYRes = mSrcExtent.height() / mSrcRows;
243 mSrcXRes = mSrcExtent.width() / mSrcCols;
246ProjectorData::~ProjectorData()
249 delete[] pHelperBottom;
253void ProjectorData::calcSrcExtent()
264 mSrcExtent =
QgsRectangle( myPoint.
x(), myPoint.
y(), myPoint.
x(), myPoint.
y() );
265 for (
int i = 0; i < mCPRows; i++ )
267 for (
int j = 0; j < mCPCols ; j++ )
269 myPoint = mCPMatrix[i][j];
270 if ( mCPLegalMatrix[i][j] )
272 mSrcExtent.combineExtentWith( myPoint.
x(), myPoint.
y() );
279 mSrcExtent = mSrcExtent.intersect( mExtent );
290 if ( !mExtent.isEmpty() )
292 if ( mMaxSrcXRes > 0 )
295 double col = std::floor( ( mSrcExtent.xMinimum() - mExtent.xMinimum() ) / mMaxSrcXRes );
296 double x = mExtent.xMinimum() + col * mMaxSrcXRes;
297 mSrcExtent.setXMinimum( x );
299 col = std::ceil( ( mSrcExtent.xMaximum() - mExtent.xMinimum() ) / mMaxSrcXRes );
300 x = mExtent.xMinimum() + col * mMaxSrcXRes;
301 mSrcExtent.setXMaximum( x );
303 if ( mMaxSrcYRes > 0 )
305 double row = std::floor( ( mExtent.yMaximum() - mSrcExtent.yMaximum() ) / mMaxSrcYRes );
306 double y = mExtent.yMaximum() - row * mMaxSrcYRes;
307 mSrcExtent.setYMaximum( y );
309 row = std::ceil( ( mExtent.yMaximum() - mSrcExtent.yMinimum() ) / mMaxSrcYRes );
310 y = mExtent.yMaximum() - row * mMaxSrcYRes;
311 mSrcExtent.setYMinimum( y );
317QString ProjectorData::cpToString()
const
320 for (
int i = 0; i < mCPRows; i++ )
324 for (
int j = 0; j < mCPCols; j++ )
327 myString += QLatin1String(
" " );
329 if ( mCPLegalMatrix[i][j] )
335 myString += QLatin1String(
"(-,-)" );
342void ProjectorData::calcSrcRowsCols()
350 double myMinSize = std::numeric_limits<double>::max();
354 double myMaxSize = 0;
357 const double myDestColsPerMatrixCell =
static_cast< double >( mDestCols ) / mCPCols;
358 const double myDestRowsPerMatrixCell =
static_cast< double >( mDestRows ) / mCPRows;
359 QgsDebugMsgLevel( QStringLiteral(
"myDestColsPerMatrixCell = %1 myDestRowsPerMatrixCell = %2" ).arg( myDestColsPerMatrixCell ).arg( myDestRowsPerMatrixCell ), 4 );
360 for (
int i = 0; i < mCPRows - 1; i++ )
362 for (
int j = 0; j < mCPCols - 1; j++ )
365 const QgsPointXY myPointB = mCPMatrix[i][j + 1];
366 const QgsPointXY myPointC = mCPMatrix[i + 1][j];
367 if ( mCPLegalMatrix[i][j] && mCPLegalMatrix[i][j + 1] && mCPLegalMatrix[i + 1][j] )
369 double mySize = std::sqrt( myPointA.
sqrDist( myPointB ) ) / myDestColsPerMatrixCell;
370 if ( mySize < myMinSize )
372 if ( mySize > myMaxSize )
375 mySize = std::sqrt( myPointA.
sqrDist( myPointC ) ) / myDestRowsPerMatrixCell;
376 if ( mySize < myMinSize )
378 if ( mySize > myMaxSize )
386 if ( myMinSize < 0.1 * myMaxSize )
387 myMinSize = 0.1 * myMaxSize;
394 int srcXSize, srcYSize;
397 const double srcXRes = srcExtent.
width() / srcXSize;
398 const double srcYRes = srcExtent.
height() / srcYSize;
399 myMinSize = std::min( srcXRes, srcYRes );
403 QgsDebugError( QStringLiteral(
"Cannot get src extent/size" ) );
412 QgsDebugMsgLevel( QStringLiteral(
"mMaxSrcXRes = %1 mMaxSrcYRes = %2" ).arg( mMaxSrcXRes ).arg( mMaxSrcYRes ), 4 );
414 const double myMinXSize = mMaxSrcXRes > myMinSize ? mMaxSrcXRes : myMinSize;
415 const double myMinYSize = mMaxSrcYRes > myMinSize ? mMaxSrcYRes : myMinSize;
416 QgsDebugMsgLevel( QStringLiteral(
"myMinXSize = %1 myMinYSize = %2" ).arg( myMinXSize ).arg( myMinYSize ), 4 );
417 QgsDebugMsgLevel( QStringLiteral(
"mSrcExtent.width = %1 mSrcExtent.height = %2" ).arg( mSrcExtent.width() ).arg( mSrcExtent.height() ), 4 );
422 double dblSrcRows = mSrcExtent.height() / myMinYSize;
423 if ( dblSrcRows > mDestRows * 10 )
424 mSrcRows = mDestRows * 10;
426 mSrcRows =
static_cast< int >( std::round( dblSrcRows ) );
428 double dblSrcCols = mSrcExtent.width() / myMinXSize;
429 if ( dblSrcCols > mDestCols * 10 )
430 mSrcCols = mDestCols * 10;
432 mSrcCols =
static_cast< int >( std::round( dblSrcCols ) );
434 QgsDebugMsgLevel( QStringLiteral(
"mSrcRows = %1 mSrcCols = %2" ).arg( mSrcRows ).arg( mSrcCols ), 4 );
438inline void ProjectorData::destPointOnCPMatrix(
int row,
int col,
double *theX,
double *theY )
440 *theX = mDestExtent.xMinimum() + col * mDestExtent.width() / ( mCPCols - 1 );
441 *theY = mDestExtent.yMaximum() - row * mDestExtent.height() / ( mCPRows - 1 );
444inline int ProjectorData::matrixRow(
int destRow )
446 return static_cast< int >( std::floor( ( destRow + 0.5 ) / mDestRowsPerMatrixRow ) );
448inline int ProjectorData::matrixCol(
int destCol )
450 return static_cast< int >( std::floor( ( destCol + 0.5 ) / mDestColsPerMatrixCol ) );
453void ProjectorData::calcHelper(
int matrixRow,
QgsPointXY *points )
456 for (
int myDestCol = 0; myDestCol < mDestCols; myDestCol++ )
458 const double myDestX = mDestExtent.xMinimum() + ( myDestCol + 0.5 ) * mDestXRes;
460 const int myMatrixCol = matrixCol( myDestCol );
462 double myDestXMin, myDestYMin, myDestXMax, myDestYMax;
464 destPointOnCPMatrix( matrixRow, myMatrixCol, &myDestXMin, &myDestYMin );
465 destPointOnCPMatrix( matrixRow, myMatrixCol + 1, &myDestXMax, &myDestYMax );
467 const double xfrac = ( myDestX - myDestXMin ) / ( myDestXMax - myDestXMin );
469 const QgsPointXY &mySrcPoint0 = mCPMatrix[matrixRow][myMatrixCol];
470 const QgsPointXY &mySrcPoint1 = mCPMatrix[matrixRow][myMatrixCol + 1];
471 const double s = mySrcPoint0.
x() + ( mySrcPoint1.
x() - mySrcPoint0.
x() ) * xfrac;
472 const double t = mySrcPoint0.
y() + ( mySrcPoint1.
y() - mySrcPoint0.
y() ) * xfrac;
474 points[myDestCol].
setX( s );
475 points[myDestCol].
setY( t );
479void ProjectorData::nextHelper()
484 pHelperTop = pHelperBottom;
486 calcHelper( mHelperTopRow + 2, pHelperBottom );
490bool ProjectorData::srcRowCol(
int destRow,
int destCol,
int *srcRow,
int *srcCol )
494 return approximateSrcRowCol( destRow, destCol, srcRow, srcCol );
498 return preciseSrcRowCol( destRow, destCol, srcRow, srcCol );
502bool ProjectorData::preciseSrcRowCol(
int destRow,
int destCol,
int *srcRow,
int *srcCol )
506 QgsDebugMsgLevel( QStringLiteral(
"theDestRow = %1 mDestExtent.yMaximum() = %2 mDestYRes = %3" ).arg( destRow ).arg( mDestExtent.yMaximum() ).arg( mDestYRes ), 5 );
510 double x = mDestExtent.xMinimum() + ( destCol + 0.5 ) * mDestXRes;
511 double y = mDestExtent.yMaximum() - ( destRow + 0.5 ) * mDestYRes;
518 if ( mInverseCt.isValid() )
522 mInverseCt.transformInPlace( x, y, z );
534 if ( !mExtent.contains( x, y ) )
539 *srcRow =
static_cast< int >( std::floor( ( mSrcExtent.yMaximum() - y ) / mSrcYRes ) );
540 *srcCol =
static_cast< int >( std::floor( ( x - mSrcExtent.xMinimum() ) / mSrcXRes ) );
542 QgsDebugMsgLevel( QStringLiteral(
"mSrcExtent.yMinimum() = %1 mSrcExtent.yMaximum() = %2 mSrcYRes = %3" ).arg( mSrcExtent.yMinimum() ).arg( mSrcExtent.yMaximum() ).arg( mSrcYRes ), 5 );
543 QgsDebugMsgLevel( QStringLiteral(
"theSrcRow = %1 srcCol = %2" ).arg( *srcRow ).arg( *srcCol ), 5 );
550 if ( *srcRow >= mSrcRows )
return false;
551 if ( *srcRow < 0 )
return false;
552 if ( *srcCol >= mSrcCols )
return false;
553 if ( *srcCol < 0 )
return false;
558bool ProjectorData::approximateSrcRowCol(
int destRow,
int destCol,
int *srcRow,
int *srcCol )
560 const int myMatrixRow = matrixRow( destRow );
561 const int myMatrixCol = matrixCol( destCol );
563 if ( myMatrixRow > mHelperTopRow )
569 const double myDestY = mDestExtent.yMaximum() - ( destRow + 0.5 ) * mDestYRes;
573 double myDestXMin, myDestYMin, myDestXMax, myDestYMax;
575 destPointOnCPMatrix( myMatrixRow + 1, myMatrixCol, &myDestXMin, &myDestYMin );
576 destPointOnCPMatrix( myMatrixRow, myMatrixCol + 1, &myDestXMax, &myDestYMax );
578 const double yfrac = ( myDestY - myDestYMin ) / ( myDestYMax - myDestYMin );
580 const QgsPointXY &myTop = pHelperTop[destCol];
581 const QgsPointXY &myBot = pHelperBottom[destCol];
587 const double tx = myTop.
x();
588 const double ty = myTop.
y();
589 const double bx = myBot.
x();
590 const double by = myBot.
y();
591 const double mySrcX = bx + ( tx - bx ) * yfrac;
592 const double mySrcY = by + ( ty - by ) * yfrac;
594 if ( !mExtent.contains( mySrcX, mySrcY ) )
601 *srcRow =
static_cast< int >( std::floor( ( mSrcExtent.yMaximum() - mySrcY ) / mSrcYRes ) );
602 *srcCol =
static_cast< int >( std::floor( ( mySrcX - mSrcExtent.xMinimum() ) / mSrcXRes ) );
607 if ( *srcRow >= mSrcRows )
return false;
608 if ( *srcRow < 0 )
return false;
609 if ( *srcCol >= mSrcCols )
return false;
610 if ( *srcCol < 0 )
return false;
617 for (
int r = 0; r < mCPRows - 1; r++ )
619 QList<QgsPointXY> myRow;
620 QList<bool> myLegalRow;
621 myRow.reserve( mCPCols );
622 myLegalRow.reserve( mCPCols );
623 for (
int c = 0;
c < mCPCols; ++
c )
626 myLegalRow.append(
false );
628 QgsDebugMsgLevel( QStringLiteral(
"insert new row at %1" ).arg( 1 + r * 2 ), 3 );
629 mCPMatrix.insert( 1 + r * 2, myRow );
630 mCPLegalMatrix.insert( 1 + r * 2, myLegalRow );
632 mCPRows += mCPRows - 1;
633 for (
int r = 1; r < mCPRows - 1; r += 2 )
641 for (
int r = 0; r < mCPRows; r++ )
643 for (
int c = 0;
c < mCPCols - 1;
c++ )
646 mCPLegalMatrix[r].insert( 1 +
c * 2,
false );
649 mCPCols += mCPCols - 1;
650 for (
int c = 1;
c < mCPCols - 1;
c += 2 )
659 double myDestX, myDestY;
660 destPointOnCPMatrix( row, col, &myDestX, &myDestY );
661 const QgsPointXY myDestPoint( myDestX, myDestY );
666 mCPMatrix[row][col] = ct.
transform( myDestPoint );
667 mCPLegalMatrix[row][col] =
true;
671 mCPLegalMatrix[row][col] =
false;
678 mCPLegalMatrix[row][col] =
false;
685 for (
int i = 0; i < mCPCols; i++ )
687 calcCP( row, i, ct );
696 for (
int i = 0; i < mCPRows; i++ )
698 calcCP( i, col, ct );
711 for (
int c = 0;
c < mCPCols;
c++ )
713 for (
int r = 1; r < mCPRows - 1; r += 2 )
715 double myDestX, myDestY;
716 destPointOnCPMatrix( r,
c, &myDestX, &myDestY );
717 const QgsPointXY myDestPoint( myDestX, myDestY );
719 const QgsPointXY mySrcPoint1 = mCPMatrix[r - 1][
c];
721 const QgsPointXY mySrcPoint3 = mCPMatrix[r + 1][
c];
723 const QgsPointXY mySrcApprox( ( mySrcPoint1.
x() + mySrcPoint3.
x() ) / 2, ( mySrcPoint1.
y() + mySrcPoint3.
y() ) / 2 );
724 if ( !mCPLegalMatrix[r - 1][
c] || !mCPLegalMatrix[r][
c] || !mCPLegalMatrix[r + 1][
c] )
732 const double mySqrDist = myDestApprox.
sqrDist( myDestPoint );
733 if ( mySqrDist > mSqrTolerance )
756 for (
int r = 0; r < mCPRows; r++ )
758 for (
int c = 1;
c < mCPCols - 1;
c += 2 )
760 double myDestX, myDestY;
761 destPointOnCPMatrix( r,
c, &myDestX, &myDestY );
763 const QgsPointXY myDestPoint( myDestX, myDestY );
764 const QgsPointXY mySrcPoint1 = mCPMatrix[r][
c - 1];
766 const QgsPointXY mySrcPoint3 = mCPMatrix[r][
c + 1];
768 const QgsPointXY mySrcApprox( ( mySrcPoint1.
x() + mySrcPoint3.
x() ) / 2, ( mySrcPoint1.
y() + mySrcPoint3.
y() ) / 2 );
769 if ( !mCPLegalMatrix[r][
c - 1] || !mCPLegalMatrix[r][
c] || !mCPLegalMatrix[r][
c + 1] )
777 const double mySqrDist = myDestApprox.
sqrDist( myDestPoint );
778 if ( mySqrDist > mSqrTolerance )
802 return tr(
"Approximate" );
804 return tr(
"Exact" );
806 return QStringLiteral(
"Unknown" );
812 QgsDebugMsgLevel( QStringLiteral(
"width = %1 height = %2" ).arg( width ).arg( height ), 4 );
822 if ( ! mSrcCRS.
isValid() || ! mDestCRS.
isValid() || mSrcCRS == mDestCRS )
833 ProjectorData pd(
extent, width, height,
mInput, inverseCt, mPrecision, feedback );
838 QgsDebugMsgLevel( QStringLiteral(
"srcExtent:\n%1" ).arg( pd.srcExtent().toString() ), 4 );
839 QgsDebugMsgLevel( QStringLiteral(
"srcCols = %1 srcRows = %2" ).arg( pd.srcCols() ).arg( pd.srcRows() ), 4 );
842 if ( pd.srcRows() <= 0 || pd.srcCols() <= 0 )
848 std::unique_ptr< QgsRasterBlock > inputBlock(
mInput->
block( bandNo, pd.srcExtent(), pd.srcCols(), pd.srcRows(), feedback ) );
858 std::unique_ptr< QgsRasterBlock > outputBlock = std::make_unique< QgsRasterBlock >(
input->
dataType(), width, height );
861 if (
input->hasNoDataValue() )
868 return outputBlock.release();
887 for (
int i = 0; i < height; ++i )
891 for (
int j = 0; j < width; ++j )
893 const bool inside = pd.srcRowCol( i, j, &srcRow, &srcCol );
894 if ( !inside )
continue;
896 const qgssize srcIndex =
static_cast< qgssize >( srcRow ) * pd.srcCols() + srcCol;
899 if ( doNoData &&
input->isNoData( srcRow, srcCol ) )
904 const qgssize destIndex =
static_cast< qgssize >( i ) * width + j;
905 const char *srcBits =
input->constBits( srcIndex );
906 char *destBits = output->
bits( destIndex );
917 memcpy( destBits, srcBits, pixelSize );
922 return outputBlock.release();
926 QgsRectangle &destExtent,
int &destXSize,
int &destYSize )
928 if ( srcExtent.
isEmpty() || srcXSize <= 0 || srcYSize <= 0 )
938 return extentSize( ct, srcExtent, srcXSize, srcYSize, destExtent, destXSize, destYSize );
942 const QgsRectangle &srcExtent,
int srcXSize,
int srcYSize,
943 QgsRectangle &destExtent,
int &destXSize,
int &destYSize )
945 if ( srcExtent.
isEmpty() || srcXSize <= 0 || srcYSize <= 0 )
957 constexpr int steps = 3;
958 const double srcXStep = srcExtent.
width() / steps;
959 const double srcYStep = srcExtent.
height() / steps;
960 const double srcXRes = srcExtent.
width() / srcXSize;
961 const double srcYRes = srcExtent.
height() / srcYSize;
962 double destXRes = std::numeric_limits<double>::max();
963 double destYRes = std::numeric_limits<double>::max();
967 for (
int i = 0; i < steps; i++ )
969 const double x = srcExtent.
xMinimum() + i * srcXStep;
970 for (
int j = 0; j < steps; j++ )
972 const double y = srcExtent.
yMinimum() + j * srcYStep;
973 const QgsRectangle srcRectangle( x - srcXRes / 2, y - srcYRes / 2, x + srcXRes / 2, y + srcYRes / 2 );
977 if ( destRectangle.
width() > 0 )
979 destXRes = std::min( destXRes, destRectangle.
width() );
980 if ( destRectangle.
width() > maxXRes )
981 maxXRes = destRectangle.
width();
983 if ( destRectangle.
height() > 0 )
985 destYRes = std::min( destYRes, destRectangle.
height() );
986 if ( destRectangle.
height() > maxYRes )
987 maxYRes = destRectangle.
height();
1000 if ( destXRes < 0.1 * maxXRes )
1002 destXRes = 0.1 * maxXRes;
1004 if ( destYRes < 0.1 * maxYRes )
1006 destYRes = 0.1 * maxYRes;
1008 if ( destXRes == 0 || destExtent.
width() / destXRes > std::numeric_limits<int>::max() )
1010 if ( destYRes == 0 || destExtent.
height() / destYRes > std::numeric_limits<int>::max() )
1013 destXSize = std::max( 1,
static_cast< int >( destExtent.
width() / destXRes ) );
1014 destYSize = std::max( 1,
static_cast< int >( destExtent.
height() / destYRes ) );
@ ProviderHintCanPerformProviderResampling
Provider can perform resampling (to be opposed to post rendering resampling)
@ Size
Original data source size (and thus resolution) is known, it is not always available,...
DataType
Raster data types.
@ UnknownDataType
Unknown or unspecified type.
@ Reverse
Reverse/inverse transform (from destination to source)
This class represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
bool isCanceled() const
Tells whether the operation has been canceled already.
A class to represent a 2D point.
QString toString(int precision=-1) const
Returns a string representation of the point (x, y) with a preset precision.
double sqrDist(double x, double y) const
Returns the squared distance between this point a specified x, y coordinate.
void setY(double y)
Sets the y value of the point.
void setX(double x)
Sets the x value of the point.
Feedback object tailored for raster block reading.
bool isValid() const
Returns true if the block is valid (correctly filled with data).
static bool typeIsNumeric(Qgis::DataType type)
Returns true if data type is numeric.
char * bits(int row, int column)
Returns a pointer to block data.
static int typeSize(Qgis::DataType dataType)
Returns the size in bytes for the specified dataType.
void setIsData(int row, int column)
Remove no data flag on pixel.
void setNoDataValue(double noDataValue)
Sets cell value that will be considered as "no data".
bool setIsNoData(int row, int column)
Set no data on pixel.
Base class for raster data providers.
QgsRectangle extent() const override=0
Returns the extent of the layer.
virtual Qgis::RasterProviderCapabilities providerCapabilities() const
Returns flags containing the supported capabilities of the data provider.
Base class for processing filters like renderers, reprojector, resampler etc.
virtual Qgis::RasterInterfaceCapabilities capabilities() const
Returns the capabilities supported by the interface.
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
Read block of data using given extent and size.
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
virtual int xSize() const
Gets raster size.
virtual int bandCount() const =0
Gets number of bands.
QgsRasterInterface * mInput
virtual int ySize() const
virtual QgsRectangle extent() const
Gets the extent of the interface.
virtual QgsRasterInterface * input() const
Current input.
virtual const QgsRasterInterface * sourceInput() const
Gets source / raw input, the first in pipe, usually provider.
Implements approximate projection support for optimised raster transformation.
QgsRasterProjector * clone() const override
Clone itself, create deep copy.
bool destExtentSize(const QgsRectangle &srcExtent, int srcXSize, int srcYSize, QgsRectangle &destExtent, int &destXSize, int &destYSize)
Calculate destination extent and size from source extent and size.
static QString precisionLabel(Precision precision)
Qgis::DataType dataType(int bandNo) const override
Returns data type for the band specified by number.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
static bool extentSize(const QgsCoordinateTransform &ct, const QgsRectangle &srcExtent, int srcXSize, int srcYSize, QgsRectangle &destExtent, int &destXSize, int &destYSize)
Calculate destination extent and size from source extent and size.
Precision
Precision defines if each pixel is reprojected or approximate reprojection based on an approximation ...
@ Exact
Exact, precise but slow.
@ Approximate
Approximate (default), fast but possibly inaccurate.
Precision precision() const
int bandCount() const override
Gets number of bands.
Q_DECL_DEPRECATED void setCrs(const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
Sets the source and destination CRS.
A rectangle specified with double values.
Q_INVOKABLE QString toString(int precision=16) const
Returns a string representation of form xmin,ymin : xmax,ymax Coordinates will be truncated to the sp...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define Q_NOWARN_DEPRECATED_POP
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...
#define Q_NOWARN_DEPRECATED_PUSH
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)