QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
QgsMapToPixel Class Reference

Perform transforms between map coordinates and device coordinates. More...

#include <qgsmaptopixel.h>

Public Member Functions

 QgsMapToPixel (double mapUnitsPerPixel, double height=0, double ymin=0, double xmin=0)
 
 QgsMapToPixel (double mapUnitsPerPixel, double xc, double yc, int width, int height, double rotation)
 
 QgsMapToPixel ()
 
 ~QgsMapToPixel ()
 destructor More...
 
int mapHeight () const
 Return current map height in pixels. More...
 
double mapRotation () const
 Return current map rotation in degrees. More...
 
double mapUnitsPerPixel () const
 Return current map units per pixel. More...
 
int mapWidth () const
 Return current map width in pixels The information is only known if setRotation was used. More...
 
void setMapRotation (double degrees, double cx, double cy)
 Set map rotation in degrees (clockwise) More...
 
void setMapUnitsPerPixel (double mapUnitsPerPixel)
 
void setParameters (double mapUnitsPerPixel, double xmin, double ymin, double height)
 
void setParameters (double mapUnitsPerPixel, double xc, double yc, int width, int height, double rotation)
 
void setXMinimum (double xmin)
 set minimum x value More...
 
void setYMaximum (double yMax)
 Set maximum y value. More...
 
void setYMinimum (double ymin)
 Set minimum y value. More...
 
QString showParameters () const
 String representation of the parameters used in the transform. More...
 
QgsPoint toMapCoordinates (int x, int y) const
 
QgsPoint toMapCoordinates (QPoint p) const
 
QgsPoint toMapCoordinatesF (double x, double y) const
 
QgsPoint toMapPoint (double x, double y) const
 
QgsPoint transform (const QgsPoint &p) const
 
void transform (QgsPoint *p) const
 
QgsPoint transform (double x, double y) const
 
void transformInPlace (qreal &x, qreal &y) const
 
template<class T >
void transformInPlace (QVector< T > &x, QVector< T > &y) const
 

Detailed Description

Perform transforms between map coordinates and device coordinates.

This class can convert device coordinates to map coordinates and vice versa.

Definition at line 34 of file qgsmaptopixel.h.

Constructor & Destructor Documentation

QgsMapToPixel::QgsMapToPixel ( double  mapUnitsPerPixel,
double  height = 0,
double  ymin = 0,
double  xmin = 0 
)

Definition at line 58 of file qgsmaptopixel.cpp.

QgsMapToPixel::QgsMapToPixel ( double  mapUnitsPerPixel,
double  xc,
double  yc,
int  width,
int  height,
double  rotation 
)

Definition at line 27 of file qgsmaptopixel.cpp.

QgsMapToPixel::QgsMapToPixel ( )

Constructor

Use setParameters to fill

Definition at line 45 of file qgsmaptopixel.cpp.

QgsMapToPixel::~QgsMapToPixel ( )

destructor

Definition at line 74 of file qgsmaptopixel.cpp.

Member Function Documentation

int QgsMapToPixel::mapHeight ( ) const

Return current map height in pixels.

Note
added in 2.8

Definition at line 78 of file qgsmaptopixel.cpp.

double QgsMapToPixel::mapRotation ( ) const

Return current map rotation in degrees.

Note
added in 2.8

Definition at line 176 of file qgsmaptopixel.cpp.

double QgsMapToPixel::mapUnitsPerPixel ( ) const

Return current map units per pixel.

Definition at line 158 of file qgsmaptopixel.cpp.

int QgsMapToPixel::mapWidth ( ) const

Return current map width in pixels The information is only known if setRotation was used.

Note
added in 2.8

Definition at line 83 of file qgsmaptopixel.cpp.

void QgsMapToPixel::setMapRotation ( double  degrees,
double  cx,
double  cy 
)

Set map rotation in degrees (clockwise)

Parameters
degreesclockwise rotation in degrees
cxX ordinate of map center in geographical units
cyY ordinate of map center in geographical units
Note
added in 2.8

Definition at line 163 of file qgsmaptopixel.cpp.

void QgsMapToPixel::setMapUnitsPerPixel ( double  mapUnitsPerPixel)

Set map units per pixel

Parameters
mapUnitsPerPixelMap units per pixel

Definition at line 152 of file qgsmaptopixel.cpp.

void QgsMapToPixel::setParameters ( double  mapUnitsPerPixel,
double  xmin,
double  ymin,
double  height 
)

Set parameters for use in transforming coordinates

Parameters
mapUnitsPerPixelMap units per pixel
xminMinimum x value
yminMinimum y value
heightMap height, in pixels
Deprecated:
in 2.8, use the version with full parameters

Definition at line 198 of file qgsmaptopixel.cpp.

void QgsMapToPixel::setParameters ( double  mapUnitsPerPixel,
double  xc,
double  yc,
int  width,
int  height,
double  rotation 
)

Set parameters for use in transforming coordinates

Parameters
mapUnitsPerPixelMap units per pixel
xcX ordinate of map center, in geographical units
ycY ordinate of map center, in geographical units
widthOutput width, in pixels
heightOutput height, in pixels
rotationclockwise rotation in degrees
Note
added in 2.8

Definition at line 210 of file qgsmaptopixel.cpp.

void QgsMapToPixel::setXMinimum ( double  xmin)

set minimum x value

Definition at line 190 of file qgsmaptopixel.cpp.

void QgsMapToPixel::setYMaximum ( double  yMax)
inline

Set maximum y value.

Definition at line 146 of file qgsmaptopixel.h.

void QgsMapToPixel::setYMinimum ( double  ymin)

Set minimum y value.

Definition at line 182 of file qgsmaptopixel.cpp.

QString QgsMapToPixel::showParameters ( ) const

String representation of the parameters used in the transform.

Definition at line 228 of file qgsmaptopixel.cpp.

QgsPoint QgsMapToPixel::toMapCoordinates ( int  x,
int  y 
) const

Definition at line 142 of file qgsmaptopixel.cpp.

QgsPoint QgsMapToPixel::toMapCoordinates ( QPoint  p) const

Transform device coordinates to map (world) coordinates

Parameters
pPoint to be converted to map cooordinates
Returns
QgsPoint in map coorndiates

Definition at line 136 of file qgsmaptopixel.cpp.

QgsPoint QgsMapToPixel::toMapCoordinatesF ( double  x,
double  y 
) const

Transform device coordinates to map (world) coordinates

Definition at line 147 of file qgsmaptopixel.cpp.

QgsPoint QgsMapToPixel::toMapPoint ( double  x,
double  y 
) const

Definition at line 122 of file qgsmaptopixel.cpp.

QgsPoint QgsMapToPixel::transform ( const QgsPoint p) const

Transform the point from map (world) coordinates to device coordinates

Parameters
pPoint to transform
Returns
QgsPoint in device coordinates

Definition at line 246 of file qgsmaptopixel.cpp.

void QgsMapToPixel::transform ( QgsPoint p) const

Definition at line 256 of file qgsmaptopixel.cpp.

QgsPoint QgsMapToPixel::transform ( double  x,
double  y 
) const

Transform the point specified by x,y from map (world) coordinates to device coordinates

Parameters
xx cordinate o point to transform
yy coordinate of point to transform
Returns
QgsPoint in device coordinates

Definition at line 240 of file qgsmaptopixel.cpp.

void QgsMapToPixel::transformInPlace ( qreal &  x,
qreal &  y 
) const

Transform device coordinates to map (world) coordinates

Parameters
xx coordinate of point to be converted to map cooordinates
yy coordinate of point to be converted to map cooordinates
Returns
QgsPoint in map coordinates

Definition at line 268 of file qgsmaptopixel.cpp.

template<class T >
void QgsMapToPixel::transformInPlace ( QVector< T > &  x,
QVector< T > &  y 
) const
inline

Definition at line 95 of file qgsmaptopixel.h.


The documentation for this class was generated from the following files: