30 #include <QDomDocument>
31 #include <QDomElement>
37 mZoomedInResampler( 0 ), mZoomedOutResampler( 0 ),
38 mMaxOversampling( 2.0 )
134 QgsDebugMsg( QString(
"width = %1 height = %2 extent = %3" ).arg( width ).arg( height ).arg( extent.
toString() ) );
136 if ( !
mInput )
return outputBlock;
138 double oversampling = 1.0;
145 double xRes = extent.
width() / width;
147 double pixelRatio = xRes / providerXRes;
149 QgsDebugMsg( QString(
"xRes = %1 providerXRes = %2 pixelRatio = %3 oversampling = %4" ).arg( xRes ).arg( providerXRes ).arg( pixelRatio ).arg( oversampling ) );
160 QgsDebugMsg( QString(
"oversampling %1" ).arg( oversampling ) );
171 return mInput->
block( bandNumber, extent, width, height );
175 double oversamplingX = (( double )width * oversampling ) / width;
176 double oversamplingY = (( double )height * oversampling ) / height;
180 int resWidth = width * oversamplingX;
181 int resHeight = height * oversamplingY;
184 if ( !inputBlock || inputBlock->
isEmpty() )
198 QImage img = inputBlock->
image();
200 QImage dstImg = QImage( width, height, QImage::Format_ARGB32_Premultiplied );
216 dstImg = img.scaled( width, height );
227 if ( parentElem.isNull() )
232 QDomElement rasterRendererElem = doc.createElement(
"rasterresampler" );
234 rasterRendererElem.setAttribute(
"maxOversampling", QString::number(
mMaxOversampling ) );
243 parentElem.appendChild( rasterRendererElem );
248 if ( filterElem.isNull() )
253 mMaxOversampling = filterElem.attribute(
"maxOversampling",
"2.0" ).toDouble();
255 QString zoomedInResamplerType = filterElem.attribute(
"zoomedInResampler" );
256 if ( zoomedInResamplerType ==
"bilinear" )
260 else if ( zoomedInResamplerType ==
"cubic" )
265 QString zoomedOutResamplerType = filterElem.attribute(
"zoomedOutResampler" );
266 if ( zoomedOutResamplerType ==
"bilinear" )