00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef QGSSCALECALCULATOR_H
00021 #define QGSSCALECALCULATOR_H
00022 
00023 #include <qgis.h>
00024 
00025 class QString;
00026 class QgsRectangle;
00027 
00032 class CORE_EXPORT QgsScaleCalculator
00033 {
00034   public:
00035 
00042     QgsScaleCalculator( double dpi = 0,
00043                         QGis::UnitType mapUnits = QGis::Meters );
00044 
00046     ~QgsScaleCalculator();
00047 
00052     void setDpi( double dpi );
00057     double dpi();
00058 
00063     void setMapUnits( QGis::UnitType mapUnits );
00064 
00066     QGis::UnitType mapUnits() const;
00067 
00074     double calculate( const QgsRectangle &mapExtent, int canvasWidth );
00075 
00082     double calculateGeographicDistance( const QgsRectangle &mapExtent );
00083 
00084   private:
00085 
00087     double mDpi;
00088 
00090     QGis::UnitType mMapUnits;
00091 };
00092 
00093 #endif // #ifndef QGSSCALECALCULATOR_H