Quantum GIS API Documentation  1.7.4
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 /* $Id$ */
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines