20 #include "qgis_core.h"
52 QgsMapToPixel(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
86 transformInPlace( x, y );
97 transformInPlace( x, y );
110 transformInPlace( x, y );
122 mMatrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
135 double mx = x, my = y;
136 transformInPlace( mx, my );
152 assert( x.size() == y.size() );
153 for (
int i = 0; i < x.size(); ++i )
154 transformInPlace( x[i], y[i] );
161 return toMapCoordinates(
static_cast<double>( x ),
static_cast<double>( y ) );
168 QTransform matrix = mMatrix.inverted( &invertible );
169 assert( invertible );
171 matrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
182 QgsPointXY mapPt = toMapCoordinates(
static_cast<double>( p.x() ),
static_cast<double>( p.y() ) );
192 return toMapCoordinates( x, y );
199 void setMapUnitsPerPixel(
double mapUnitsPerPixel );
224 void setMapRotation(
double degrees,
double cx,
double cy );
244 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
258 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation,
bool *ok )
SIP_SKIP;
261 QString showParameters()
const;
266 QTransform transform()
const;
284 return mMapUnitsPerPixel == other.mMapUnitsPerPixel
285 && mWidth == other.mWidth
286 && mHeight == other.mHeight
287 && mRotation == other.mRotation
288 && mXCenter == other.mXCenter
289 && mYCenter == other.mYCenter
290 && mXMin == other.mXMin
291 && mYMin == other.mYMin;
296 return !( *
this == other );
300 double mMapUnitsPerPixel = 1;
303 double mRotation = 0.0;
304 double mXCenter = 0.5;
305 double mYCenter = 0.5;
Perform transforms between map coordinates and device coordinates.
int mapHeight() const
Returns current map height in pixels.
double xCenter() const
Returns the center x-coordinate for the transform.
double yCenter() const
Returns the center y-coordinate for the transform.
QgsPointXY transform(qreal x, qreal y) const
Transform the point specified by x,y from map (world) coordinates to device coordinates.
QgsPointXY toMapCoordinates(double x, double y) const
Transform device coordinates to map (world) coordinates.
double mapUnitsPerPixel() const
Returns current map units per pixel.
bool operator==(const QgsMapToPixel &other) const
QgsPointXY toMapCoordinates(int x, int y) const
Transform device coordinates to map (world) coordinates.
int mapWidth() const
Returns current map width in pixels The information is only known if setRotation was used.
QgsPointXY transform(const QgsPointXY &p) const
Transform the point p from map (world) coordinates to device coordinates.
void transform(QgsPointXY *p) const
Transform the point p from map (world) coordinates to device coordinates in place.
void transformInPlace(QVector< T > &x, QVector< T > &y) const
Transform device coordinates to map coordinates.
double mapRotation() const
Returns current map rotation in degrees (clockwise)
bool operator!=(const QgsMapToPixel &other) const
void transformInPlace(double &x, double &y) const
Transforms device coordinates to map coordinates.
void transformInPlace(float &x, float &y) const
Transforms device coordinates to map coordinates.
QgsPointXY toMapCoordinates(QPoint p) const
Transform device coordinates to map (world) coordinates.
Q_DECL_DEPRECATED QgsPointXY toMapPoint(double x, double y) const
Transform device coordinates to map (world) coordinates.
A class to represent a 2D point.
void set(double x, double y) SIP_HOLDGIL
Sets the x and y value of the point.
DistanceUnit
Units of distance.