58 QgsMapToPixel(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
92 transformInPlace( x, y );
103 transformInPlace( x, y );
116 transformInPlace( x, y );
129 mMatrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
144 double mx = x, my = y;
145 transformInPlace( mx, my );
162 assert( x.size() == y.size() );
165 const auto size = x.size();
166 for (
int i = 0; i < size; ++i )
167 transformInPlace( *xData++, *yData++ );
176 return toMapCoordinates(
static_cast<double>( x ),
static_cast<double>( y ) );
185 const QTransform matrix = mMatrix.inverted( &invertible );
186 assert( invertible );
188 matrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
200 const QgsPointXY mapPt = toMapCoordinates(
static_cast<double>( p.x() ),
static_cast<double>( p.y() ) );
211 return toMapCoordinates( x, y );
223 void setMapUnitsPerPixel(
double mapUnitsPerPixel );
259 void setMapRotation(
double degrees,
double cx,
double cy );
282 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
299 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation,
bool *ok )
SIP_SKIP;
304 QString showParameters()
const;
309 QTransform transform()
const;
325 return mValid == other.mValid
326 && mMapUnitsPerPixel == other.mMapUnitsPerPixel
327 && mWidth == other.mWidth
328 && mHeight == other.mHeight
329 && mRotation == other.mRotation
330 && mXCenter == other.mXCenter
331 && mYCenter == other.mYCenter
332 && mXMin == other.mXMin
333 && mYMin == other.mYMin;
338 return !( *
this == other );
343 double mMapUnitsPerPixel = 1;
346 double mRotation = 0.0;
347 double mXCenter = 0.5;
348 double mYCenter = 0.5;
DistanceUnit
Units of distance.
Perform transforms between map coordinates and device coordinates.
bool isValid() const
Returns true if the object is valid (i.e.
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
Transforms the point specified by x,y from map (world) coordinates to device coordinates.
QgsPointXY toMapCoordinates(double x, double y) const
Transforms device coordinates to map (world) coordinates.
double mapUnitsPerPixel() const
Returns the current map units per pixel.
bool operator==(const QgsMapToPixel &other) const
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
int mapWidth() const
Returns the current map width in pixels.
QgsPointXY transform(const QgsPointXY &p) const
Transforms a point p from map (world) coordinates to device coordinates.
void transform(QgsPointXY *p) const
Transforms a point p from map (world) coordinates to device coordinates in place.
void transformInPlace(QVector< T > &x, QVector< T > &y) const
Transforms device coordinates to map coordinates.
double mapRotation() const
Returns the 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
Transforms device coordinates to map (world) coordinates.
Q_DECL_DEPRECATED QgsPointXY toMapPoint(double x, double y) const
Transforms device coordinates to map (world) coordinates.
A class to represent a 2D point.
void set(double x, double y)
Sets the x and y value of the point.