QGIS API Documentation  2.99.0-Master (314842d)
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 *
13  * it under the terms of the GNU General Public License as published by *
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_core.h"
23 #include <qgis.h>
24 #include "qgsunittypes.h"
25 
26 class QString;
27 class QgsRectangle;
28 
33 class CORE_EXPORT QgsScaleCalculator
34 {
35  public:
36 
42  QgsScaleCalculator( double dpi = 0,
44 
49  void setDpi( double dpi );
50 
55  double dpi();
56 
61  void setMapUnits( QgsUnitTypes::DistanceUnit mapUnits );
62 
64  QgsUnitTypes::DistanceUnit mapUnits() const;
65 
72  double calculate( const QgsRectangle &mapExtent, int canvasWidth );
73 
80  double calculateGeographicDistance( const QgsRectangle &mapExtent );
81 
82  private:
83 
85  double mDpi;
86 
89 };
90 
91 #endif // #ifndef QGSSCALECALCULATOR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:36
Calculates scale for a given combination of canvas size, map extent, and monitor dpi.
DistanceUnit
Units of distance.
Definition: qgsunittypes.h:42