30 #include <QDomDocument>    31 #include <QDomElement>    37     , mZoomedInResampler( nullptr )
    38     , mZoomedOutResampler( nullptr )
    39     , mMaxOversampling( 2.0 )
   134   return block2( bandNo, extent, width, height );
   142   if ( !
mInput ) 
return outputBlock;
   144   double oversampling = 1.0; 
   151       double xRes = extent.
width() / width;
   153       double pixelRatio = xRes / providerXRes;
   155       QgsDebugMsgLevel( 
QString( 
"xRes = %1 providerXRes = %2 pixelRatio = %3 oversampling = %4" ).arg( xRes ).arg( providerXRes ).arg( pixelRatio ).arg( oversampling ), 4 );
   177     return mInput->
block2( bandNumber, extent, width, height, feedback );
   181   double oversamplingX = ( 
static_cast< double >( width ) * oversampling ) / width;
   182   double oversamplingY = ( 
static_cast< double >( height ) * oversampling ) / height;
   186   int resWidth = width * oversamplingX;
   187   int resHeight = height * oversamplingY;
   190   if ( !inputBlock || inputBlock->
isEmpty() )
   206   QImage dstImg = 
QImage( width, height, QImage::Format_ARGB32_Premultiplied );
   222     dstImg = img.
scaled( width, height );
   233   if ( parentElem.
isNull() )
   254   if ( filterElem.
isNull() )
   261   QString zoomedInResamplerType = filterElem.
attribute( 
"zoomedInResampler" );
   262   if ( zoomedInResamplerType == 
"bilinear" )
   266   else if ( zoomedInResamplerType == 
"cubic" )
   271   QString zoomedOutResamplerType = filterElem.
attribute( 
"zoomedOutResampler" );
   272   if ( zoomedOutResamplerType == 
"bilinear" )
 QgsRasterBlock * block2(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size. 
 
virtual int bandCount() const =0
Get number of bands. 
 
A rectangle specified with double values. 
 
void setMaxOversampling(double os)
 
QGis::DataType dataType(int bandNo) const override
Returns data type for the band specified by number. 
 
Unknown or unspecified type. 
 
Interface for resampling rasters (e.g. 
 
QDomNode appendChild(const QDomNode &newChild)
 
QString attribute(const QString &name, const QString &defValue) const
 
virtual void resample(const QImage &srcImage, QImage &dstImage)=0
 
virtual QgsRasterInterface * input() const
Current input. 
 
Resample filter pipe for rasters. 
 
void readXML(const QDomElement &filterElem) override
Sets base class members from xml. 
 
double toDouble(bool *ok) const
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference) 
 
virtual QgsRasterBlock * block2(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)
Read block of data using given extent and size. 
 
QgsRasterResampler * mZoomedOutResampler
Resampler used if raster resolution is higher than raster resolution (zoomed out). 
 
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax 
 
QString number(int n, int base)
 
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied. 
 
virtual QString type() const =0
 
bool setImage(const QImage *image)
set image. 
 
#define QgsDebugMsgLevel(str, level)
 
virtual int capabilities() const
Returns a bitmask containing the supported capabilities. 
 
void setAttribute(const QString &name, const QString &value)
 
~QgsRasterResampleFilter()
 
double width() const
Width of the rectangle. 
 
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32. 
 
bool isEmpty() const
Returns true if block is empty, i.e. 
 
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number. 
 
QgsRasterResampleFilter(QgsRasterInterface *input=nullptr)
 
Base class for processing filters like renderers, reprojector, resampler etc. 
 
double mMaxOversampling
Maximum boundary for oversampling (to avoid too much data traffic). 
 
bool reset(QGis::DataType theDataType, int theWidth, int theHeight)
Reset block. 
 
bool setInput(QgsRasterInterface *input) override
Set input. 
 
QImage image() const
Get image if type is color. 
 
virtual QgsRectangle extent() override=0
Get the extent of the data source. 
 
virtual QgsRectangle extent()
Get the extent of the interface. 
 
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height) override
Read block of data using given extent and size. 
 
void setZoomedInResampler(QgsRasterResampler *r)
Set resampler for zoomed in scales. 
 
QgsRasterResampleFilter * clone() const override
Clone itself, create deep copy. 
 
Bilinear Raster Resampler. 
 
DataType
Raster data types. 
 
virtual QgsRasterResampler * clone() const =0
 
void setZoomedOutResampler(QgsRasterResampler *r)
Set resampler for zoomed out scales. 
 
QgsRasterResampler * mZoomedInResampler
Resampler used if screen resolution is higher than raster resolution (zoomed in). ...
 
virtual const QgsRasterInterface * srcInput() const
Get source / raw input, the first in pipe, usually provider. 
 
void writeXML(QDomDocument &doc, QDomElement &parentElem) const override
Write base class members to xml. 
 
QDomElement createElement(const QString &tagName)
 
QgsRasterInterface * mInput
 
Feedback object tailored for raster block reading. 
 
virtual int xSize() const
Get raster size. 
 
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
 
int bandCount() const override
Get number of bands. 
 
Base class for raster data providers.