1
/***************************************************************************
3
Calculates scale based on map extent and units
6
copyright : (C) 2004 by Gary E.Sherman
7
email : sherman at mrcc.com
8
***************************************************************************/
10
/***************************************************************************
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. *
17
***************************************************************************/
18
/* $Id: qgsscalecalculator.h,v 1.2 2004/10/26 17:28:03 mcoletti Exp $ */
20
#ifndef QGSSCALECALCULATOR_H
21
#define QGSSCALECALCULATOR_H
27
* \class QgsScaleCalculator
28
* \brief Calculates scale for a given combination of canvas size, map extent,
31
class QgsScaleCalculator
36
* Enum for defining map units
48
* @param dpi Monitor resolution in dots per inch
49
* @param mapUnits Units of the data on the map. Must match a value from the
50
* QgsScaleCalculator::units enum (METERS, FEET, DEGREES)
52
QgsScaleCalculator(int dpi = 0,
53
units mapUnits = METERS);
56
~QgsScaleCalculator();
59
* Set the dpi to be used in scale calculations
60
* @param dpi Dots per inch of monitor resolution
66
* @param mapUnits Units of the data on the map. Must match a value from the
68
void setMapUnits(QgsScaleCalculator::units mapUnits);
72
* @param mapExtent QgsRect containing the current map extent
73
* @param canvasWidth Width of the map canvas in pixel (physical) units
74
* @return scale of current map view
76
double calculate(QgsRect &mapExtent, int canvasWidth);
79
* Calculate the distance between to points in geographic coordinates.
80
* Used to calculate scale for map views with geographic (decimal degree)
82
* @param mapExtent QgsRect containing the current map extent
84
double calculateGeographicDistance(QgsRect &mapExtent);
95
#endif // #ifndef QGSSCALECALCULATOR_H