QGIS API Documentation
2.2.0-Valmiera
|
Perform transforms between map coordinates and device coordinates. More...
#include <qgsmaptopixel.h>
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 (QVector< double > &x, QVector< 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 |
Perform transforms between map coordinates and device coordinates.
This class can convert device coordinates to map coordinates and vice versa.
Definition at line 33 of file qgsmaptopixel.h.
QgsMapToPixel::QgsMapToPixel | ( | double | mapUnitsPerPixel = 0 , |
double | ymax = 0 , |
||
double | ymin = 0 , |
||
double | xmin = 0 |
||
) |
Definition at line 25 of file qgsmaptopixel.cpp.
QgsMapToPixel::~QgsMapToPixel | ( | ) |
destructor
Definition at line 36 of file qgsmaptopixel.cpp.
double QgsMapToPixel::mapUnitsPerPixel | ( | ) | const |
Return current map units per pixel.
Definition at line 68 of file qgsmaptopixel.cpp.
References mMapUnitsPerPixel.
Referenced by QgsLinePatternFillSymbolLayer::applyPattern(), QgsPointPatternFillSymbolLayer::applyPattern(), QgsPalLayerSettings::checkMinimumSizeMM(), QgsDiagramRendererV2::convertSizeToMapUnits(), QgsRasterLayer::draw(), QgsVectorLayer::draw(), QgsPalLabeling::drawLabelBackground(), QgsSymbolLayerV2Utils::lineWidthScaleFactor(), QgsSymbolLayerV2Utils::pixelSizeScaleFactor(), QgsPalLayerSettings::registerFeature(), QgsMapRenderer::render(), QgsPalLayerSettings::scaleToPixelContext(), setMapUnitsPerPixel(), and setParameters().
void QgsMapToPixel::setMapUnitsPerPixel | ( | double | mapUnitsPerPixel | ) |
Set map units per pixel
mapUnitsPerPixel | Map units per pixel |
Definition at line 63 of file qgsmaptopixel.cpp.
References mapUnitsPerPixel(), and mMapUnitsPerPixel.
Referenced by QgsMapRenderer::render().
void QgsMapToPixel::setParameters | ( | double | mapUnitsPerPixel, |
double | xmin, | ||
double | ymin, | ||
double | ymax | ||
) |
Set parameters for use in tranfsorming coordinates
mapUnitsPerPixel | Map units per pixel |
xmin | Minimum x value |
ymin | Minimum y value |
ymax | Maximum y value |
Definition at line 88 of file qgsmaptopixel.cpp.
References mapUnitsPerPixel(), mMapUnitsPerPixel, xMin, yMax, and yMin.
Referenced by QgsMapRenderer::adjustExtentToSize().
void QgsMapToPixel::setXMinimum | ( | double | xmin | ) |
void QgsMapToPixel::setYMaximum | ( | double | ymax | ) |
Set maximum y value.
Definition at line 73 of file qgsmaptopixel.cpp.
References yMax.
Referenced by QgsMapRenderer::render().
void QgsMapToPixel::setYMinimum | ( | double | ymin | ) |
QString QgsMapToPixel::showParameters | ( | ) |
String representation of the parameters used in the transform.
Definition at line 97 of file qgsmaptopixel.cpp.
References mMapUnitsPerPixel, xMin, yMax, and yMin.
QgsPoint QgsMapToPixel::toMapCoordinates | ( | int | x, |
int | y | ||
) | const |
Definition at line 53 of file qgsmaptopixel.cpp.
References toMapPoint().
Referenced by QgsMapToolZoom::canvasReleaseEvent(), QgsMapToolIdentify::identify(), QgsPalGeometry::info(), QgsMapCanvas::mouseMoveEvent(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsMapCanvas::panActionEnd(), QgsPalLabeling::prepareLayer(), QgsRubberBand::setToCanvasRectangle(), QgsSnapper::snapPoint(), QgsTolerance::toLayerCoordinates(), QgsMapCanvasItem::toMapCoordinates(), and QgsMapTool::toMapCoordinates().
QgsPoint QgsMapToPixel::toMapCoordinates | ( | QPoint | p | ) | const |
Tranform device coordinates to map (world) coordinates
p | Point to be converted to map cooordinates |
Definition at line 47 of file qgsmaptopixel.cpp.
References toMapPoint().
QgsPoint QgsMapToPixel::toMapCoordinatesF | ( | double | x, |
double | y | ||
) | const |
Transform device coordinates to map (world) coordinates
Definition at line 58 of file qgsmaptopixel.cpp.
References toMapPoint().
Referenced by QgsPalLayerSettings::calculateLabelSize(), QgsRasterLayer::draw(), and QgsPalGeometry::info().
QgsPoint QgsMapToPixel::toMapPoint | ( | double | x, |
double | y | ||
) | const |
Definition at line 40 of file qgsmaptopixel.cpp.
References mMapUnitsPerPixel, xMin, yMax, and yMin.
Referenced by QgsMapToolPan::canvasReleaseEvent(), QgsMapToolTouch::canvasReleaseEvent(), QgsMapToolTouch::pinchTriggered(), toMapCoordinates(), toMapCoordinatesF(), and QgsMapCanvas::zoomWithCenter().
Transform the point from map (world) coordinates to device coordinates
p | Point to transform |
Definition at line 113 of file qgsmaptopixel.cpp.
References transformInPlace(), QgsPoint::x(), and QgsPoint::y().
Referenced by QgsRasterLayer::draw(), QgsMapOverviewCanvas::drawExtentRect(), QgsPalLabeling::drawLabel(), QgsPalLabeling::drawLabelCandidateRect(), QgsPalLabeling::drawLabeling(), and QgsLabel::renderLabel().
void QgsMapToPixel::transform | ( | QgsPoint * | p | ) | const |
Definition at line 123 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
x | x cordinate o point to transform |
y | y coordinate of point to transform |
Definition at line 107 of file qgsmaptopixel.cpp.
References transformInPlace().
void QgsMapToPixel::transformInPlace | ( | double & | x, |
double & | y | ||
) | const |
Tranform device coordinates to map (world) coordinates
x | x coordinate of point to be converted to map cooordinates |
y | y coordinate of point to be converted to map cooordinates |
Definition at line 135 of file qgsmaptopixel.cpp.
References mMapUnitsPerPixel, xMin, yMax, and yMin.
Referenced by QgsFeatureRendererV2::_getLineString(), QgsFeatureRendererV2::_getPoint(), QgsFeatureRendererV2::_getPolygon(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapTool::toCanvasCoordinates(), transform(), and transformInPlace().
void QgsMapToPixel::transformInPlace | ( | QVector< double > & | x, |
QVector< double > & | y | ||
) | const |
Definition at line 141 of file qgsmaptopixel.cpp.
References transformInPlace().
|
private |
Definition at line 120 of file qgsmaptopixel.h.
Referenced by mapUnitsPerPixel(), setMapUnitsPerPixel(), setParameters(), showParameters(), toMapPoint(), and transformInPlace().
|
private |
Definition at line 123 of file qgsmaptopixel.h.
Referenced by setParameters(), setXMinimum(), showParameters(), toMapPoint(), and transformInPlace().
|
private |
Definition at line 121 of file qgsmaptopixel.h.
Referenced by setParameters(), setYMaximum(), showParameters(), toMapPoint(), and transformInPlace().
|
private |
Definition at line 122 of file qgsmaptopixel.h.
Referenced by setParameters(), setYMinimum(), showParameters(), toMapPoint(), and transformInPlace().