mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
The improvement allows immediate cancellation of raster rendering in progress. Until now, even when map rendering got cancelled (e.g. by zooming of panning canvas), the GUI got blocked while waiting for raster layers to finish their rendering (only vector layers have had support for cancellation). This should allow for much smoother user experience while browsing maps including rasters. The cancellation is supported currently by WMS/WMTS and WCS providers. GDAL provider may also get support thanks to improvements in GDAL 2. Funded by Land Information New Zealand.
88 lines
3.5 KiB
Plaintext
88 lines
3.5 KiB
Plaintext
|
|
/** Raster projector */
|
|
|
|
class QgsRasterProjector : QgsRasterInterface
|
|
{
|
|
%TypeHeaderCode
|
|
#include <qgsrasterprojector.h>
|
|
#include <qgscoordinatereferencesystem.h>
|
|
%End
|
|
|
|
public:
|
|
/** Precision defines if each pixel is reprojected or approximate reprojection based
|
|
* on an approximation matrix of reprojected points is used.
|
|
*/
|
|
enum Precision
|
|
{
|
|
Approximate, //!< Approximate (default), fast but possibly inaccurate
|
|
Exact, //!< Exact, precise but slow
|
|
};
|
|
|
|
/** \brief QgsRasterProjector implements approximate projection support for
|
|
* it calculates grid of points in source CRS for target CRS + extent
|
|
* which are used to calculate affine transformation matrices.
|
|
*/
|
|
|
|
QgsRasterProjector( const QgsCoordinateReferenceSystem& theSrcCRS,
|
|
const QgsCoordinateReferenceSystem& theDestCRS,
|
|
int theSrcDatumTransform,
|
|
int theDestDatumTransform,
|
|
const QgsRectangle& theDestExtent,
|
|
int theDestRows, int theDestCols,
|
|
double theMaxSrcXRes, double theMaxSrcYRes,
|
|
const QgsRectangle& theExtent
|
|
);
|
|
|
|
QgsRasterProjector( const QgsCoordinateReferenceSystem& theSrcCRS,
|
|
const QgsCoordinateReferenceSystem& theDestCRS,
|
|
const QgsRectangle& theDestExtent,
|
|
int theDestRows, int theDestCols,
|
|
double theMaxSrcXRes, double theMaxSrcYRes,
|
|
const QgsRectangle& theExtent
|
|
);
|
|
QgsRasterProjector( const QgsCoordinateReferenceSystem& theSrcCRS,
|
|
const QgsCoordinateReferenceSystem& theDestCRS,
|
|
double theMaxSrcXRes, double theMaxSrcYRes,
|
|
const QgsRectangle& theExtent
|
|
);
|
|
QgsRasterProjector();
|
|
|
|
/** \brief The destructor */
|
|
~QgsRasterProjector();
|
|
|
|
virtual QgsRasterProjector *clone() const /Factory/;
|
|
|
|
int bandCount() const;
|
|
|
|
int dataType( int bandNo ) const;
|
|
|
|
/** \brief set source and destination CRS */
|
|
void setCrs( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS,
|
|
int srcDatumTransform = -1, int destDatumTransform = -1 );
|
|
|
|
/** \brief Get source CRS */
|
|
QgsCoordinateReferenceSystem sourceCrs() const;
|
|
|
|
/** \brief Get destination CRS */
|
|
QgsCoordinateReferenceSystem destinationCrs() const;
|
|
|
|
/** \brief set maximum source resolution */
|
|
void setMaxSrcRes( double theMaxSrcXRes, double theMaxSrcYRes );
|
|
|
|
Precision precision() const;
|
|
void setPrecision( Precision precision );
|
|
// Translated precision mode, for use in ComboBox etc.
|
|
static QString precisionLabel( Precision precision );
|
|
|
|
QgsRasterBlock *block( int bandNo, const QgsRectangle & extent, int width, int height, QgsRasterBlockFeedback* feedback = nullptr ) / Factory /;
|
|
|
|
/** Calculate destination extent and size from source extent and size */
|
|
bool destExtentSize( const QgsRectangle& theSrcExtent, int theSrcXSize, int theSrcYSize,
|
|
QgsRectangle& theDestExtent, int& theDestXSize, int& theDestYSize );
|
|
|
|
/** Calculate destination extent and size from source extent and size */
|
|
static bool extentSize( const QgsCoordinateTransform& ct,
|
|
const QgsRectangle& theSrcExtent, int theSrcXSize, int theSrcYSize,
|
|
QgsRectangle& theDestExtent, int& theDestXSize, int& theDestYSize );
|
|
};
|