QGIS API Documentation
2.6.0-Brighton
|
A non GUI class for rendering a map layer set onto a QPainter. More...
#include <qgsmaprenderer.h>
Public Types | |
enum | OutputUnits { Millimeters, Pixels } |
Output units for pen width and point marker width/height. More... | |
enum | BlendMode { BlendNormal, BlendLighten, BlendScreen, BlendDodge, BlendAddition, BlendDarken, BlendMultiply, BlendBurn, BlendOverlay, BlendSoftLight, BlendHardLight, BlendDifference, BlendSubtract, BlendSource, BlendDestinationOver, BlendClear, BlendDestination, BlendSourceIn, BlendDestinationIn, BlendSourceOut, BlendDestinationOut, BlendSourceAtop, BlendDestinationAtop, BlendXor } |
Blending modes enum defining the available composition modes that can be used when rendering a layer. More... |
Public Slots | |
Q_DECL_DEPRECATED void | onDrawingProgress (int current, int total) |
Signals | |
void | drawingProgress (int current, int total) |
Q_DECL_DEPRECATED void | hasCrsTransformEnabled (bool flag) |
This signal is emitted when CRS transformation is enabled/disabled. | |
void | hasCrsTransformEnabledChanged (bool flag) |
This signal is emitted when CRS transformation is enabled/disabled. | |
void | destinationSrsChanged () |
void | updateMap () |
void | mapUnitsChanged () |
void | drawError (QgsMapLayer *) |
emitted when layer's draw() returned false | |
void | extentsChanged () |
emitted when the current extent gets changed | |
void | datumTransformInfoRequested (const QgsMapLayer *ml, const QString &srcAuthId, const QString &destAuthId) const |
Notifies higher level components to show the datum transform dialog and add a QgsLayerCoordinateTransformInfo for that layer. |
Public Member Functions | |
QgsMapRenderer () | |
constructor | |
~QgsMapRenderer () | |
destructor | |
void | render (QPainter *painter, double *forceWidthScale=0) |
starts rendering | |
bool | setExtent (const QgsRectangle &extent) |
sets extent and checks whether suitable (returns false if not) | |
QgsRectangle | extent () const |
returns current extent | |
const QgsMapToPixel * | coordinateTransform () |
double | scale () const |
Scale denominator. | |
void | setScale (double scale) |
Sets scale for scale based visibility. | |
double | mapUnitsPerPixel () const |
int | width () const |
int | height () const |
void | updateScale () |
Recalculate the map scale. | |
QGis::UnitType | mapUnits () const |
void | setMapUnits (QGis::UnitType u) |
void | enableOverviewMode (bool isOverview=true) |
sets whether map image will be for overview | |
void | setOutputSize (QSize size, int dpi) |
void | setOutputSize (QSizeF size, double dpi) |
double | outputDpi () |
accessor for output dpi | |
QSize | outputSize () |
accessor for output size | |
QSizeF | outputSizeF () |
QgsRectangle | layerExtentToOutputExtent (QgsMapLayer *theLayer, QgsRectangle extent) |
transform bounding box from layer's CRS to output CRS | |
QgsRectangle | outputExtentToLayerExtent (QgsMapLayer *theLayer, QgsRectangle extent) |
transform bounding box from output CRS to layer's CRS | |
QgsPoint | layerToMapCoordinates (QgsMapLayer *theLayer, QgsPoint point) |
transform point coordinates from layer's CRS to output CRS | |
QgsRectangle | layerToMapCoordinates (QgsMapLayer *theLayer, QgsRectangle rect) |
transform rectangle from layer's CRS to output CRS | |
QgsPoint | mapToLayerCoordinates (QgsMapLayer *theLayer, QgsPoint point) |
transform point coordinates from output CRS to layer's CRS | |
QgsRectangle | mapToLayerCoordinates (QgsMapLayer *theLayer, QgsRectangle rect) |
transform rectangle from output CRS to layer's CRS | |
void | setProjectionsEnabled (bool enabled) |
sets whether to use projections for this layer set | |
bool | hasCrsTransformEnabled () const |
returns true if projections are enabled for this layer set | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &crs, bool refreshCoordinateTransformInfo=true, bool transformExtent=true) |
sets destination coordinate reference system | |
const QgsCoordinateReferenceSystem & | destinationCrs () const |
returns CRS of destination coordinate reference system | |
void | setOutputUnits (OutputUnits u) |
OutputUnits | outputUnits () const |
QgsRectangle | fullExtent () |
returns current extent of layer set | |
QStringList & | layerSet () |
returns current layer set | |
void | setLayerSet (const QStringList &layers) |
change current layer set | |
void | updateFullExtent () |
updates extent of the layer set | |
bool | readXML (QDomNode &theNode) |
read settings | |
bool | writeXML (QDomNode &theNode, QDomDocument &theDoc) |
write settings | |
QgsRenderContext * | rendererContext () |
Accessor for render context. | |
QgsLabelingEngineInterface * | labelingEngine () |
Labeling engine (NULL if there's no custom engine) | |
void | setLabelingEngine (QgsLabelingEngineInterface *iface) |
Set labeling engine. | |
void | addLayerCoordinateTransform (const QString &layerId, const QString &srcAuthId, const QString &destAuthId, int srcDatumTransform=-1, int destDatumTransform=-1) |
void | clearLayerCoordinateTransforms () |
const QgsCoordinateTransform * | transformation (const QgsMapLayer *layer) const |
const QgsMapSettings & | mapSettings () |
bridge to QgsMapSettings | |
bool | splitLayersExtent (QgsMapLayer *layer, QgsRectangle &extent, QgsRectangle &r2) |
Convenience function to project an extent into the layer source CRS, but also split it into two extents if it crosses the +/- 180 degree line. |
Static Public Member Functions | |
static QPainter::CompositionMode | getCompositionMode (const QgsMapRenderer::BlendMode &blendMode) |
Returns a QPainter::CompositionMode corresponding to a BlendMode. | |
static QgsMapRenderer::BlendMode | getBlendModeEnum (const QPainter::CompositionMode &blendMode) |
Returns a BlendMode corresponding to a QPainter::CompositionMode. |
Protected Member Functions | |
void | adjustExtentToSize () |
adjust extent to fit the pixmap size |
Protected Attributes | |
double | mMapUnitsPerPixel |
map units per pixel | |
double | mScale |
Map scale denominator at its current zoom level. | |
QgsScaleCalculator * | mScaleCalculator |
scale calculator | |
QgsRectangle | mExtent |
current extent to be drawn | |
QgsRectangle | mLastExtent |
Last extent to we drew so we know if we can used layer render caching or not. | |
bool | mOverview |
indicates whether it's map image for overview | |
QSizeF | mSize |
bool | mProjectionsEnabled |
detemines whether on the fly projection support is enabled | |
QgsCoordinateReferenceSystem * | mDestCRS |
destination spatial reference system of the projection | |
QStringList | mLayerSet |
stores array of layers to be rendered (identified by string) | |
QgsRectangle | mFullExtent |
full extent of the layer set | |
QgsDistanceArea * | mDistArea |
tool for measuring | |
QgsRenderContext | mRenderContext |
Encapsulates context of rendering. | |
OutputUnits | mOutputUnits |
Output units. | |
QgsLabelingEngineInterface * | mLabelingEngine |
Labeling engine (NULL by default) | |
QMutex | mRenderMutex |
Locks rendering loop for concurrent draws. | |
QgsMapSettings | mMapSettings |
map settings - used only for export in mapSettings() for use in classes that deal with QgsMapSettings | |
QHash< QString, QgsLayerCoordinateTransform > | mLayerCoordinateTransformInfo |
Static Protected Attributes | |
static bool | mDrawing = false |
indicates drawing in progress |
A non GUI class for rendering a map layer set onto a QPainter.
Blending modes enum defining the available composition modes that can be used when rendering a layer.
QgsMapRenderer::QgsMapRenderer | ( | ) |
constructor
QgsMapRenderer::~QgsMapRenderer | ( | ) |
destructor
void QgsMapRenderer::addLayerCoordinateTransform | ( | const QString & | layerId, |
const QString & | srcAuthId, | ||
const QString & | destAuthId, | ||
int | srcDatumTransform = -1 , |
||
int | destDatumTransform = -1 |
||
) |
|
protected |
adjust extent to fit the pixmap size
void QgsMapRenderer::clearLayerCoordinateTransforms | ( | ) |
|
inline |
|
signal |
Notifies higher level components to show the datum transform dialog and add a QgsLayerCoordinateTransformInfo for that layer.
const QgsCoordinateReferenceSystem & QgsMapRenderer::destinationCrs | ( | ) | const |
returns CRS of destination coordinate reference system
|
signal |
|
signal |
emitted when layer's draw() returned false
|
signal |
|
inline |
sets whether map image will be for overview
QgsRectangle QgsMapRenderer::extent | ( | ) | const |
returns current extent
|
signal |
emitted when the current extent gets changed
QgsRectangle QgsMapRenderer::fullExtent | ( | ) |
returns current extent of layer set
|
static |
Returns a BlendMode corresponding to a QPainter::CompositionMode.
|
static |
Returns a QPainter::CompositionMode corresponding to a BlendMode.
Returns a QPainter::CompositionMode corresponding to a QgsMapRenderer::BlendMode.
bool QgsMapRenderer::hasCrsTransformEnabled | ( | ) | const |
returns true if projections are enabled for this layer set
|
signal |
This signal is emitted when CRS transformation is enabled/disabled.
flag | true if transformation is enabled. |
|
signal |
This signal is emitted when CRS transformation is enabled/disabled.
flag | true if transformation is enabled. |
|
inline |
|
inline |
Labeling engine (NULL if there's no custom engine)
QgsRectangle QgsMapRenderer::layerExtentToOutputExtent | ( | QgsMapLayer * | theLayer, |
QgsRectangle | extent | ||
) |
transform bounding box from layer's CRS to output CRS
QStringList & QgsMapRenderer::layerSet | ( | ) |
returns current layer set
QgsPoint QgsMapRenderer::layerToMapCoordinates | ( | QgsMapLayer * | theLayer, |
QgsPoint | point | ||
) |
transform point coordinates from layer's CRS to output CRS
QgsRectangle QgsMapRenderer::layerToMapCoordinates | ( | QgsMapLayer * | theLayer, |
QgsRectangle | rect | ||
) |
transform rectangle from layer's CRS to output CRS
const QgsMapSettings & QgsMapRenderer::mapSettings | ( | ) |
bridge to QgsMapSettings
QgsPoint QgsMapRenderer::mapToLayerCoordinates | ( | QgsMapLayer * | theLayer, |
QgsPoint | point | ||
) |
transform point coordinates from output CRS to layer's CRS
QgsRectangle QgsMapRenderer::mapToLayerCoordinates | ( | QgsMapLayer * | theLayer, |
QgsRectangle | rect | ||
) |
transform rectangle from output CRS to layer's CRS
QGis::UnitType QgsMapRenderer::mapUnits | ( | ) | const |
|
signal |
|
inline |
|
slot |
double QgsMapRenderer::outputDpi | ( | ) |
accessor for output dpi
QgsRectangle QgsMapRenderer::outputExtentToLayerExtent | ( | QgsMapLayer * | theLayer, |
QgsRectangle | extent | ||
) |
transform bounding box from output CRS to layer's CRS
QSize QgsMapRenderer::outputSize | ( | ) |
accessor for output size
QSizeF QgsMapRenderer::outputSizeF | ( | ) |
|
inline |
bool QgsMapRenderer::readXML | ( | QDomNode & | theNode | ) |
read settings
void QgsMapRenderer::render | ( | QPainter * | painter, |
double * | forceWidthScale = 0 |
||
) |
starts rendering
painter | painter to render to |
forceWidthScale | Force a specific scale factor for line widths and marker sizes. Automatically calculated from output device DPI if 0 |
|
inline |
Accessor for render context.
|
inline |
Scale denominator.
void QgsMapRenderer::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs, |
bool | refreshCoordinateTransformInfo = true , |
||
bool | transformExtent = true |
||
) |
sets destination coordinate reference system
bool QgsMapRenderer::setExtent | ( | const QgsRectangle & | extent | ) |
sets extent and checks whether suitable (returns false if not)
void QgsMapRenderer::setLabelingEngine | ( | QgsLabelingEngineInterface * | iface | ) |
Set labeling engine.
Previous engine (if any) is deleted. Takes ownership of the engine.
void QgsMapRenderer::setLayerSet | ( | const QStringList & | layers | ) |
change current layer set
void QgsMapRenderer::setMapUnits | ( | QGis::UnitType | u | ) |
void QgsMapRenderer::setOutputSize | ( | QSize | size, |
int | dpi | ||
) |
void QgsMapRenderer::setOutputSize | ( | QSizeF | size, |
double | dpi | ||
) |
|
inline |
void QgsMapRenderer::setProjectionsEnabled | ( | bool | enabled | ) |
sets whether to use projections for this layer set
|
inline |
Sets scale for scale based visibility.
Normally, the scale is calculated automatically. This function is only used to force a preview scale (e.g. for print composer)
bool QgsMapRenderer::splitLayersExtent | ( | QgsMapLayer * | layer, |
QgsRectangle & | extent, | ||
QgsRectangle & | r2 | ||
) |
Convenience function to project an extent into the layer source CRS, but also split it into two extents if it crosses the +/- 180 degree line.
Modifies the given extent to be in the source CRS coordinates, and if it was split, returns true, and also sets the contents of the r2 parameter
const QgsCoordinateTransform * QgsMapRenderer::transformation | ( | const QgsMapLayer * | layer | ) | const |
void QgsMapRenderer::updateFullExtent | ( | ) |
updates extent of the layer set
|
signal |
void QgsMapRenderer::updateScale | ( | ) |
Recalculate the map scale.
|
inline |
bool QgsMapRenderer::writeXML | ( | QDomNode & | theNode, |
QDomDocument & | theDoc | ||
) |
write settings
|
protected |
destination spatial reference system of the projection
|
protected |
tool for measuring
|
staticprotected |
indicates drawing in progress
|
protected |
current extent to be drawn
|
protected |
full extent of the layer set
|
protected |
Labeling engine (NULL by default)
|
protected |
Last extent to we drew so we know if we can used layer render caching or not.
Note there are no accessors for this as it is intended to internal use only.
|
protected |
|
protected |
stores array of layers to be rendered (identified by string)
|
protected |
map settings - used only for export in mapSettings() for use in classes that deal with QgsMapSettings
|
protected |
map units per pixel
|
protected |
Output units.
|
protected |
indicates whether it's map image for overview
|
protected |
detemines whether on the fly projection support is enabled
|
protected |
Encapsulates context of rendering.
|
protected |
Locks rendering loop for concurrent draws.
|
protected |
Map scale denominator at its current zoom level.
|
protected |
scale calculator
|
protected |