1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsscalecalculator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsScaleCalculator
{
%Docstring(signature="appended")
Calculates scale for a given combination of canvas size, map extent, and
monitor dpi.
%End
%TypeHeaderCode
#include "qgsscalecalculator.h"
%End
public:
QgsScaleCalculator( double dpi = 0,
Qgis::DistanceUnit mapUnits = Qgis::DistanceUnit::Meters );
%Docstring
Constructor
:param dpi: Monitor resolution in dots per inch
:param mapUnits: Units of the data on the map
%End
void setDpi( double dpi );
%Docstring
Sets the ``dpi`` (dots per inch) for the output resolution, to be used
in scale calculations.
.. seealso:: :py:func:`dpi`
%End
double dpi() const;
%Docstring
Returns the DPI (dots per inch) used in scale calculations.
.. seealso:: :py:func:`setDpi`
%End
void setMapUnits( Qgis::DistanceUnit mapUnits );
%Docstring
Set the map units.
.. seealso:: :py:func:`mapUnits`
%End
Qgis::DistanceUnit mapUnits() const;
%Docstring
Returns current map units.
.. seealso:: :py:func:`setMapUnits`
%End
double calculate( const QgsRectangle &mapExtent, double canvasWidth ) const;
%Docstring
Calculate the scale denominator.
:param mapExtent: :py:class:`QgsRectangle` containing the current map
extent. Units are specified by
:py:func:`~QgsScaleCalculator.mapUnits`.
:param canvasWidth: Width of the map canvas in pixel (physical) units
:return: scale denominator of current map view, e.g. 1000.0 for a 1:1000
map.
%End
QSizeF calculateImageSize( const QgsRectangle &mapExtent, double scale ) const;
%Docstring
Calculate the image size in pixel (physical) units.
:param mapExtent: :py:class:`QgsRectangle` containing the current map
extent. Units are specified by
:py:func:`~QgsScaleCalculator.mapUnits`
:param scale: Scale denominator, e.g. 1000.0 for a 1:1000 map
:return: image size
.. versionadded:: 3.24
%End
double calculateGeographicDistance( const QgsRectangle &mapExtent ) const;
%Docstring
Calculate the distance between two points in geographic coordinates.
Used to calculate scale for map views with geographic (decimal degree)
data.
:param mapExtent: :py:class:`QgsRectangle` containing the current map
extent
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsscalecalculator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|