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() );
167 const auto size = x.size();
168 for (
int i = 0; i < size; ++i )
169 transformInPlace( *xData++, *yData++ );
178 return toMapCoordinates(
static_cast<double>( x ),
static_cast<double>( y ) );
187 const QTransform matrix = mMatrix.inverted( &invertible );
188 assert( invertible );
190 matrix.map(
static_cast< qreal
>( x ),
static_cast< qreal
>( y ), &mx, &my );
202 const QgsPointXY mapPt = toMapCoordinates(
static_cast<double>( p.x() ),
static_cast<double>( p.y() ) );
213 return toMapCoordinates( x, y );
225 void setMapUnitsPerPixel(
double mapUnitsPerPixel );
264 void setMapRotation(
double degrees,
double cx,
double cy );
289 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation );
306 void setParameters(
double mapUnitsPerPixel,
double centerX,
double centerY,
int widthPixels,
int heightPixels,
double rotation,
bool *ok )
SIP_SKIP;
311 QString showParameters()
const;
316 QTransform transform()
const;
334 return mValid == other.mValid
335 && mMapUnitsPerPixel == other.mMapUnitsPerPixel
336 && mWidth == other.mWidth
337 && mHeight == other.mHeight
338 && mRotation == other.mRotation
339 && mXCenter == other.mXCenter
340 && mYCenter == other.mYCenter
341 && mXMin == other.mXMin
342 && mYMin == other.mYMin;
347 return !( *
this == other );
352 double mMapUnitsPerPixel = 1;
355 double mRotation = 0.0;
356 double mXCenter = 0.5;
357 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.