| QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
    | 
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::DistanceUnit mapUnits=Qgis::DistanceUnit::Meters) | |
| Constructor.  More... | |
| double | calculate (const QgsRectangle &mapExtent, double canvasWidth) const | 
| Calculate the scale denominator.  More... | |
| double | calculateGeographicDistance (const QgsRectangle &mapExtent) const | 
| Calculate the distance between two points in geographic coordinates.  More... | |
| QSizeF | calculateImageSize (const QgsRectangle &mapExtent, double scale) const | 
| Calculate the image size in pixel (physical) units.  More... | |
| double | dpi () const | 
| Returns the DPI (dots per inch) used in scale calculations.  More... | |
| Qgis::DistanceUnit | mapUnits () const | 
| Returns current map units.  More... | |
| void | setDpi (double dpi) | 
| Sets the dpi (dots per inch) for the output resolution, to be used in scale calculations.  More... | |
| void | setMapUnits (Qgis::DistanceUnit mapUnits) | 
| Set the map units.  More... | |
Calculates scale for a given combination of canvas size, map extent, and monitor dpi.
Definition at line 34 of file qgsscalecalculator.h.
| QgsScaleCalculator::QgsScaleCalculator | ( | double | dpi = 0, | 
| Qgis::DistanceUnit | mapUnits = Qgis::DistanceUnit::Meters | ||
| ) | 
Constructor.
| dpi | Monitor resolution in dots per inch | 
| mapUnits | Units of the data on the map | 
Definition at line 25 of file qgsscalecalculator.cpp.
| double QgsScaleCalculator::calculate | ( | const QgsRectangle & | mapExtent, | 
| double | canvasWidth | ||
| ) | const | 
Calculate the scale denominator.
| mapExtent | QgsRectangle containing the current map extent | 
| canvasWidth | Width of the map canvas in pixel (physical) units | 
Definition at line 51 of file qgsscalecalculator.cpp.
| double QgsScaleCalculator::calculateGeographicDistance | ( | const QgsRectangle & | mapExtent | ) | const | 
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 114 of file qgsscalecalculator.cpp.
| QSizeF QgsScaleCalculator::calculateImageSize | ( | const QgsRectangle & | mapExtent, | 
| double | scale | ||
| ) | const | 
Calculate the image size in pixel (physical) units.
| mapExtent | QgsRectangle containing the current map extent | 
| scale | Scale denominator, e.g. 1000.0 for a 1:1000 map | 
Definition at line 68 of file qgsscalecalculator.cpp.
| double QgsScaleCalculator::dpi | ( | ) | const | 
Returns the DPI (dots per inch) used in scale calculations.
Definition at line 34 of file qgsscalecalculator.cpp.
| Qgis::DistanceUnit QgsScaleCalculator::mapUnits | ( | ) | const | 
Returns current map units.
Definition at line 45 of file qgsscalecalculator.cpp.
| void QgsScaleCalculator::setDpi | ( | double | dpi | ) | 
Sets the dpi (dots per inch) for the output resolution, to be used in scale calculations.
Definition at line 30 of file qgsscalecalculator.cpp.
| void QgsScaleCalculator::setMapUnits | ( | Qgis::DistanceUnit | mapUnits | ) | 
Set the map units.
| mapUnits | Units of the data on the map. Must match a value from the | 
Definition at line 39 of file qgsscalecalculator.cpp.