Skip to content

Commit

Permalink
[API] add read/writeXML methods to QgsRasterInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Mar 14, 2013
1 parent 1145bd2 commit 21c7b55
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/raster/qgsbrightnesscontrastfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CORE_EXPORT QgsBrightnessContrastFilter : public QgsRasterInterface
void writeXML( QDomDocument& doc, QDomElement& parentElem );

/**Sets base class members from xml. Usually called from create() methods of subclasses*/
void readXML( const QDomElement& resamplefilterElem );
void readXML( const QDomElement& filterElem );

private:
/**Current brightness coefficient value. Default: 0. Range: -255...255*/
Expand Down
5 changes: 5 additions & 0 deletions src/core/raster/qgsrasterinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ class CORE_EXPORT QgsRasterInterface
* returned. */
//double time( bool cumulative = false );

/** Write base class members to xml. */
virtual void writeXML( QDomDocument& doc, QDomElement& parentElem ) { Q_UNUSED( doc ); Q_UNUSED( parentElem ); };
/** Sets base class members from xml. Usually called from create() methods of subclasses */
virtual void readXML( const QDomElement& filterElem ) { Q_UNUSED( filterElem ); };

protected:
// QgsRasterInterface used as input
QgsRasterInterface* mInput;
Expand Down
1 change: 0 additions & 1 deletion src/core/raster/qgsrasterrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface
/**Get symbology items if provided by renderer*/
virtual void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const { Q_UNUSED( symbolItems ); }

virtual void writeXML( QDomDocument&, QDomElement& ) const {}
/**Sets base class members from xml. Usually called from create() methods of subclasses*/
void readXML( const QDomElement& rendererElem );

Expand Down
10 changes: 5 additions & 5 deletions src/core/raster/qgsrasterresamplefilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ void QgsRasterResampleFilter::writeXML( QDomDocument& doc, QDomElement& parentEl
parentElem.appendChild( rasterRendererElem );
}

void QgsRasterResampleFilter::readXML( const QDomElement& rendererElem )
void QgsRasterResampleFilter::readXML( const QDomElement& filterElem )
{
if ( rendererElem.isNull() )
if ( filterElem.isNull() )
{
return;
}

mMaxOversampling = rendererElem.attribute( "maxOversampling", "2.0" ).toDouble();
mMaxOversampling = filterElem.attribute( "maxOversampling", "2.0" ).toDouble();

QString zoomedInResamplerType = rendererElem.attribute( "zoomedInResampler" );
QString zoomedInResamplerType = filterElem.attribute( "zoomedInResampler" );
if ( zoomedInResamplerType == "bilinear" )
{
mZoomedInResampler = new QgsBilinearRasterResampler();
Expand All @@ -260,7 +260,7 @@ void QgsRasterResampleFilter::readXML( const QDomElement& rendererElem )
mZoomedInResampler = new QgsCubicRasterResampler();
}

QString zoomedOutResamplerType = rendererElem.attribute( "zoomedOutResampler" );
QString zoomedOutResamplerType = filterElem.attribute( "zoomedOutResampler" );
if ( zoomedOutResamplerType == "bilinear" )
{
mZoomedOutResampler = new QgsBilinearRasterResampler();
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterresamplefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CORE_EXPORT QgsRasterResampleFilter : public QgsRasterInterface
void writeXML( QDomDocument& doc, QDomElement& parentElem );

/**Sets base class members from xml. Usually called from create() methods of subclasses*/
void readXML( const QDomElement& resamplefilterElem );
void readXML( const QDomElement& filterElem );

protected:
/**Resampler used if screen resolution is higher than raster resolution (zoomed in). 0 means no resampling (nearest neighbour)*/
Expand Down

0 comments on commit 21c7b55

Please sign in to comment.