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;
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) SIP_HOLDGIL
Sets the x and y value of the point.
DistanceUnit
Units of distance.