QGIS API Documentation  master-59fd5e0
src/core/qgsscalecalculator.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           qgsscalecalculator.h
00003               Calculates scale based on map extent and units
00004                              -------------------
00005     begin                : May 18, 2004
00006     copyright            : (C) 2004 by Gary E.Sherman
00007     email                : sherman at mrcc.com
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef QGSSCALECALCULATOR_H
00020 #define QGSSCALECALCULATOR_H
00021 
00022 #include <qgis.h>
00023 
00024 class QString;
00025 class QgsRectangle;
00026 
00031 class CORE_EXPORT QgsScaleCalculator
00032 {
00033   public:
00034 
00041     QgsScaleCalculator( double dpi = 0,
00042                         QGis::UnitType mapUnits = QGis::Meters );
00043 
00045     ~QgsScaleCalculator();
00046 
00051     void setDpi( double dpi );
00052 
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines