QGIS API Documentation
2.12.0-Lyon
|
A non GUI class for rendering a map layer set onto a QPainter. More...
#include <qgsmaprenderer.h>
Public Types | |
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... | |
enum | OutputUnits { Millimeters, Pixels } |
Output units for pen width and point marker width/height. More... | |
Public Slots | |
Q_DECL_DEPRECATED void | onDrawingProgress (int current, int total) |
Signals | |
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. More... | |
void | destinationSrsChanged () |
void | drawError (QgsMapLayer *) |
emitted when layer's draw() returned false More... | |
void | drawingProgress (int current, int total) |
void | extentsChanged () |
emitted when the current extent gets changed More... | |
Q_DECL_DEPRECATED void | hasCrsTransformEnabled (bool flag) |
This signal is emitted when CRS transformation is enabled/disabled. More... | |
void | hasCrsTransformEnabledChanged (bool flag) |
This signal is emitted when CRS transformation is enabled/disabled. More... | |
void | mapUnitsChanged () |
void | rotationChanged (double) |
emitted when the current rotation gets changed More... | |
void | updateMap () |
Public Member Functions | |
QgsMapRenderer () | |
constructor More... | |
~QgsMapRenderer () | |
destructor More... | |
void | addLayerCoordinateTransform (const QString &layerId, const QString &srcAuthId, const QString &destAuthId, int srcDatumTransform=-1, int destDatumTransform=-1) |
void | clearLayerCoordinateTransforms () |
const QgsMapToPixel * | coordinateTransform () |
const QgsCoordinateReferenceSystem & | destinationCrs () const |
returns CRS of destination coordinate reference system More... | |
void | enableOverviewMode (bool isOverview=true) |
sets whether map image will be for overview More... | |
QgsRectangle | extent () const |
returns current extent More... | |
QgsRectangle | fullExtent () |
returns current extent of layer set More... | |
bool | hasCrsTransformEnabled () const |
returns true if projections are enabled for this layer set More... | |
int | height () const |
QgsLabelingEngineInterface * | labelingEngine () |
Labeling engine (NULL if there's no custom engine) More... | |
QgsRectangle | layerExtentToOutputExtent (QgsMapLayer *theLayer, QgsRectangle extent) |
transform bounding box from layer's CRS to output CRS More... | |
QStringList & | layerSet () |
returns current layer set More... | |
QgsPoint | layerToMapCoordinates (QgsMapLayer *theLayer, QgsPoint point) |
transform point coordinates from layer's CRS to output CRS More... | |
QgsRectangle | layerToMapCoordinates (QgsMapLayer *theLayer, QgsRectangle rect) |
transform rectangle from layer's CRS to output CRS More... | |
const QgsMapSettings & | mapSettings () |
bridge to QgsMapSettings More... | |
QgsPoint | mapToLayerCoordinates (QgsMapLayer *theLayer, QgsPoint point) |
transform point coordinates from output CRS to layer's CRS More... | |
QgsRectangle | mapToLayerCoordinates (QgsMapLayer *theLayer, QgsRectangle rect) |
transform rectangle from output CRS to layer's CRS More... | |
QGis::UnitType | mapUnits () const |
double | mapUnitsPerPixel () const |
double | outputDpi () |
accessor for output dpi More... | |
QgsRectangle | outputExtentToLayerExtent (QgsMapLayer *theLayer, QgsRectangle extent) |
transform bounding box from output CRS to layer's CRS More... | |
QSize | outputSize () |
accessor for output size More... | |
QSizeF | outputSizeF () |
OutputUnits | outputUnits () const |
bool | readXML (QDomNode &theNode) |
read settings More... | |
void | render (QPainter *painter, double *forceWidthScale=0) |
starts rendering More... | |
QgsRenderContext * | rendererContext () |
Accessor for render context. More... | |
double | rotation () const |
returns current rotation in clockwise degrees More... | |
double | scale () const |
Scale denominator. More... | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &crs, bool refreshCoordinateTransformInfo=true, bool transformExtent=true) |
sets destination coordinate reference system More... | |
bool | setExtent (const QgsRectangle &extent) |
sets extent and checks whether suitable (returns false if not) More... | |
void | setLabelingEngine (QgsLabelingEngineInterface *iface) |
Set labeling engine. More... | |
void | setLayerSet (const QStringList &layers) |
change current layer set More... | |
void | setMapUnits (QGis::UnitType u) |
void | setOutputSize (QSize size, int dpi) |
void | setOutputSize (QSizeF size, double dpi) |
void | setOutputUnits (OutputUnits u) |
void | setProjectionsEnabled (bool enabled) |
sets whether to use projections for this layer set More... | |
void | setRotation (double degrees) |
sets rotation value in clockwise degrees More... | |
void | setScale (double scale) |
Sets scale for scale based visibility. More... | |
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. More... | |
const QgsCoordinateTransform * | transformation (const QgsMapLayer *layer) const |
void | updateFullExtent () |
updates extent of the layer set More... | |
void | updateScale () |
Recalculate the map scale. More... | |
int | width () const |
bool | writeXML (QDomNode &theNode, QDomDocument &theDoc) |
write settings More... | |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Static Public Member Functions | |
static QgsMapRenderer::BlendMode | getBlendModeEnum (const QPainter::CompositionMode &blendMode) |
Returns a BlendMode corresponding to a QPainter::CompositionMode. More... | |
static QPainter::CompositionMode | getCompositionMode (const QgsMapRenderer::BlendMode &blendMode) |
Returns a QPainter::CompositionMode corresponding to a BlendMode. More... | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions | |
void | adjustExtentToSize () |
adjust extent to fit the pixmap size More... | |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Attributes | |
QgsCoordinateReferenceSystem * | mDestCRS |
destination spatial reference system of the projection More... | |
QgsDistanceArea * | mDistArea |
tool for measuring More... | |
QgsRectangle | mExtent |
current extent to be drawn More... | |
QgsRectangle | mFullExtent |
full extent of the layer set More... | |
QgsLabelingEngineInterface * | mLabelingEngine |
Labeling engine (NULL by default) More... | |
QgsRectangle | mLastExtent |
Last extent to we drew so we know if we can used layer render caching or not. More... | |
QHash< QString, QgsLayerCoordinateTransform > | mLayerCoordinateTransformInfo |
QStringList | mLayerSet |
stores array of layers to be rendered (identified by string) More... | |
QgsMapSettings | mMapSettings |
map settings - used only for export in mapSettings() for use in classes that deal with QgsMapSettings More... | |
double | mMapUnitsPerPixel |
map units per pixel More... | |
OutputUnits | mOutputUnits |
Output units. More... | |
bool | mOverview |
indicates whether it's map image for overview More... | |
bool | mProjectionsEnabled |
detemines whether on the fly projection support is enabled More... | |
QgsRenderContext | mRenderContext |
Encapsulates context of rendering. More... | |
QMutex | mRenderMutex |
Locks rendering loop for concurrent draws. More... | |
double | mRotation |
Map rotation. More... | |
double | mScale |
Map scale denominator at its current zoom level. More... | |
QgsScaleCalculator * | mScaleCalculator |
scale calculator More... | |
QSizeF | mSize |
Static Protected Attributes | |
static bool | mDrawing = false |
indicates drawing in progress More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
A non GUI class for rendering a map layer set onto a QPainter.
Definition at line 131 of file qgsmaprenderer.h.
QgsMapRenderer::QgsMapRenderer | ( | ) |
constructor
Definition at line 42 of file qgsmaprenderer.cpp.
QgsMapRenderer::~QgsMapRenderer | ( | ) |
destructor
Definition at line 65 of file qgsmaprenderer.cpp.
void QgsMapRenderer::addLayerCoordinateTransform | ( | const QString & | layerId, |
const QString & | srcAuthId, | ||
const QString & | destAuthId, | ||
int | srcDatumTransform = -1 , |
||
int | destDatumTransform = -1 |
||
) |
Definition at line 1265 of file qgsmaprenderer.cpp.
|
protected |
adjust extent to fit the pixmap size
Definition at line 168 of file qgsmaprenderer.cpp.
void QgsMapRenderer::clearLayerCoordinateTransforms | ( | ) |
Definition at line 1275 of file qgsmaprenderer.cpp.
|
inline |
Definition at line 202 of file qgsmaprenderer.h.
|
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
Definition at line 715 of file qgsmaprenderer.cpp.
|
signal |
|
signal |
emitted when layer's draw() returned false
|
signal |
|
inline |
sets whether map image will be for overview
Definition at line 221 of file qgsmaprenderer.h.
QgsRectangle QgsMapRenderer::extent | ( | ) | const |
returns current extent
Definition at line 73 of file qgsmaprenderer.cpp.
|
signal |
emitted when the current extent gets changed
QgsRectangle QgsMapRenderer::fullExtent | ( | ) |
returns current extent of layer set
Definition at line 1000 of file qgsmaprenderer.cpp.
|
static |
Returns a BlendMode corresponding to a QPainter::CompositionMode.
Definition at line 1191 of file qgsmaprenderer.cpp.
|
static |
Returns a QPainter::CompositionMode corresponding to a BlendMode.
Returns a QPainter::CompositionMode corresponding to a QgsMapRenderer::BlendMode.
Definition at line 1132 of file qgsmaprenderer.cpp.
bool QgsMapRenderer::hasCrsTransformEnabled | ( | ) | const |
returns true if projections are enabled for this layer set
Definition at line 672 of file qgsmaprenderer.cpp.
|
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 |
Definition at line 212 of file qgsmaprenderer.h.
|
inline |
Labeling engine (NULL if there's no custom engine)
Definition at line 310 of file qgsmaprenderer.h.
QgsRectangle QgsMapRenderer::layerExtentToOutputExtent | ( | QgsMapLayer * | theLayer, |
QgsRectangle | extent | ||
) |
transform bounding box from layer's CRS to output CRS
Definition at line 787 of file qgsmaprenderer.cpp.
QStringList & QgsMapRenderer::layerSet | ( | ) |
returns current layer set
Definition at line 1013 of file qgsmaprenderer.cpp.
QgsPoint QgsMapRenderer::layerToMapCoordinates | ( | QgsMapLayer * | theLayer, |
QgsPoint | point | ||
) |
transform point coordinates from layer's CRS to output CRS
Definition at line 842 of file qgsmaprenderer.cpp.
QgsRectangle QgsMapRenderer::layerToMapCoordinates | ( | QgsMapLayer * | theLayer, |
QgsRectangle | rect | ||
) |
transform rectangle from layer's CRS to output CRS
Definition at line 866 of file qgsmaprenderer.cpp.
const QgsMapSettings & QgsMapRenderer::mapSettings | ( | ) |
QgsPoint QgsMapRenderer::mapToLayerCoordinates | ( | QgsMapLayer * | theLayer, |
QgsPoint | point | ||
) |
transform point coordinates from output CRS to layer's CRS
Definition at line 890 of file qgsmaprenderer.cpp.
QgsRectangle QgsMapRenderer::mapToLayerCoordinates | ( | QgsMapLayer * | theLayer, |
QgsRectangle | rect | ||
) |
transform rectangle from output CRS to layer's CRS
Definition at line 912 of file qgsmaprenderer.cpp.
QGis::UnitType QgsMapRenderer::mapUnits | ( | ) | const |
Definition at line 643 of file qgsmaprenderer.cpp.
|
signal |
|
inline |
Definition at line 209 of file qgsmaprenderer.h.
|
slot |
Definition at line 648 of file qgsmaprenderer.cpp.
double QgsMapRenderer::outputDpi | ( | ) |
accessor for output dpi
Definition at line 153 of file qgsmaprenderer.cpp.
QgsRectangle QgsMapRenderer::outputExtentToLayerExtent | ( | QgsMapLayer * | theLayer, |
QgsRectangle | extent | ||
) |
transform bounding box from output CRS to layer's CRS
Definition at line 813 of file qgsmaprenderer.cpp.
QSize QgsMapRenderer::outputSize | ( | ) |
accessor for output size
Definition at line 158 of file qgsmaprenderer.cpp.
QSizeF QgsMapRenderer::outputSizeF | ( | ) |
Definition at line 163 of file qgsmaprenderer.cpp.
|
inline |
Definition at line 286 of file qgsmaprenderer.h.
bool QgsMapRenderer::readXML | ( | QDomNode & | theNode | ) |
read settings
Definition at line 1019 of file qgsmaprenderer.cpp.
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 |
Definition at line 236 of file qgsmaprenderer.cpp.
|
inline |
Accessor for render context.
Definition at line 307 of file qgsmaprenderer.h.
double QgsMapRenderer::rotation | ( | ) | const |
returns current rotation in clockwise degrees
Definition at line 133 of file qgsmaprenderer.cpp.
|
signal |
emitted when the current rotation gets changed
|
inline |
Scale denominator.
Definition at line 205 of file qgsmaprenderer.h.
void QgsMapRenderer::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs, |
bool | refreshCoordinateTransformInfo = true , |
||
bool | transformExtent = true |
||
) |
sets destination coordinate reference system
Definition at line 677 of file qgsmaprenderer.cpp.
bool QgsMapRenderer::setExtent | ( | const QgsRectangle & | extent | ) |
sets extent and checks whether suitable (returns false if not)
Definition at line 83 of file qgsmaprenderer.cpp.
void QgsMapRenderer::setLabelingEngine | ( | QgsLabelingEngineInterface * | iface | ) |
Set labeling engine.
Previous engine (if any) is deleted. Takes ownership of the engine.
Definition at line 1086 of file qgsmaprenderer.cpp.
void QgsMapRenderer::setLayerSet | ( | const QStringList & | layers | ) |
change current layer set
Definition at line 1006 of file qgsmaprenderer.cpp.
void QgsMapRenderer::setMapUnits | ( | QGis::UnitType | u | ) |
Definition at line 633 of file qgsmaprenderer.cpp.
void QgsMapRenderer::setOutputSize | ( | QSize | size, |
int | dpi | ||
) |
Definition at line 139 of file qgsmaprenderer.cpp.
void QgsMapRenderer::setOutputSize | ( | QSizeF | size, |
double | dpi | ||
) |
Definition at line 146 of file qgsmaprenderer.cpp.
|
inline |
Definition at line 284 of file qgsmaprenderer.h.
void QgsMapRenderer::setProjectionsEnabled | ( | bool | enabled | ) |
sets whether to use projections for this layer set
Definition at line 654 of file qgsmaprenderer.cpp.
void QgsMapRenderer::setRotation | ( | double | degrees | ) |
sets rotation value in clockwise degrees
Definition at line 125 of file qgsmaprenderer.cpp.
|
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)
Definition at line 208 of file qgsmaprenderer.h.
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
Definition at line 724 of file qgsmaprenderer.cpp.
const QgsCoordinateTransform * QgsMapRenderer::transformation | ( | const QgsMapLayer * | layer | ) | const |
Definition at line 1094 of file qgsmaprenderer.cpp.
void QgsMapRenderer::updateFullExtent | ( | ) |
updates extent of the layer set
Definition at line 931 of file qgsmaprenderer.cpp.
|
signal |
void QgsMapRenderer::updateScale | ( | ) |
Recalculate the map scale.
Definition at line 78 of file qgsmaprenderer.cpp.
|
inline |
Definition at line 211 of file qgsmaprenderer.h.
bool QgsMapRenderer::writeXML | ( | QDomNode & | theNode, |
QDomDocument & | theDoc | ||
) |
write settings
Definition at line 1058 of file qgsmaprenderer.cpp.
|
protected |
destination spatial reference system of the projection
Definition at line 422 of file qgsmaprenderer.h.
|
protected |
tool for measuring
Definition at line 431 of file qgsmaprenderer.h.
|
staticprotected |
indicates drawing in progress
Definition at line 390 of file qgsmaprenderer.h.
|
protected |
current extent to be drawn
Definition at line 405 of file qgsmaprenderer.h.
|
protected |
full extent of the layer set
Definition at line 428 of file qgsmaprenderer.h.
|
protected |
Labeling engine (NULL by default)
Definition at line 440 of file qgsmaprenderer.h.
|
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.
Definition at line 411 of file qgsmaprenderer.h.
|
protected |
Definition at line 448 of file qgsmaprenderer.h.
|
protected |
stores array of layers to be rendered (identified by string)
Definition at line 425 of file qgsmaprenderer.h.
|
protected |
map settings - used only for export in mapSettings() for use in classes that deal with QgsMapSettings
Definition at line 446 of file qgsmaprenderer.h.
|
protected |
map units per pixel
Definition at line 393 of file qgsmaprenderer.h.
|
protected |
Output units.
Definition at line 437 of file qgsmaprenderer.h.
|
protected |
indicates whether it's map image for overview
Definition at line 414 of file qgsmaprenderer.h.
|
protected |
detemines whether on the fly projection support is enabled
Definition at line 419 of file qgsmaprenderer.h.
|
protected |
Encapsulates context of rendering.
Definition at line 434 of file qgsmaprenderer.h.
|
protected |
Locks rendering loop for concurrent draws.
Definition at line 443 of file qgsmaprenderer.h.
|
protected |
Map rotation.
Definition at line 399 of file qgsmaprenderer.h.
|
protected |
Map scale denominator at its current zoom level.
Definition at line 396 of file qgsmaprenderer.h.
|
protected |
scale calculator
Definition at line 402 of file qgsmaprenderer.h.
|
protected |
Definition at line 416 of file qgsmaprenderer.h.