QgsMapToPixel Class Reference
[QGIS core library]

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

#include <qgsmaptopixel.h>

List of all members.

Public Member Functions

 QgsMapToPixel (double mapUnitsPerPixel=0, double ymax=0, double ymin=0, double xmin=0)
 ~QgsMapToPixel ()
 destructor
QgsPoint transform (const QgsPoint &p) const
void transform (QgsPoint *p) const
QgsPoint transform (double x, double y) const
void transformInPlace (double &x, double &y) const
void transformInPlace (std::vector< double > &x, std::vector< double > &y) const
QgsPoint toMapCoordinates (int x, int y) const
QgsPoint toMapCoordinatesF (double x, double y) const
QgsPoint toMapCoordinates (QPoint p) const
QgsPoint toMapPoint (double x, double y) const
void setMapUnitsPerPixel (double mapUnitsPerPixel)
double mapUnitsPerPixel () const
 Return current map units per pixel.
void setYMaximum (double ymax)
 Set maximum y value.
void setYMinimum (double ymin)
 Set minimum y value.
void setXMinimum (double xmin)
 set minimum x value
void setParameters (double mapUnitsPerPixel, double xmin, double ymin, double ymax)
QString showParameters ()
 String representation of the parameters used in the transform.

Private Attributes

double mMapUnitsPerPixel
double yMax
double yMin
double xMin
double xMax


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 = 0,
double  ymax = 0,
double  ymin = 0,
double  xmin = 0 
)

Definition at line 23 of file qgsmaptopixel.cpp.

QgsMapToPixel::~QgsMapToPixel (  ) 

destructor

Definition at line 35 of file qgsmaptopixel.cpp.


Member Function Documentation

QgsPoint QgsMapToPixel::transform ( const QgsPoint p  )  const

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

Parameters:
p Point to transform
Returns:
QgsPoint in device coordinates

Definition at line 112 of file qgsmaptopixel.cpp.

References transformInPlace(), QgsPoint::x(), and QgsPoint::y().

Referenced by QgsRasterLayer::draw(), QgsMapOverviewCanvas::drawExtentRect(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelCandidateRect(), and QgsLabel::renderLabel().

void QgsMapToPixel::transform ( QgsPoint p  )  const

Definition at line 122 of file qgsmaptopixel.cpp.

References QgsPoint::set(), transformInPlace(), QgsPoint::x(), and QgsPoint::y().

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

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

Parameters:
x x cordinate o point to transform
y y coordinate of point to transform
Returns:
QgsPoint in device coordinates

Definition at line 106 of file qgsmaptopixel.cpp.

References transformInPlace().

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

Tranform device coordinates to map (world) coordinates

Parameters:
x x coordinate of point to be converted to map cooordinates
y y coordinate of point to be converted to map cooordinates
Returns:
QgsPoint in map coordinates

Definition at line 134 of file qgsmaptopixel.cpp.

References mMapUnitsPerPixel, xMin, yMax, and yMin.

Referenced by QgsFeatureRendererV2::_getLineString(), QgsFeatureRendererV2::_getPoint(), QgsFeatureRendererV2::_getPolygon(), QgsMapTool::toCanvasCoordinates(), QgsMapCanvasItem::toCanvasCoordinates(), transform(), transformInPlace(), QgsVectorLayer::transformPoint(), and QgsVectorLayer::transformPoints().

void QgsMapToPixel::transformInPlace ( std::vector< double > &  x,
std::vector< double > &  y 
) const

Definition at line 140 of file qgsmaptopixel.cpp.

References transformInPlace().

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

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

Transform device coordinates to map (world) coordinates

Note:
: this method was added in version 1.6

Definition at line 57 of file qgsmaptopixel.cpp.

References toMapPoint().

Referenced by QgsPalGeometry::info().

QgsPoint QgsMapToPixel::toMapCoordinates ( QPoint  p  )  const

Tranform device coordinates to map (world) coordinates

Parameters:
p Point to be converted to map cooordinates
Returns:
QgsPoint in map coorndiates

Definition at line 46 of file qgsmaptopixel.cpp.

References toMapPoint().

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

void QgsMapToPixel::setMapUnitsPerPixel ( double  mapUnitsPerPixel  ) 

Set map units per pixel

Parameters:
mapUnitsPerPixel Map units per pixel

Definition at line 62 of file qgsmaptopixel.cpp.

References mMapUnitsPerPixel.

Referenced by QgsMapRenderer::render().

double QgsMapToPixel::mapUnitsPerPixel (  )  const

void QgsMapToPixel::setYMaximum ( double  ymax  ) 

Set maximum y value.

Definition at line 72 of file qgsmaptopixel.cpp.

References yMax.

Referenced by QgsMapRenderer::render().

void QgsMapToPixel::setYMinimum ( double  ymin  ) 

Set minimum y value.

Definition at line 77 of file qgsmaptopixel.cpp.

References yMin.

void QgsMapToPixel::setXMinimum ( double  xmin  ) 

set minimum x value

Definition at line 82 of file qgsmaptopixel.cpp.

References xMin.

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

Set parameters for use in tranfsorming coordinates

Parameters:
mapUnitsPerPixel Map units per pixel
xmin Minimum x value
ymin Minimum y value
ymax Maximum y value

Definition at line 87 of file qgsmaptopixel.cpp.

References mMapUnitsPerPixel, xMin, yMax, and yMin.

Referenced by QgsMapRenderer::adjustExtentToSize().

QString QgsMapToPixel::showParameters (  ) 

String representation of the parameters used in the transform.

Definition at line 96 of file qgsmaptopixel.cpp.

References mMapUnitsPerPixel, xMin, yMax, and yMin.


Member Data Documentation

double QgsMapToPixel::yMax [private]

double QgsMapToPixel::yMin [private]

double QgsMapToPixel::xMin [private]

double QgsMapToPixel::xMax [private]

Definition at line 119 of file qgsmaptopixel.h.


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

Generated on Sat Feb 4 19:17:40 2012 for Quantum GIS API Documentation by  doxygen 1.5.6