2017-05-14 09:48:41 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsmaptopixel.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
|
|
|
|
class QgsMapToPixel
|
|
|
|
{
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Perform transforms between map coordinates and device coordinates.
|
2017-05-14 09:48:41 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
This class can convert device coordinates to map coordinates and vice versa.
|
2007-01-09 02:39:15 +00:00
|
|
|
%End
|
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsmaptopixel.h"
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
public:
|
2016-09-15 18:26:43 +10:00
|
|
|
|
|
|
|
QgsMapToPixel( double mapUnitsPerPixel, double centerX, double centerY, int widthPixels, int heightPixels, double rotation );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param mapUnitsPerPixel: Map units per pixel
|
|
|
|
:param centerX: X coordinate of map center, in geographical units
|
|
|
|
:param centerY: Y coordinate of map center, in geographical units
|
|
|
|
:param widthPixels: Output width, in pixels
|
|
|
|
:param heightPixels: Output height, in pixels
|
|
|
|
:param rotation: clockwise rotation in degrees
|
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2016-09-15 18:26:43 +10:00
|
|
|
|
|
|
|
QgsMapToPixel( double mapUnitsPerPixel );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param mapUnitsPerPixel: Map units per pixel
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2016-09-15 18:26:43 +10:00
|
|
|
|
2016-10-02 22:10:01 +11:00
|
|
|
static QgsMapToPixel fromScale( double scale, QgsUnitTypes::DistanceUnit mapUnits, double dpi = 96 );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a new QgsMapToPixel created using a specified ``scale`` and distance unit.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param scale: map scale denominator, e.g. 1000.0 for a 1:1000 map.
|
|
|
|
:param dpi: screen DPI
|
|
|
|
:param mapUnits: map units
|
|
|
|
|
|
|
|
:return: matching QgsMapToPixel
|
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-10-02 22:10:01 +11:00
|
|
|
|
2016-09-15 18:26:43 +10:00
|
|
|
QgsMapToPixel();
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor
|
2017-05-14 09:48:41 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Use setParameters to fill
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY transform( const QgsPointXY &p ) const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Transform the point from map (world) coordinates to device coordinates
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param p: Point to transform
|
|
|
|
|
|
|
|
:return: QgsPointXY in device coordinates
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
void transform( QgsPointXY *p ) const;
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY transform( qreal x, qreal y ) const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Transform the point specified by x,y from map (world)
|
|
|
|
coordinates to device coordinates
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param x: x cordinate o point to transform
|
|
|
|
:param y: y coordinate of point to transform
|
|
|
|
|
|
|
|
:return: QgsPointXY in device coordinates
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void transformInPlace( double &x, double &y ) const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Transform device coordinates to map coordinates. Modifies the
|
|
|
|
given coordinates in place. Intended as a fast way to do the
|
|
|
|
transform.
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toMapCoordinates( int x, int y ) const;
|
2010-10-23 09:50:23 +00:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toMapCoordinatesF( double x, double y ) const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
|
|
|
Transform device coordinates to map (world) coordinates
|
|
|
|
%End
|
2010-10-23 09:50:23 +00:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toMapCoordinates( QPoint p ) const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Transform device coordinates to map (world) coordinates
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param p: Point to be converted to map cooordinates
|
|
|
|
|
|
|
|
:return: QgsPointXY in map coorndiates
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY toMapPoint( double x, double y ) const;
|
2014-10-03 15:52:18 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setMapUnitsPerPixel( double mapUnitsPerPixel );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set map units per pixel
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param mapUnitsPerPixel: Map units per pixel
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
double mapUnitsPerPixel() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns current map units per pixel
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2015-02-03 02:21:52 +01:00
|
|
|
int mapWidth() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns current map width in pixels
|
2017-12-15 10:36:55 -04:00
|
|
|
The information is only known if setRotation was used
|
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2015-02-03 02:21:52 +01:00
|
|
|
|
|
|
|
int mapHeight() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns current map height in pixels
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2015-02-03 02:21:52 +01:00
|
|
|
|
|
|
|
void setMapRotation( double degrees, double cx, double cy );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set map rotation in degrees (clockwise)
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param degrees: clockwise rotation in degrees
|
|
|
|
:param cx: X ordinate of map center in geographical units
|
|
|
|
:param cy: Y ordinate of map center in geographical units
|
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2015-02-03 02:21:52 +01:00
|
|
|
|
|
|
|
double mapRotation() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns current map rotation in degrees
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2015-02-03 02:21:52 +01:00
|
|
|
|
2016-09-15 18:26:43 +10:00
|
|
|
void setParameters( double mapUnitsPerPixel, double centerX, double centerY, int widthPixels, int heightPixels, double rotation );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set parameters for use in transforming coordinates
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param mapUnitsPerPixel: Map units per pixel
|
|
|
|
:param centerX: X coordinate of map center, in geographical units
|
|
|
|
:param centerY: Y coordinate of map center, in geographical units
|
|
|
|
:param widthPixels: Output width, in pixels
|
|
|
|
:param heightPixels: Output height, in pixels
|
|
|
|
:param rotation: clockwise rotation in degrees
|
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 2.8
|
|
|
|
%End
|
2015-02-03 02:21:52 +01:00
|
|
|
|
2015-02-08 22:03:33 +01:00
|
|
|
QString showParameters() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
|
|
|
String representation of the parameters used in the transform
|
|
|
|
%End
|
2007-01-09 02:39:15 +00:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
QTransform transform() const;
|
2016-09-15 18:26:43 +10:00
|
|
|
|
|
|
|
double xCenter() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the center x-coordinate for the transform.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`yCenter`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-09-15 18:26:43 +10:00
|
|
|
|
|
|
|
double yCenter() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the center y-coordinate for the transform.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`xCenter`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2007-01-09 02:39:15 +00:00
|
|
|
};
|
2017-05-14 09:48:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgsmaptopixel.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|