QGIS/python/analysis/raster/qgsalignraster.sip.in

299 lines
7.3 KiB
Plaintext
Raw Normal View History

2017-05-21 22:18:04 +07:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsalignraster.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2015-06-12 15:12:18 +08:00
class QgsAlignRaster
{
2017-05-21 22:18:04 +07:00
%Docstring
QgsAlignRaster takes one or more raster layers and warps (resamples) them
2017-12-15 10:36:55 -04:00
so they have the same:
- coordinate reference system
- cell size and raster size
- offset of the raster grid
2017-05-21 22:18:04 +07:00
.. versionadded:: 2.12
2015-06-12 15:12:18 +08:00
%End
2015-07-29 11:52:14 +02:00
2017-05-21 22:18:04 +07:00
%TypeHeaderCode
#include "qgsalignraster.h"
2017-05-30 08:48:38 +10:00
#include <gdal_version.h>
2017-05-21 22:18:04 +07:00
%End
2015-06-12 15:12:18 +08:00
public:
QgsAlignRaster();
struct RasterInfo
{
2017-05-21 22:18:04 +07:00
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
Return CRS in WKT format
%End
QSize rasterSize() const;
%Docstring
Return size of the raster grid in pixels
%End
int bandCount() const;
%Docstring
Return number of raster bands in the file
%End
QSizeF cellSize() const;
%Docstring
Return cell size in map units
%End
QPointF gridOffset() const;
%Docstring
Return grid offset
%End
QgsRectangle extent() const;
%Docstring
Return extent of the raster
%End
QPointF origin() const;
%Docstring
Return 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
Get raster value at the given coordinates (from the first band)
%End
protected:
private:
RasterInfo( const QgsAlignRaster::RasterInfo &rh );
2015-06-12 15:12:18 +08:00
};
enum ResampleAlg
{
2017-05-21 22:18:04 +07:00
RA_NearestNeighbour,
RA_Bilinear,
RA_Cubic,
RA_CubicSpline,
RA_Lanczos,
RA_Average,
RA_Mode,
RA_Max,
RA_Min,
RA_Median,
RA_Q1,
RA_Q3,
2015-06-12 15:12:18 +08:00
};
struct Item
{
Item( const QString &input, const QString &output );
2015-06-12 15:12:18 +08:00
QString inputFilename;
QString outputFilename;
QgsAlignRaster::ResampleAlg resampleMethod;
2015-06-12 15:12:18 +08:00
bool rescaleValues;
double srcCellSizeInDestCRS;
};
typedef QList<QgsAlignRaster::Item> List;
2015-06-17 14:52:40 +08:00
struct ProgressHandler
{
2015-06-17 14:52:40 +08:00
virtual bool progress( double complete ) = 0;
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Method to be overridden for progress reporting.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param complete: Overall progress of the alignment operation
:return: false if the execution should be canceled, true otherwise
2017-05-21 22:18:04 +07:00
%End
2015-06-17 14:52:40 +08:00
virtual ~ProgressHandler();
};
void setProgressHandler( ProgressHandler *progressHandler );
2017-05-21 22:18:04 +07:00
%Docstring
Assign a progress handler instance. Does not take ownership. None can be passed.
%End
ProgressHandler *progressHandler() const;
2017-05-21 22:18:04 +07:00
%Docstring
Get associated progress handler. May be None (default)
%End
2015-06-17 14:52:40 +08:00
void setRasters( const List &list );
2017-05-21 22:18:04 +07:00
%Docstring
Set list of rasters that will be aligned
%End
2015-06-12 15:12:18 +08:00
List rasters() const;
2017-05-21 22:18:04 +07:00
%Docstring
Get list of rasters that will be aligned
%End
2015-06-12 15:12:18 +08:00
void setGridOffset( QPointF offset );
2015-06-12 15:12:18 +08:00
QPointF gridOffset() const;
void setCellSize( double x, double y );
2017-05-21 22:18:04 +07:00
%Docstring
Set output cell size
%End
void setCellSize( QSizeF size );
2017-05-21 22:18:04 +07:00
%Docstring
Set output cell size
%End
2015-06-12 15:12:18 +08:00
QSizeF cellSize() const;
2017-05-21 22:18:04 +07:00
%Docstring
Get output cell size
%End
2015-06-12 15:12:18 +08:00
void setDestinationCrs( const QString &crsWkt );
2017-05-21 22:18:04 +07:00
%Docstring
Set the output CRS in WKT format
%End
QString destinationCrs() const;
2017-05-21 22:18:04 +07:00
%Docstring
Get the output CRS in WKT format
%End
2015-06-17 14:52:40 +08:00
2015-06-12 15:12:18 +08:00
void setClipExtent( double xmin, double ymin, double xmax, double ymax );
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Configure clipping extent (region of interest).
No extra clipping is done if the rectangle is null
2017-05-21 22:18:04 +07:00
%End
void setClipExtent( const QgsRectangle &extent );
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Configure clipping extent (region of interest).
No extra clipping is done if the rectangle is null
2017-05-21 22:18:04 +07:00
%End
2015-06-12 15:12:18 +08:00
QgsRectangle clipExtent() const;
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Get clipping extent (region of interest).
No extra clipping is done if the rectangle is null
2017-05-21 22:18:04 +07:00
%End
2015-06-12 15:12:18 +08:00
2017-05-21 22:18:04 +07:00
bool setParametersFromRaster( const RasterInfo &rasterInfo, const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-12-15 10:36:55 -04:00
:return: true on success (may fail if it is not possible to reproject raster to given CRS)
2017-05-21 22:18:04 +07:00
%End
bool setParametersFromRaster( const QString &filename, const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Overridden variant for convenience, taking filename instead RasterInfo object.
See the other variant for details.
2017-05-21 22:18:04 +07:00
%End
2015-06-12 15:12:18 +08:00
bool checkInputParameters();
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Determine destination extent from the input rasters and calculate derived values
:return: true on success, sets error on error (see errorMessage())
2017-05-21 22:18:04 +07:00
%End
QSize alignedRasterSize() const;
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Return expected size of the resulting aligned raster
2017-05-21 22:18:04 +07:00
.. note::
first need to run checkInputParameters() which returns with success
%End
QgsRectangle alignedRasterExtent() const;
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Return expected extent of the resulting aligned raster
2017-05-21 22:18:04 +07:00
.. note::
first need to run checkInputParameters() which returns with success
%End
2015-06-12 15:12:18 +08:00
bool run();
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Run the alignment process
:return: true on success, sets error on error (see errorMessage())
2017-05-21 22:18:04 +07:00
%End
2015-06-12 15:12:18 +08:00
QString errorMessage() const;
2017-05-21 22:18:04 +07:00
%Docstring
2017-12-15 10:36:55 -04:00
Return error from a previous run() call.
Error message is empty if run() succeeded (returned true)
2017-05-21 22:18:04 +07:00
%End
2015-06-12 15:12:18 +08:00
void dump() const;
2017-05-21 22:18:04 +07:00
%Docstring
write contents of the object to standard error stream - for debugging
%End
2015-06-12 15:12:18 +08:00
int suggestedReferenceLayer() const;
2017-05-21 22:18:04 +07:00
%Docstring
Return index of the layer which has smallest cell size (returns -1 on error)
%End
protected:
bool createAndWarp( const Item &raster );
2017-05-21 22:18:04 +07:00
%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 );
2017-05-21 22:18:04 +07:00
%Docstring
Determine suggested output of raster warp to a different CRS. Returns true on success
%End
protected:
2015-06-12 15:12:18 +08:00
};
2017-05-21 22:18:04 +07:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsalignraster.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/