15
15
* (at your option) any later version. *
17
17
***************************************************************************/
18
/* $Id: qgsscalecalculator.h 4502 2006-01-08 01:18:20Z timlinux $ */
20
20
#ifndef QGSSCALECALCULATOR_H
21
21
#define QGSSCALECALCULATOR_H
29
* \class QgsScaleCalculator
30
* \brief Calculates scale for a given combination of canvas size, map extent,
29
* Calculates scale for a given combination of canvas size, map extent,
33
class QgsScaleCalculator
32
class CORE_EXPORT QgsScaleCalculator
39
38
* @param dpi Monitor resolution in dots per inch
40
39
* @param mapUnits Units of the data on the map. Must match a value from the
41
* QGis::units enum (METERS, FEET, DEGREES)
40
* QGis::UnitType enum (Meters, Feet, Degrees)
43
QgsScaleCalculator(int dpi = 0,
44
QGis::units mapUnits = QGis::METERS);
42
QgsScaleCalculator( double dpi = 0,
43
QGis::UnitType mapUnits = QGis::Meters );
47
46
~QgsScaleCalculator();
50
49
* Set the dpi to be used in scale calculations
51
50
* @param dpi Dots per inch of monitor resolution
52
void setDpi( double dpi );
54
* Accessor for dpi used in scale calculations
55
* @return int the dpi used for scale calculations.
56
60
* Set the map units
57
61
* @param mapUnits Units of the data on the map. Must match a value from the
59
void setMapUnits(QGis::units mapUnits);
63
void setMapUnits( QGis::UnitType mapUnits );
65
/** Returns current map units */
66
QGis::UnitType mapUnits() const;
62
69
* Calculate the scale
63
* @param mapExtent QgsRect containing the current map extent
70
* @param mapExtent QgsRectangle containing the current map extent
64
71
* @param canvasWidth Width of the map canvas in pixel (physical) units
65
72
* @return scale of current map view
67
double calculate(QgsRect &mapExtent, int canvasWidth);
74
double calculate( const QgsRectangle &mapExtent, int canvasWidth );
70
* Calculate the distance between to points in geographic coordinates.
77
* Calculate the distance between two points in geographic coordinates.
71
78
* Used to calculate scale for map views with geographic (decimal degree)
73
* @param mapExtent QgsRect containing the current map extent
80
* @param mapExtent QgsRectangle containing the current map extent
75
double calculateGeographicDistance(QgsRect &mapExtent);
82
double calculateGeographicDistance( const QgsRectangle &mapExtent );
82
89
//! map unit member
83
QGis::units mMapUnits;
90
QGis::UnitType mMapUnits;
86
93
#endif // #ifndef QGSSCALECALCULATOR_H