Skip to content

Commit f93beaf

Browse files
committed
Write resampler types to xml
1 parent 6641652 commit f93beaf

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

src/core/raster/qgsrasterlayer.cpp

+28-7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ email : tim at linfiniti.com
4343
#include "qgssinglebandpseudocolorrenderer.h"
4444
#include "qgssinglebandgrayrenderer.h"
4545

46+
//resamplers
47+
#include "qgsbilinearrasterresampler.h"
48+
#include "qgscubicrasterresampler.h"
49+
4650
#include <cstdio>
4751
#include <cmath>
4852
#include <limits>
@@ -3277,14 +3281,31 @@ bool QgsRasterLayer::writeSymbology( QDomNode & layer_node, QDomDocument & docum
32773281
QDomElement rasterPropertiesElement = document.createElement( "rasterproperties" );
32783282
layer_node.appendChild( rasterPropertiesElement );
32793283

3280-
#if 0
32813284
// resampler
3282-
QString resamplerName = mResampler ? mResampler->type() : "nearest neighbour";
3283-
QDomElement resamplerElem = document.createElement( "resampler" );
3284-
QDomText resamplerText = document.createTextNode( resamplerName );
3285-
resamplerElem.appendChild( resamplerText );
3286-
rasterPropertiesElement.appendChild( resamplerElem );
3287-
#endif //0
3285+
if ( mRenderer )
3286+
{
3287+
QString zoomedInResamplerString = "nearest";
3288+
const QgsRasterResampler* zoomedInResampler = mRenderer->zoomedInResampler();
3289+
if ( zoomedInResampler )
3290+
{
3291+
zoomedInResamplerString = zoomedInResampler->type();
3292+
}
3293+
QDomElement zoomedInResamplerElem = document.createElement( "zoomedInResampler" );
3294+
QDomText zoomedInResamplerText = document.createTextNode( zoomedInResamplerString );
3295+
zoomedInResamplerElem.appendChild( zoomedInResamplerText );
3296+
rasterPropertiesElement.appendChild( zoomedInResamplerElem );
3297+
3298+
QString zoomedOutResamplerString = "nearest";
3299+
const QgsRasterResampler* zoomedOutResampler = mRenderer->zoomedOutResampler();
3300+
if ( zoomedOutResampler )
3301+
{
3302+
zoomedOutResamplerString = zoomedOutResampler->type();
3303+
}
3304+
QDomElement zoomedOutResamplerElem = document.createElement( "zoomedOutResampler" );
3305+
QDomText zoomedOutResamplerText = document.createTextNode( zoomedOutResamplerString );
3306+
zoomedOutResamplerElem.appendChild( zoomedOutResamplerText );
3307+
rasterPropertiesElement.appendChild( zoomedOutResamplerElem );
3308+
}
32883309

32893310
QStringList sl = subLayers();
32903311
QStringList sls = mDataProvider->subLayerStyles();

0 commit comments

Comments
 (0)