mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
156 lines
4.5 KiB
Plaintext
156 lines
4.5 KiB
Plaintext
/************************************************************************
|
|
* 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.
|
|
|
|
The calculation defaults to using the scale calculated horizontally
|
|
across the center of the map, however this may be changed by calling
|
|
:py:func:`~setMethod`.
|
|
%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
|
|
|
|
|
|
Qgis::ScaleCalculationMethod method() const;
|
|
%Docstring
|
|
Returns the method to use for map scale calculations.
|
|
|
|
.. seealso:: :py:func:`setMethod`
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void setMethod( Qgis::ScaleCalculationMethod method );
|
|
%Docstring
|
|
Sets the ``method`` to use for map scale calculations.
|
|
|
|
.. seealso:: :py:func:`method`
|
|
|
|
.. versionadded:: 3.44
|
|
%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 in meters, horizontally across the specified map
|
|
extent (in geographic coordinates).
|
|
|
|
Used to calculate scale for map views with geographic (decimal degree)
|
|
data.
|
|
|
|
This method respects the scale :py:func:`~QgsScaleCalculator.method`.
|
|
|
|
:param mapExtent: the map extent, in geographic (degrees) coordinates
|
|
|
|
:return: distance in meters across the map extent
|
|
%End
|
|
|
|
double calculateGeographicDistanceAtLatitude( double latitude, double longitude1, double longitude2 ) const;
|
|
%Docstring
|
|
Calculate the distance in meters, horizontally between two longitudes at
|
|
a specified ``latitude``.
|
|
|
|
Used to calculate scale for map views with geographic (decimal degree)
|
|
data.
|
|
|
|
:param latitude: latitude (in degrees) to calculate distance at
|
|
:param longitude1: first longitude (left side of map, or x-minimum) to
|
|
calculate distance between
|
|
:param longitude2: second longitude (right side of map, or x-maximum) to
|
|
calculate distance between
|
|
|
|
:return: distance in meters between the two longitudes
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/qgsscalecalculator.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|