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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmaptopixel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsMapToPixel
{
%Docstring(signature="appended")
Perform transforms between map coordinates and device coordinates.
This class can convert device coordinates to map coordinates and vice
versa.
%End
%TypeHeaderCode
#include "qgsmaptopixel.h"
%End
public:
QgsMapToPixel();
%Docstring
Constructor for an invalid QgsMapToPixel.
A manual call to :py:func:`~QgsMapToPixel.setParameters` is required to
initialize the object.
%End
QgsMapToPixel( double mapUnitsPerPixel, double centerX, double centerY, int widthPixels, int heightPixels, double rotation );
%Docstring
Constructor
: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
%End
QgsMapToPixel( double mapUnitsPerPixel );
%Docstring
Constructor
:param mapUnitsPerPixel: Map units per pixel
%End
static QgsMapToPixel fromScale( double scale, Qgis::DistanceUnit mapUnits, double dpi = 96 );
%Docstring
Returns a new QgsMapToPixel created using a specified ``scale`` and
distance unit.
: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
%End
bool isValid() const;
%Docstring
Returns ``True`` if the object is valid (i.e. it has parameters set), or
``False`` if the object is default constructed with no parameters set.
.. versionadded:: 3.22
%End
QgsPointXY transform( const QgsPointXY &p ) const;
%Docstring
Transforms a point ``p`` from map (world) coordinates to device
coordinates.
:param p: Point to transform
:return: :py:class:`QgsPointXY` in device coordinates
%End
void transform( QgsPointXY *p ) const;
%Docstring
Transforms a point ``p`` from map (world) coordinates to device
coordinates in place.
%End
QgsPointXY transform( qreal x, qreal y ) const;
%Docstring
Transforms the point specified by x,y from map (world) coordinates to
device coordinates.
:param x: x coordinate of point to transform
:param y: y coordinate of point to transform
:return: :py:class:`QgsPointXY` in device coordinates
%End
void transformInPlace( double &x, double &y ) const;
%Docstring
Transforms map coordinates to device coordinates.
This method modifies the given coordinates in place. It is intended as a
fast way to do the transform.
%End
QRectF transformBounds( const QRectF &bounds ) const;
%Docstring
Transforms a bounding box from map coordinates to device coordinates.
The returns bounding box will always completely enclose the transformed
input bounding box (i.e. this method will grow the bounds wherever
required).
.. versionadded:: 3.40
%End
QgsPointXY toMapCoordinates( int x, int y ) const;
%Docstring
Transforms device coordinates to map (world) coordinates.
%End
QgsPointXY toMapCoordinates( double x, double y ) const /PyName=toMapCoordinatesF/;
%Docstring
Transforms device coordinates to map (world) coordinates.
%End
QgsPointXY toMapCoordinates( QPoint p ) const;
%Docstring
Transforms device coordinates to map (world) coordinates.
:param p: Point to be converted to map cooordinates
:return: :py:class:`QgsPointXY` in map coorndiates
%End
QgsPointXY toMapPoint( double x, double y ) const /Deprecated/;
%Docstring
Transforms device coordinates to map (world) coordinates.
.. deprecated:: 3.4
Use toMapCoordinates instead.
%End
void setMapUnitsPerPixel( double mapUnitsPerPixel );
%Docstring
Sets the map units per pixel.
Calling this method will automatically set the object as valid.
:param mapUnitsPerPixel: Map units per pixel
.. seealso:: :py:func:`mapUnitsPerPixel`
%End
double mapUnitsPerPixel() const;
%Docstring
Returns the current map units per pixel.
.. seealso:: :py:func:`setMapUnitsPerPixel`
%End
int mapWidth() const;
%Docstring
Returns the current map width in pixels.
The information is only known if setRotation was used.
.. seealso:: :py:func:`mapHeight`
%End
int mapHeight() const;
%Docstring
Returns current map height in pixels
.. seealso:: :py:func:`mapWidth`
%End
void setMapRotation( double degrees, double cx, double cy );
%Docstring
Sets map rotation in ``degrees`` (clockwise).
Calling this method will automatically set the object as valid.
: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
.. seealso:: :py:func:`mapRotation`
%End
double mapRotation() const;
%Docstring
Returns the current map rotation in degrees (clockwise).
.. seealso:: :py:func:`setMapRotation`
%End
void setParameters( double mapUnitsPerPixel, double centerX, double centerY, int widthPixels, int heightPixels, double rotation );
%Docstring
Sets parameters for use in transforming coordinates.
Calling this method will automatically set the object as valid.
: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
.. note::
if the specified parameters result in an invalid transform then no changes will be applied to the object
%End
QString showParameters() const;
%Docstring
Returns a string representation of the parameters used in the transform.
%End
QTransform transform() const;
%Docstring
Returns a QTransform encapsulating the map to pixel conversion.
%End
double xCenter() const;
%Docstring
Returns the center x-coordinate for the transform.
.. seealso:: :py:func:`yCenter`
%End
double yCenter() const;
%Docstring
Returns the center y-coordinate for the transform.
.. seealso:: :py:func:`xCenter`
%End
bool operator==( const QgsMapToPixel &other ) const;
bool operator!=( const QgsMapToPixel &other ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmaptopixel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|