127 mMatrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
142 QPointF topLeft = bounds.topLeft();
143 QPointF topRight = bounds.topRight();
144 QPointF bottomLeft = bounds.bottomLeft();
145 QPointF bottomRight = bounds.bottomRight();
152 auto minMaxX = std::minmax( { topLeft.x(), topRight.x(), bottomLeft.x(), bottomRight.x() } );
153 auto minMaxY = std::minmax( { topLeft.y(), topRight.y(), bottomLeft.y(), bottomRight.y() } );
155 const double left = minMaxX.first;
156 const double right = minMaxX.second;
157 const double top = minMaxY.first;
158 const double bottom = minMaxY.second;
159 return QRectF( left, top, right - left, bottom - top );
172 double mx = x, my = y;
189 assert( x.size() == y.size() );
192 const auto size = x.size();
193 for (
int i = 0; i < size; ++i )
209 const QTransform matrix = mMatrix.inverted( &invertible );
210 assert( invertible );
212 matrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
244 void setMapUnitsPerPixel(
double mapUnitsPerPixel );
280 void setMapRotation(
double degrees,
double cx,
double cy );
303 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
320 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation,
bool *ok )
SIP_SKIP;
325 QString showParameters()
const;
330 QTransform transform()
const;
346 return mValid == other.mValid
347 && mMapUnitsPerPixel == other.mMapUnitsPerPixel
348 && mWidth == other.mWidth
349 && mHeight == other.mHeight
350 && mRotation == other.mRotation
351 && mXCenter == other.mXCenter
352 && mYCenter == other.mYCenter
353 && mXMin == other.mXMin
354 && mYMin == other.mYMin;
361 double mMapUnitsPerPixel = 1;
364 double mRotation = 0.0;
365 double mXCenter = 0.5;
366 double mYCenter = 0.5;
DistanceUnit
Units of distance.
QRectF transformBounds(const QRectF &bounds) const
Transforms a bounding box from map coordinates to 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.
QgsMapToPixel()
Constructor for an invalid QgsMapToPixel.
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
static QgsMapToPixel fromScale(double scale, Qgis::DistanceUnit mapUnits, double dpi=96)
Returns a new QgsMapToPixel created using a specified scale and distance unit.
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 map coordinates to device 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 map coordinates to device coordinates.
void transformInPlace(float &x, float &y) const
Transforms map coordinates to device 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.
void set(double x, double y)
Sets the x and y value of the point.