Quantum GIS API Documentation  1.8
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 );
00056     double dpi();
00057 
00062     void setMapUnits( QGis::UnitType mapUnits );
00063 
00065     QGis::UnitType mapUnits() const;
00066 
00073     double calculate( const QgsRectangle &mapExtent, int canvasWidth );
00074 
00081     double calculateGeographicDistance( const QgsRectangle &mapExtent );
00082 
00083   private:
00084 
00086     double mDpi;
00087 
00089     QGis::UnitType mMapUnits;
00090 };
00091 
00092 #endif // #ifndef QGSSCALECALCULATOR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines