Skip to content
Permalink
Browse files

Better formatting of classification strings for legend. Fixes bug #1397

git-svn-id: http://svn.osgeo.org/qgis/trunk@11016 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jul 4, 2009
1 parent 17de1b0 commit dff791028ac188428c2951238af4224ada67371c
Showing with 6 additions and 60 deletions.
  1. +2 −21 src/app/qgscontinuouscolordialog.cpp
  2. +4 −39 src/app/qgsgraduatedsymboldialog.cpp
@@ -25,7 +25,6 @@
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "qgslogger.h"
#include <cmath>

#include <QColorDialog>

@@ -139,16 +138,7 @@ void QgsContinuousColorDialog::apply()


//create the render items for minimum and maximum value
QString minimumString;
if ( minimum - floor( minimum ) > 0 )
{
minimumString = QString::number( minimum, 'f' );
}
else
{
minimumString = QString::number( minimum, 'f', 0 );
}
QgsSymbol* minsymbol = new QgsSymbol( mVectorLayer->geometryType(), minimumString, "", "" );
QgsSymbol* minsymbol = new QgsSymbol( mVectorLayer->geometryType(), QVariant( minimum ).toString(), "", "" );
QPen minPen;
minPen.setColor( btnMinValue->color() );
minPen.setWidthF( outlinewidthspinbox->value() );
@@ -162,16 +152,7 @@ void QgsContinuousColorDialog::apply()
minsymbol->setPen( minPen );
}

QString maximumString;
if ( maximum - floor( maximum ) > 0 )
{
maximumString = QString::number( maximum, 'f' );
}
else
{
maximumString = QString::number( maximum, 'f', 0 );
}
QgsSymbol* maxsymbol = new QgsSymbol( mVectorLayer->geometryType(), maximumString, "", "" );
QgsSymbol* maxsymbol = new QgsSymbol( mVectorLayer->geometryType(), QVariant( maximum ).toString(), "", "" );
QPen maxPen;
maxPen.setColor( btnMaxValue->color() );
maxPen.setWidthF( outlinewidthspinbox->value() );
@@ -345,24 +345,9 @@ void QgsGraduatedSymbolDialog::adjustClassification()
{
if ( last_it != quantileBorders.end() )
{
if ( *last_it - floor( *last_it ) > 0 )
{
lowerString = QString::number( *last_it, 'f' );
}
else
{
lowerString = QString::number( *last_it, 'f', 0 );
}
lowerString = QVariant( *last_it ).toString();
upperString = QVariant( *it ).toString();
( *symbol_it )->setLowerValue( lowerString );

if ( *it - floor( *it ) > 0 )
{
upperString = QString::number( *it, 'f' );
}
else
{
upperString = QString::number( *it, 'f', 0 );
}
( *symbol_it )->setUpperValue( upperString );


@@ -384,29 +369,9 @@ void QgsGraduatedSymbolDialog::adjustClassification()
//switch if attribute is int or double
double lower = minimum + ( maximum - minimum ) / numberofclassesspinbox->value() * i;
double upper = minimum + ( maximum - minimum ) / numberofclassesspinbox->value() * ( i + 1 );

QString lowerString;
if ( lower - floor( lower ) > 0 )
{
lowerString = QString::number( lower, 'f' );
}
else
{
lowerString = QString::number( lower, 'f', 0 );
}

lowerString = QVariant( lower ).toString();
upperString = QVariant( upper ).toString();
( *symbol_it )->setLowerValue( lowerString );

QString upperString;
if ( upper - floor( upper ) > 0 )
{
upperString = QString::number( upper, 'f' );
}
else
{
upperString = QString::number( upper, 'f', 0 );
}

( *symbol_it )->setUpperValue( upperString );
listBoxText = lowerString + " - " + upperString;

0 comments on commit dff7910

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