Skip to content
Permalink
Browse files

use sane number of decimals for the extent groupbox widget

  • Loading branch information
nirvn committed Feb 3, 2018
1 parent a66a4db commit 639d310da8e64294c0a5385921ff43f1889b4c4d
Showing with 22 additions and 5 deletions.
  1. +22 −5 src/gui/qgsextentgroupbox.cpp
@@ -17,7 +17,6 @@

#include "qgslogger.h"
#include "qgscoordinatetransform.h"
#include "qgsrasterblock.h"
#include "qgsmapcanvas.h"
#include "qgsmaplayermodel.h"
#include "qgsexception.h"
@@ -141,10 +140,28 @@ void QgsExtentGroupBox::setOutputExtent( const QgsRectangle &r, const QgsCoordin
}
}

mXMinLineEdit->setText( QgsRasterBlock::printValue( extent.xMinimum() ) );
mXMaxLineEdit->setText( QgsRasterBlock::printValue( extent.xMaximum() ) );
mYMinLineEdit->setText( QgsRasterBlock::printValue( extent.yMinimum() ) );
mYMaxLineEdit->setText( QgsRasterBlock::printValue( extent.yMaximum() ) );
int decimals;
switch ( mOutputCrs.mapUnits() )
{
case QgsUnitTypes::DistanceDegrees:
case QgsUnitTypes::DistanceUnknownUnit:
decimals = 9;
break;
case QgsUnitTypes::DistanceMeters:
case QgsUnitTypes::DistanceKilometers:
case QgsUnitTypes::DistanceFeet:
case QgsUnitTypes::DistanceNauticalMiles:
case QgsUnitTypes::DistanceYards:
case QgsUnitTypes::DistanceMiles:
case QgsUnitTypes::DistanceCentimeters:
case QgsUnitTypes::DistanceMillimeters:
decimals = 4;
break;
}
mXMinLineEdit->setText( QString::number( extent.xMinimum(), 'f', decimals ) );
mXMaxLineEdit->setText( QString::number( extent.xMaximum(), 'f', decimals ) );
mYMinLineEdit->setText( QString::number( extent.yMinimum(), 'f', decimals ) );
mYMaxLineEdit->setText( QString::number( extent.yMaximum(), 'f', decimals ) );

mExtentState = state;

0 comments on commit 639d310

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