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 ) );
170 return mInput->
block( bandNumber, extent, width, height );
174 double oversamplingX = (( double )width * oversampling ) / width;
175 double oversamplingY = (( double )height * oversampling ) / height;
179 int resWidth = width * oversamplingX;
180 int resHeight = height * oversamplingY;
183 if ( !inputBlock || inputBlock->
isEmpty() )
197 QImage img = inputBlock->
image();
199 QImage dstImg = QImage( width, height, QImage::Format_ARGB32_Premultiplied );
215 dstImg = img.scaled( width, height );
226 if ( parentElem.isNull() )
231 QDomElement rasterRendererElem = doc.createElement(
"rasterresampler" );
233 rasterRendererElem.setAttribute(
"maxOversampling", QString::number(
mMaxOversampling ) );
242 parentElem.appendChild( rasterRendererElem );
247 if ( filterElem.isNull() )
252 mMaxOversampling = filterElem.attribute(
"maxOversampling",
"2.0" ).toDouble();
254 QString zoomedInResamplerType = filterElem.attribute(
"zoomedInResampler" );
255 if ( zoomedInResamplerType ==
"bilinear" )
259 else if ( zoomedInResamplerType ==
"cubic" )
264 QString zoomedOutResamplerType = filterElem.attribute(
"zoomedOutResampler" );
265 if ( zoomedOutResamplerType ==
"bilinear" )