16 #ifndef QGSALIGNRASTER_H 17 #define QGSALIGNRASTER_H 23 #include <gdal_version.h> 24 #include "qgis_analysis.h" 46 #include <gdal_version.h> 63 bool isValid()
const {
return nullptr != mDataset; }
66 QString
crs()
const {
return mCrsWkt; }
68 QSize
rasterSize()
const {
return QSize( mXSize, mYSize ); }
72 QSizeF cellSize()
const;
74 QPointF gridOffset()
const;
78 QPointF origin()
const;
84 double identify(
double mx,
double my );
92 double mGeoTransform[6];
132 Item(
const QString &input,
const QString &output )
133 : inputFilename( input )
134 , outputFilename( output )
135 , resampleMethod( RA_NearestNeighbour )
136 , rescaleValues( false )
137 , srcCellSizeInDestCRS( 0.0 )
154 typedef QList<QgsAlignRaster::Item>
List;
165 virtual bool progress(
double complete ) = 0;
180 void setGridOffset( QPointF offset ) { mGridOffsetX = offset.x(); mGridOffsetY = offset.y(); }
181 QPointF
gridOffset()
const {
return QPointF( mGridOffsetX, mGridOffsetY ); }
186 void setCellSize( QSizeF size ) { mCellSizeX = size.width(); mCellSizeY = size.height(); }
188 QSizeF
cellSize()
const {
return QSizeF( mCellSizeX, mCellSizeY ); }
199 void setClipExtent(
double xmin,
double ymin,
double xmax,
double ymax );
224 bool setParametersFromRaster(
const RasterInfo &rasterInfo,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
230 bool setParametersFromRaster(
const QString &filename,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
236 bool checkInputParameters();
242 QSize alignedRasterSize()
const;
266 int suggestedReferenceLayer()
const;
271 bool createAndWarp(
const Item &raster );
274 static bool suggestedWarpOutput(
const RasterInfo &info,
const QString &destWkt, QSizeF *cellSize =
nullptr, QPointF *gridOffset =
nullptr,
QgsRectangle *rect =
nullptr );
300 double mClipExtent[4];
305 double mGeoTransform[6];
315 #endif // QGSALIGNRASTER_H A rectangle specified with double values.
QPointF gridOffset() const
QSizeF cellSize() const
Gets output cell size.
gdal::dataset_unique_ptr mDataset
handle to open GDAL dataset
bool rescaleValues
rescaling of values according to the change of pixel size
Nearest neighbour (select on one input pixel)
List mRasters
List of rasters to be aligned (with their output files and other options)
Mode (selects the value which appears most often of all the sampled points)
QString outputFilename
filename of the newly created aligned raster (will be overwritten if exists already) ...
Median (selects the median of all non-NODATA contributing pixels)
Cubic Convolution Approximation (4x4 kernel)
int mYSize
Computed raster grid height.
void setCellSize(QSizeF size)
Sets output cell size.
void setDestinationCrs(const QString &crsWkt)
Sets the output CRS in WKT format.
void setRasters(const List &list)
Sets list of rasters that will be aligned.
ProgressHandler * progressHandler() const
Gets associated progress handler. May be nullptr (default)
QSize rasterSize() const
Returns the size of the raster grid in pixels.
Definition of one raster layer for alignment.
QgsAlignRaster takes one or more raster layers and warps (resamples) them so they have the same: ...
Helper struct to be sub-classed for progress reporting.
double srcCellSizeInDestCRS
used for rescaling of values (if necessary)
void setGridOffset(QPointF offset)
bool isValid() const
Check whether the given path is a valid raster.
Third quartile (selects the third quartile of all non-NODATA contributing pixels) ...
QString mCrsWkt
CRS stored in WKT format.
ResampleAlg
Resampling algorithm to be used (equivalent to GDAL's enum GDALResampleAlg)
QString destinationCrs() const
Gets the output CRS in WKT format.
Average (computes the average of all non-NODATA contributing pixels)
int mXSize
Computed raster grid width.
int bandCount() const
Returns the number of raster bands in the file.
Maximum (selects the maximum of all non-NODATA contributing pixels)
QList< QgsAlignRaster::Item > List
QString errorMessage() const
Returns the error from a previous run() call.
Item(const QString &input, const QString &output)
First quartile (selects the first quartile of all non-NODATA contributing pixels) ...
void setProgressHandler(ProgressHandler *progressHandler)
Assign a progress handler instance. Does not take ownership. nullptr can be passed.
void setCellSize(double x, double y)
Sets output cell size.
QString mErrorMessage
Last error message from run()
Cubic B-Spline Approximation (4x4 kernel)
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
QgsAlignRaster::ResampleAlg resampleMethod
resampling method to be used
QString inputFilename
filename of the source raster
Lanczos windowed sinc interpolation (6x6 kernel)
QString crs() const
Returns the CRS in WKT format.
Minimum (selects the minimum of all non-NODATA contributing pixels)
List rasters() const
Gets list of rasters that will be aligned.
Utility class for gathering information about rasters.
QString mCrsWkt
Destination CRS - stored in well-known text (WKT) format.