16#ifndef QGSALIGNRASTER_H
17#define QGSALIGNRASTER_H
23#include <gdal_version.h>
24#include "qgis_analysis.h"
48#include <gdal_version.h>
65 bool isValid()
const {
return nullptr != mDataset; }
68 QString
crs()
const {
return mCrsWkt; }
70 QSize
rasterSize()
const {
return QSize( mXSize, mYSize ); }
74 QSizeF cellSize()
const;
76 QPointF gridOffset()
const;
80 QPointF origin()
const;
86 double identify(
double mx,
double my );
94 double mGeoTransform[6];
112 typedef QList<QgsAlignRasterData::RasterItem>
List;
138 void setGridOffset( QPointF offset ) { mGridOffsetX = offset.x(); mGridOffsetY = offset.y(); }
139 QPointF
gridOffset()
const {
return QPointF( mGridOffsetX, mGridOffsetY ); }
144 void setCellSize( QSizeF size ) { mCellSizeX = size.width(); mCellSizeY = size.height(); }
146 QSizeF
cellSize()
const {
return QSizeF( mCellSizeX, mCellSizeY ); }
157 void setClipExtent(
double xmin,
double ymin,
double xmax,
double ymax );
182 bool setParametersFromRaster(
const RasterInfo &rasterInfo,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
188 bool setParametersFromRaster(
const QString &filename,
const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
194 bool checkInputParameters();
200 QSize alignedRasterSize()
const;
224 int suggestedReferenceLayer()
const;
229 bool createAndWarp(
const Item &raster );
232 static bool suggestedWarpOutput(
const RasterInfo &info,
const QString &destWkt, QSizeF *cellSize =
nullptr, QPointF *gridOffset =
nullptr,
QgsRectangle *rect =
nullptr );
258 double mClipExtent[4];
263 double mGeoTransform[6];
GdalResampleAlgorithm
Flags which control how tiled scene 2D renderers behave.
QgsAlignRaster takes one or more raster layers and warps (resamples) them so they have the same:
ProgressHandler * progressHandler() const
Gets associated progress handler. May be nullptr (default)
int mYSize
Computed raster grid height.
QSizeF cellSize() const
Gets output cell size.
QPointF gridOffset() const
double mGridOffsetX
Destination grid offset - expected to be in interval <0,cellsize)
void setCellSize(QSizeF size)
Sets output cell size.
List mRasters
List of rasters to be aligned (with their output files and other options)
void setDestinationCrs(const QString &crsWkt)
Sets the output CRS in WKT format.
void setGridOffset(QPointF offset)
List rasters() const
Gets list of rasters that will be aligned.
QString mCrsWkt
Destination CRS - stored in well-known text (WKT) format.
int mXSize
Computed raster grid width.
QString destinationCrs() const
Gets the output CRS in WKT format.
double mCellSizeX
Destination cell size.
void setProgressHandler(ProgressHandler *progressHandler)
Assign a progress handler instance. Does not take ownership. nullptr can be passed.
QList< QgsAlignRasterData::RasterItem > List
QString errorMessage() const
Returns the error from a previous run() call.
QgsAlignRasterData::RasterItem Item
void setRasters(const List &list)
Sets list of rasters that will be aligned.
void setCellSize(double x, double y)
Sets output cell size.
QString mErrorMessage
Last error message from run()
Qgis::GdalResampleAlgorithm ResampleAlg
A rectangle specified with double values.
std::unique_ptr< std::remove_pointer< GDALDatasetH >::type, GDALDatasetCloser > dataset_unique_ptr
Scoped GDAL dataset.
Definition of one raster layer for alignment.
Helper struct to be sub-classed for progress reporting.
virtual ~ProgressHandler()=default
virtual bool progress(double complete)=0
Method to be overridden for progress reporting.
Utility class for gathering information about rasters.
QString crs() const
Returns the CRS in WKT format.
gdal::dataset_unique_ptr mDataset
handle to open GDAL dataset
int bandCount() const
Returns the number of raster bands in the file.
QSize rasterSize() const
Returns the size of the raster grid in pixels.
RasterInfo(const RasterInfo &rh)=delete
RasterInfo & operator=(const RasterInfo &rh)=delete
bool isValid() const
Check whether the given path is a valid raster.
QString mCrsWkt
CRS stored in WKT format.