QGIS API Documentation  2.4.0-Chugiak
qgsscalecalculator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsscalecalculator.h
3  Calculates scale based on map extent and units
4  -------------------
5  begin : May 18, 2004
6  copyright : (C) 2004 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18
19 #ifndef QGSSCALECALCULATOR_H
20 #define QGSSCALECALCULATOR_H
21
22 #include <qgis.h>
23
24 class QString;
25 class QgsRectangle;
26
31 class CORE_EXPORT QgsScaleCalculator
32 {
33  public:
34
41  QgsScaleCalculator( double dpi = 0,
42  QGis::UnitType mapUnits = QGis::Meters );
43
46
51  void setDpi( double dpi );
52
57  double dpi();
58
63  void setMapUnits( QGis::UnitType mapUnits );
64
66  QGis::UnitType mapUnits() const;
67
74  double calculate( const QgsRectangle &mapExtent, int canvasWidth );
75
82  double calculateGeographicDistance( const QgsRectangle &mapExtent );
83
84  private:
85
87  double mDpi;
88
91 };
92
93 #endif // #ifndef QGSSCALECALCULATOR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
double mDpi
dpi member
Calculates scale for a given combination of canvas size, map extent, and monitor dpi.
UnitType
Map units that qgis supports.
Definition: qgis.h:229
QGis::UnitType mMapUnits
map unit member