From 284902a37d134588c66ef5408201e360dc5c6b77 Mon Sep 17 00:00:00 2001 From: mhugent Date: Thu, 11 Sep 2008 11:46:54 +0000 Subject: [PATCH] Allow dpi values to be doubles. This fixes unprecise scale bars in composer git-svn-id: http://svn.osgeo.org/qgis/trunk@9298 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/core/qgsscalecalculator.cpp | 6 +++--- src/core/qgsscalecalculator.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/qgsscalecalculator.cpp b/src/core/qgsscalecalculator.cpp index 792de156843..ccb2d844f5e 100644 --- a/src/core/qgsscalecalculator.cpp +++ b/src/core/qgsscalecalculator.cpp @@ -23,18 +23,18 @@ #include "qgsrect.h" #include "qgsscalecalculator.h" -QgsScaleCalculator::QgsScaleCalculator( int dpi, QGis::units mapUnits ) +QgsScaleCalculator::QgsScaleCalculator( double dpi, QGis::units mapUnits ) : mDpi( dpi ), mMapUnits( mapUnits ) {} QgsScaleCalculator::~QgsScaleCalculator() {} -void QgsScaleCalculator::setDpi( int dpi ) +void QgsScaleCalculator::setDpi( double dpi ) { mDpi = dpi; } -int QgsScaleCalculator::dpi() +double QgsScaleCalculator::dpi() { return mDpi; } diff --git a/src/core/qgsscalecalculator.h b/src/core/qgsscalecalculator.h index 8ccbed2fb68..71301c14ec1 100644 --- a/src/core/qgsscalecalculator.h +++ b/src/core/qgsscalecalculator.h @@ -39,7 +39,7 @@ class CORE_EXPORT QgsScaleCalculator * @param mapUnits Units of the data on the map. Must match a value from the * QGis::units enum (METERS, FEET, DEGREES) */ - QgsScaleCalculator( int dpi = 0, + QgsScaleCalculator( double dpi = 0, QGis::units mapUnits = QGis::METERS ); //! Destructor @@ -49,12 +49,12 @@ class CORE_EXPORT QgsScaleCalculator * Set the dpi to be used in scale calculations * @param dpi Dots per inch of monitor resolution */ - void setDpi( int dpi ); + void setDpi( double dpi ); /** * Accessor for dpi used in scale calculations * @return int the dpi used for scale calculations. */ - int dpi(); + double dpi(); /** * Set the map units @@ -84,7 +84,7 @@ class CORE_EXPORT QgsScaleCalculator private: //! dpi member - int mDpi; + double mDpi; //! map unit member QGis::units mMapUnits;