QGIS API Documentation
2.8.2-Wien
|
Calculates scale for a given combination of canvas size, map extent, and monitor dpi. More...
#include <qgsscalecalculator.h>
Public Member Functions | |
QgsScaleCalculator (double dpi=0, QGis::UnitType mapUnits=QGis::Meters) | |
Constructor. | |
~QgsScaleCalculator () | |
Destructor. | |
double | calculate (const QgsRectangle &mapExtent, int canvasWidth) |
Calculate the scale denominator. | |
double | calculateGeographicDistance (const QgsRectangle &mapExtent) |
Calculate the distance between two points in geographic coordinates. | |
double | dpi () |
Accessor for dpi used in scale calculations. | |
QGis::UnitType | mapUnits () const |
Returns current map units. | |
void | setDpi (double dpi) |
Set the dpi to be used in scale calculations. | |
void | setMapUnits (QGis::UnitType mapUnits) |
Set the map units. |
Calculates scale for a given combination of canvas size, map extent, and monitor dpi.
Definition at line 31 of file qgsscalecalculator.h.
QgsScaleCalculator::QgsScaleCalculator | ( | double | dpi = 0 , |
QGis::UnitType | mapUnits = QGis::Meters |
||
) |
Constructor.
dpi | Monitor resolution in dots per inch |
mapUnits | Units of the data on the map. Must match a value from the QGis::UnitType enum (Meters, Feet, Degrees) |
Definition at line 24 of file qgsscalecalculator.cpp.
QgsScaleCalculator::~QgsScaleCalculator | ( | ) |
Destructor.
Definition at line 28 of file qgsscalecalculator.cpp.
double QgsScaleCalculator::calculate | ( | const QgsRectangle & | mapExtent, |
int | canvasWidth | ||
) |
Calculate the scale denominator.
mapExtent | QgsRectangle containing the current map extent |
canvasWidth | Width of the map canvas in pixel (physical) units |
Definition at line 52 of file qgsscalecalculator.cpp.
double QgsScaleCalculator::calculateGeographicDistance | ( | const QgsRectangle & | mapExtent | ) |
Calculate the distance between two points in geographic coordinates.
Used to calculate scale for map views with geographic (decimal degree) data.
mapExtent | QgsRectangle containing the current map extent |
Definition at line 93 of file qgsscalecalculator.cpp.
double QgsScaleCalculator::dpi | ( | ) |
Accessor for dpi used in scale calculations.
Definition at line 35 of file qgsscalecalculator.cpp.
QGis::UnitType QgsScaleCalculator::mapUnits | ( | ) | const |
Returns current map units.
Definition at line 46 of file qgsscalecalculator.cpp.
void QgsScaleCalculator::setDpi | ( | double | dpi | ) |
Set the dpi to be used in scale calculations.
dpi | Dots per inch of monitor resolution |
Definition at line 31 of file qgsscalecalculator.cpp.
void QgsScaleCalculator::setMapUnits | ( | QGis::UnitType | mapUnits | ) |
Set the map units.
mapUnits | Units of the data on the map. Must match a value from the |
Definition at line 40 of file qgsscalecalculator.cpp.