Skip to content
Permalink
Browse files

Save raster symbology with full precision (fix #14950)

(cherry-picked from a6cb81b)
  • Loading branch information
nyalldawson committed Jul 1, 2016
1 parent 5091c31 commit 221909f06db07b7769be3b7f6513b769901254b5
@@ -25,6 +25,7 @@ class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
#include "qgslinearminmaxenhancement.h"
#include "qgslinearminmaxenhancementwithclip.h"
#include "qgscliptominmaxenhancement.h"
#include "qgsrasterblock.h"
#include <QDomDocument>
#include <QDomElement>

@@ -361,13 +362,13 @@ void QgsContrastEnhancement::writeXML( QDomDocument& doc, QDomElement& parentEle
{
//minimum value
QDomElement minElem = doc.createElement( "minValue" );
QDomText minText = doc.createTextNode( QString::number( mMinimumValue ) );
QDomText minText = doc.createTextNode( QgsRasterBlock::printValue( mMinimumValue ) );
minElem.appendChild( minText );
parentElem.appendChild( minElem );

//maximum value
QDomElement maxElem = doc.createElement( "maxValue" );
QDomText maxText = doc.createTextNode( QString::number( mMaximumValue ) );
QDomText maxText = doc.createTextNode( QgsRasterBlock::printValue( mMaximumValue ) );
maxElem.appendChild( maxText );
parentElem.appendChild( maxElem );

@@ -1528,8 +1528,8 @@ bool QgsRasterLayer::writeXml( QDomNode & layer_node,
{
QDomElement noDataRange = document.createElement( "noDataRange" );

noDataRange.setAttribute( "min", range.min() );
noDataRange.setAttribute( "max", range.max() );
noDataRange.setAttribute( "min", QgsRasterBlock::printValue( range.min() ) );
noDataRange.setAttribute( "max", QgsRasterBlock::printValue( range.max() ) );
noDataRangeList.appendChild( noDataRange );
}

@@ -19,6 +19,7 @@ email : ersts@amnh.org
#include "qgslogger.h"
#include "qgscolorrampshader.h"
#include "qgsrastershader.h"
#include "qgsrasterblock.h"
#include <QDomDocument>
#include <QDomElement>

@@ -151,7 +152,7 @@ void QgsRasterShader::writeXML( QDomDocument& doc, QDomElement& parent ) const
{
QDomElement itemElem = doc.createElement( "item" );
itemElem.setAttribute( "label", itemIt->label );
itemElem.setAttribute( "value", QString::number( itemIt->value ) );
itemElem.setAttribute( "value", QgsRasterBlock::printValue( itemIt->value ) );
itemElem.setAttribute( "color", itemIt->color.name() );
itemElem.setAttribute( "alpha", itemIt->color.alpha() );
colorRampShaderElem.appendChild( itemElem );
@@ -224,8 +224,8 @@ void QgsSingleBandPseudoColorRenderer::writeXML( QDomDocument& doc, QDomElement&
{
mShader->writeXML( doc, rasterRendererElem ); //todo: include color ramp items directly in this renderer
}
rasterRendererElem.setAttribute( "classificationMin", QString::number( mClassificationMin ) );
rasterRendererElem.setAttribute( "classificationMax", QString::number( mClassificationMax ) );
rasterRendererElem.setAttribute( "classificationMin", QgsRasterBlock::printValue( mClassificationMin ) );
rasterRendererElem.setAttribute( "classificationMax", QgsRasterBlock::printValue( mClassificationMax ) );
rasterRendererElem.setAttribute( "classificationMinMaxOrigin", QgsRasterRenderer::minMaxOriginName( mClassificationMinMaxOrigin ) );

parentElem.appendChild( rasterRendererElem );

0 comments on commit 221909f

Please sign in to comment.
You can’t perform that action at this time.