mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
300 lines
7.4 KiB
Plaintext
300 lines
7.4 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/analysis/raster/qgsalignraster.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsAlignRaster
|
|
{
|
|
%Docstring
|
|
QgsAlignRaster takes one or more raster layers and warps (resamples) them
|
|
so they have the same:
|
|
|
|
- coordinate reference system
|
|
- cell size and raster size
|
|
- offset of the raster grid
|
|
|
|
.. versionadded:: 2.12
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsalignraster.h"
|
|
#include <gdal_version.h>
|
|
%End
|
|
public:
|
|
QgsAlignRaster();
|
|
|
|
struct RasterInfo
|
|
{
|
|
public:
|
|
RasterInfo( const QString &layerpath );
|
|
%Docstring
|
|
Construct raster info with a path to a raster file
|
|
%End
|
|
|
|
|
|
bool isValid() const;
|
|
%Docstring
|
|
Check whether the given path is a valid raster
|
|
%End
|
|
|
|
QString crs() const;
|
|
%Docstring
|
|
Returns the CRS in WKT format
|
|
%End
|
|
QSize rasterSize() const;
|
|
%Docstring
|
|
Returns the size of the raster grid in pixels
|
|
%End
|
|
int bandCount() const;
|
|
%Docstring
|
|
Returns the number of raster bands in the file
|
|
%End
|
|
QSizeF cellSize() const;
|
|
%Docstring
|
|
Returns the cell size in map units
|
|
%End
|
|
QPointF gridOffset() const;
|
|
%Docstring
|
|
Returns the grid offset
|
|
%End
|
|
QgsRectangle extent() const;
|
|
%Docstring
|
|
Returns the extent of the raster
|
|
%End
|
|
QPointF origin() const;
|
|
%Docstring
|
|
Returns the origin of the raster
|
|
%End
|
|
|
|
void dump() const;
|
|
%Docstring
|
|
Write contents of the object to standard error stream - for debugging
|
|
%End
|
|
|
|
double identify( double mx, double my );
|
|
%Docstring
|
|
Gets raster value at the given coordinates (from the first band)
|
|
%End
|
|
|
|
protected:
|
|
|
|
private:
|
|
RasterInfo( const QgsAlignRaster::RasterInfo &rh );
|
|
};
|
|
|
|
|
|
enum ResampleAlg
|
|
{
|
|
RA_NearestNeighbour,
|
|
RA_Bilinear,
|
|
RA_Cubic,
|
|
RA_CubicSpline,
|
|
RA_Lanczos,
|
|
RA_Average,
|
|
RA_Mode,
|
|
RA_Max,
|
|
RA_Min,
|
|
RA_Median,
|
|
RA_Q1,
|
|
RA_Q3,
|
|
};
|
|
|
|
struct Item
|
|
{
|
|
Item( const QString &input, const QString &output );
|
|
|
|
QString inputFilename;
|
|
QString outputFilename;
|
|
QgsAlignRaster::ResampleAlg resampleMethod;
|
|
bool rescaleValues;
|
|
|
|
|
|
double srcCellSizeInDestCRS;
|
|
};
|
|
typedef QList<QgsAlignRaster::Item> List;
|
|
|
|
struct ProgressHandler
|
|
{
|
|
|
|
virtual bool progress( double complete ) = 0;
|
|
%Docstring
|
|
Method to be overridden for progress reporting.
|
|
|
|
:param complete: Overall progress of the alignment operation
|
|
|
|
:return: ``False`` if the execution should be canceled, ``True`` otherwise
|
|
%End
|
|
|
|
virtual ~ProgressHandler();
|
|
};
|
|
|
|
void setProgressHandler( ProgressHandler *progressHandler );
|
|
%Docstring
|
|
Assign a progress handler instance. Does not take ownership. ``None`` can be passed.
|
|
%End
|
|
ProgressHandler *progressHandler() const;
|
|
%Docstring
|
|
Gets associated progress handler. May be ``None`` (default)
|
|
%End
|
|
|
|
void setRasters( const List &list );
|
|
%Docstring
|
|
Sets list of rasters that will be aligned
|
|
%End
|
|
List rasters() const;
|
|
%Docstring
|
|
Gets list of rasters that will be aligned
|
|
%End
|
|
|
|
void setGridOffset( QPointF offset );
|
|
QPointF gridOffset() const;
|
|
|
|
void setCellSize( double x, double y );
|
|
%Docstring
|
|
Sets output cell size
|
|
%End
|
|
void setCellSize( QSizeF size );
|
|
%Docstring
|
|
Sets output cell size
|
|
%End
|
|
QSizeF cellSize() const;
|
|
%Docstring
|
|
Gets output cell size
|
|
%End
|
|
|
|
void setDestinationCrs( const QString &crsWkt );
|
|
%Docstring
|
|
Sets the output CRS in WKT format
|
|
%End
|
|
QString destinationCrs() const;
|
|
%Docstring
|
|
Gets the output CRS in WKT format
|
|
%End
|
|
|
|
void setClipExtent( double xmin, double ymin, double xmax, double ymax );
|
|
%Docstring
|
|
Configure clipping extent (region of interest).
|
|
No extra clipping is done if the rectangle is null
|
|
%End
|
|
|
|
void setClipExtent( const QgsRectangle &extent );
|
|
%Docstring
|
|
Configure clipping extent (region of interest).
|
|
No extra clipping is done if the rectangle is null
|
|
%End
|
|
|
|
QgsRectangle clipExtent() const;
|
|
%Docstring
|
|
Gets clipping extent (region of interest).
|
|
No extra clipping is done if the rectangle is null
|
|
%End
|
|
|
|
bool setParametersFromRaster( const RasterInfo &rasterInfo, const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
|
|
%Docstring
|
|
Set destination CRS, cell size and grid offset from a raster file.
|
|
The user may provide custom values for some of the parameters - in such case
|
|
only the remaining parameters are calculated.
|
|
|
|
If default CRS is used, the parameters are set according to the raster file's geo-transform.
|
|
If a custom CRS is provided, suggested reprojection is calculated first (using GDAL) in order
|
|
to determine suitable defaults for cell size and grid offset.
|
|
|
|
:return: ``True`` on success (may fail if it is not possible to reproject raster to given CRS)
|
|
%End
|
|
|
|
bool setParametersFromRaster( const QString &filename, const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
|
|
%Docstring
|
|
Overridden variant for convenience, taking filename instead RasterInfo object.
|
|
See the other variant for details.
|
|
%End
|
|
|
|
bool checkInputParameters();
|
|
%Docstring
|
|
Determine destination extent from the input rasters and calculate derived values
|
|
|
|
:return: ``True`` on success, sets error on error (see errorMessage())
|
|
%End
|
|
|
|
QSize alignedRasterSize() const;
|
|
%Docstring
|
|
Returns the expected size of the resulting aligned raster
|
|
|
|
.. note::
|
|
|
|
first need to run checkInputParameters() which returns with success
|
|
%End
|
|
|
|
QgsRectangle alignedRasterExtent() const;
|
|
%Docstring
|
|
Returns the expected extent of the resulting aligned raster
|
|
|
|
.. note::
|
|
|
|
first need to run checkInputParameters() which returns with success
|
|
%End
|
|
|
|
bool run();
|
|
%Docstring
|
|
Run the alignment process
|
|
|
|
:return: ``True`` on success, sets error on error (see errorMessage())
|
|
%End
|
|
|
|
QString errorMessage() const;
|
|
%Docstring
|
|
Returns the error from a previous run() call.
|
|
Error message is empty if run() succeeded (returned ``True``)
|
|
%End
|
|
|
|
void dump() const;
|
|
%Docstring
|
|
write contents of the object to standard error stream - for debugging
|
|
%End
|
|
|
|
int suggestedReferenceLayer() const;
|
|
%Docstring
|
|
Returns the index of the layer which has smallest cell size (returns -1 on error)
|
|
%End
|
|
|
|
protected:
|
|
|
|
bool createAndWarp( const Item &raster );
|
|
%Docstring
|
|
Internal function for processing of one raster (1. create output, 2. do the alignment)
|
|
%End
|
|
|
|
static bool suggestedWarpOutput( const RasterInfo &info, const QString &destWkt, QSizeF *cellSize = 0, QPointF *gridOffset = 0, QgsRectangle *rect = 0 );
|
|
%Docstring
|
|
Determine suggested output of raster warp to a different CRS. Returns ``True`` on success
|
|
%End
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/analysis/raster/qgsalignraster.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|