QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
20 #include "qgis_core.h"
59 QgsMapToPixel(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
94 transformInPlace( x, y );
105 transformInPlace( x, y );
118 transformInPlace( x, y );
131 mMatrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
146 double mx = x, my = y;
147 transformInPlace( mx, my );
164 assert( x.size() == y.size() );
165 for (
int i = 0; i < x.size(); ++i )
166 transformInPlace( x[i], y[i] );
175 return toMapCoordinates(
static_cast<double>( x ),
static_cast<double>( y ) );
184 const QTransform matrix = mMatrix.inverted( &invertible );
185 assert( invertible );
187 matrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
199 const QgsPointXY mapPt = toMapCoordinates(
static_cast<double>( p.x() ),
static_cast<double>( p.y() ) );
210 return toMapCoordinates( x, y );
222 void setMapUnitsPerPixel(
double mapUnitsPerPixel );
261 void setMapRotation(
double degrees,
double cx,
double cy );
286 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
303 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation,
bool *ok )
SIP_SKIP;
308 QString showParameters()
const;
313 QTransform transform()
const;
331 return mValid == other.mValid
332 && mMapUnitsPerPixel == other.mMapUnitsPerPixel
333 && mWidth == other.mWidth
334 && mHeight == other.mHeight
335 && mRotation == other.mRotation
336 && mXCenter == other.mXCenter
337 && mYCenter == other.mYCenter
338 && mXMin == other.mXMin
339 && mYMin == other.mYMin;
344 return !( *
this == other );
349 double mMapUnitsPerPixel = 1;
352 double mRotation = 0.0;
353 double mXCenter = 0.5;
354 double mYCenter = 0.5;
363 #endif // QGSMAPTOPIXEL
void transformInPlace(QVector< T > &x, QVector< T > &y) const
Transforms device coordinates to map coordinates.
double mapUnitsPerPixel() const
Returns the current map units per pixel.
double xCenter() const
Returns the center x-coordinate for the transform.
bool operator!=(const QgsMapToPixel &other) const
DistanceUnit
Units of distance.
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
double yCenter() const
Returns the center y-coordinate for the transform.
void set(double x, double y) SIP_HOLDGIL
Sets the x and y value of the point.
QgsPointXY toMapCoordinates(double x, double y) const
Transforms device coordinates to map (world) coordinates.
void transformInPlace(float &x, float &y) const
Transforms device coordinates to map coordinates.
int mapHeight() const
Returns current map height in pixels.
double mapRotation() const
Returns the current map rotation in degrees (clockwise).
void transform(QgsPointXY *p) const
Transforms a point p from map (world) coordinates to device coordinates in place.
QgsPointXY transform(const QgsPointXY &p) const
Transforms a point p from map (world) coordinates to device coordinates.
A class to represent a 2D point.
void transformInPlace(double &x, double &y) const
Transforms device coordinates to map coordinates.
Perform transforms between map coordinates and device coordinates.
int mapWidth() const
Returns the current map width in pixels.
QgsPointXY transform(qreal x, qreal y) const
Transforms the point specified by x,y from map (world) coordinates to device coordinates.
Q_DECL_DEPRECATED QgsPointXY toMapPoint(double x, double y) const
Transforms device coordinates to map (world) coordinates.
QgsPointXY toMapCoordinates(QPoint p) const
Transforms device coordinates to map (world) coordinates.
bool operator==(const QgsMapToPixel &other) const
bool isValid() const
Returns true if the object is valid (i.e.