QGIS API Documentation
2.2.0-Valmiera
|
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 } |
Blending modes enum defining the available composition modes that can be used when rendering a layer. More... |
Public Slots | |
void | onDrawingProgress (int current, int total) |
called by signal from layer current being drawn |
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 | 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 @ param forceWidthScale Force a specific scale factor for line widths and marker sizes. | |
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) |
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 |
Static Public Member Functions | |
static QPainter::CompositionMode | getCompositionMode (const QgsMapRenderer::BlendMode &blendMode) |
Returns a QPainter::CompositionMode corresponding to a BlendMode Added in 1.9. | |
static QgsMapRenderer::BlendMode | getBlendModeEnum (const QPainter::CompositionMode &blendMode) |
Returns a BlendMode corresponding to a QPainter::CompositionMode Added in 1.9. |
Protected Member Functions | |
void | adjustExtentToSize () |
adjust extent to fit the pixmap size | |
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. |
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. | |
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.
Definition at line 125 of file qgsmaprenderer.h.
Blending modes enum defining the available composition modes that can be used when rendering a layer.
BlendNormal | |
BlendLighten | |
BlendScreen | |
BlendDodge | |
BlendAddition | |
BlendDarken | |
BlendMultiply | |
BlendBurn | |
BlendOverlay | |
BlendSoftLight | |
BlendHardLight | |
BlendDifference | |
BlendSubtract |
Definition at line 142 of file qgsmaprenderer.h.
Output units for pen width and point marker width/height.
Definition at line 132 of file qgsmaprenderer.h.
QgsMapRenderer::QgsMapRenderer | ( | ) |
constructor
Definition at line 42 of file qgsmaprenderer.cpp.
References QGis::Degrees, GEOCRS_ID, QgsCoordinateReferenceSystem::InternalCrsId, mDestCRS, mDistArea, mDrawing, Millimeters, mLabelingEngine, mOutputUnits, mOverview, mProjectionsEnabled, mScale, mScaleCalculator, mSize, and setMapUnits().
QgsMapRenderer::~QgsMapRenderer | ( | ) |
destructor
Definition at line 64 of file qgsmaprenderer.cpp.
References mDestCRS, mDistArea, mLabelingEngine, and mScaleCalculator.
void QgsMapRenderer::addLayerCoordinateTransform | ( | const QString & | layerId, |
const QString & | srcAuthId, | ||
const QString & | destAuthId, | ||
int | srcDatumTransform = -1 , |
||
int | destDatumTransform = -1 |
||
) |
Definition at line 1378 of file qgsmaprenderer.cpp.
References QgsLayerCoordinateTransform::destAuthId, QgsLayerCoordinateTransform::destDatumTransform, mLayerCoordinateTransformInfo, QgsLayerCoordinateTransform::srcAuthId, and QgsLayerCoordinateTransform::srcDatumTransform.
Referenced by QgsMapCanvas::getDatumTransformInfo().
|
protected |
adjust extent to fit the pixmap size
Definition at line 153 of file qgsmaprenderer.cpp.
References QgsRectangle::height(), mExtent, mMapUnitsPerPixel, mRenderContext, mScale, mSize, QgsDebugMsg, qgsDoubleToString(), QgsRenderContext::setExtent(), QgsRenderContext::setMapToPixel(), QgsMapToPixel::setParameters(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsRectangle::toString(), updateScale(), QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by setExtent(), and setOutputSize().
void QgsMapRenderer::clearLayerCoordinateTransforms | ( | ) |
Definition at line 1388 of file qgsmaprenderer.cpp.
References mLayerCoordinateTransformInfo.
|
inline |
Definition at line 175 of file qgsmaprenderer.h.
Referenced by QgsPalLabeling::addDiagramLayer(), QgsMapOverviewCanvas::drawExtentRect(), QgsPalLabeling::drawLabeling(), QgsMapCanvas::getCoordinateTransform(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsPalLabeling::prepareLayer(), QgsSnapper::snapPoint(), and QgsTolerance::toLayerCoordinates().
|
signal |
Notifies higher level components to show the datum transform dialog and add a QgsLayerCoordinateTransformInfo for that layer.
Referenced by transformation().
const QgsCoordinateReferenceSystem & QgsMapRenderer::destinationCrs | ( | ) | const |
returns CRS of destination coordinate reference system
Definition at line 771 of file qgsmaprenderer.cpp.
References mDestCRS, QgsDebugMsgLevel, QgsCoordinateReferenceSystem::srsid(), and QgsCoordinateReferenceSystem::toProj4().
Referenced by QgsAtlasComposition::computeExtent(), QgsMapOverviewCanvas::destinationSrsChanged(), QgsComposerMap::draw(), QgsComposerAttributeTable::getFeatureAttributes(), QgsMapToolIdentify::identifyRasterLayer(), QgsComposerScaleBar::mapWidth(), and writeXML().
|
signal |
Referenced by setDestinationCrs().
|
signal |
emitted when layer's draw() returned false
Referenced by render().
|
signal |
Referenced by render().
|
inline |
sets whether map image will be for overview
Definition at line 194 of file qgsmaprenderer.h.
Referenced by QgsMapOverviewCanvas::QgsMapOverviewCanvas().
QgsRectangle QgsMapRenderer::extent | ( | ) | const |
returns current extent
Definition at line 72 of file qgsmaprenderer.cpp.
References mExtent.
Referenced by QgsComposerMap::composerMapPosForItem(), QgsComposerMap::drawCanvasItem(), QgsMapOverviewCanvas::drawExtentRect(), QgsMapCanvas::extent(), QgsMapCanvas::keyPressEvent(), layerExtentToOutputExtent(), outputExtentToLayerExtent(), QgsMapCanvas::panActionEnd(), QgsPalLabeling::prepareLayer(), QgsComposerMap::QgsComposerMap(), QgsRenderChecker::runTest(), QgsMapCanvas::saveAsImage(), setExtent(), splitLayersExtent(), updateFullExtent(), QgsMapCanvas::wheelEvent(), writeXML(), QgsMapCanvas::zoomByFactor(), and QgsMapCanvas::zoomWithCenter().
QgsRectangle QgsMapRenderer::fullExtent | ( | ) |
returns current extent of layer set
Definition at line 1056 of file qgsmaprenderer.cpp.
References mFullExtent, and updateFullExtent().
Referenced by QgsMapCanvas::fullExtent(), and QgsMapOverviewCanvas::updateFullExtent().
|
static |
Returns a BlendMode corresponding to a QPainter::CompositionMode Added in 1.9.
Definition at line 1342 of file qgsmaprenderer.cpp.
References BlendAddition, BlendBurn, BlendDarken, BlendDifference, BlendDodge, BlendHardLight, BlendLighten, BlendMultiply, BlendNormal, BlendOverlay, BlendScreen, BlendSoftLight, and BlendSubtract.
Referenced by QgsComposerItem::_writeXML(), QgsBlendModeComboBox::setBlendMode(), QgsRasterLayer::writeSymbology(), QgsVectorLayer::writeSymbology(), QgsPalLayerSettings::writeToLayer(), and QgsComposerMap::writeXML().
|
static |
Returns a QPainter::CompositionMode corresponding to a BlendMode Added in 1.9.
Returns a QPainter::CompositionMode corresponding to a QgsMapRenderer::BlendMode.
Definition at line 1306 of file qgsmaprenderer.cpp.
References BlendAddition, BlendBurn, BlendDarken, BlendDifference, BlendDodge, BlendHardLight, BlendLighten, BlendMultiply, BlendNormal, BlendOverlay, BlendScreen, BlendSoftLight, and BlendSubtract.
Referenced by QgsComposerItem::_readXML(), QgsBlendModeComboBox::blendMode(), QgsPalLayerSettings::readFromLayer(), QgsRasterLayer::readSymbology(), QgsVectorLayer::readSymbology(), and QgsComposerMap::readXML().
bool QgsMapRenderer::hasCrsTransformEnabled | ( | ) | const |
returns true if projections are enabled for this layer set
Definition at line 735 of file qgsmaprenderer.cpp.
References mProjectionsEnabled.
Referenced by QgsPalLabeling::addDiagramLayer(), QgsTolerance::computeMapUnitPerPixel(), QgsComposerMap::draw(), QgsComposerAttributeTable::getFeatureAttributes(), QgsMapCanvas::hasCrsTransformEnabled(), QgsHighlight::init(), layerExtentToOutputExtent(), layerToMapCoordinates(), mapToLayerCoordinates(), QgsComposerScaleBar::mapWidth(), outputExtentToLayerExtent(), QgsPalLabeling::prepareLayer(), render(), setProjectionsEnabled(), splitLayersExtent(), and writeXML().
|
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. |
Referenced by setProjectionsEnabled().
|
inline |
Definition at line 185 of file qgsmaprenderer.h.
|
inline |
Labeling engine (NULL if there's no custom engine)
Definition at line 284 of file qgsmaprenderer.h.
Referenced by QgsComposerMap::containsAdvancedEffects(), and QgsComposerMap::draw().
QgsRectangle QgsMapRenderer::layerExtentToOutputExtent | ( | QgsMapLayer * | theLayer, |
QgsRectangle | extent | ||
) |
transform bounding box from layer's CRS to output CRS
Definition at line 843 of file qgsmaprenderer.cpp.
References extent(), hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsDebugMsg, QgsRectangle::toString(), tr, transformation(), QgsCoordinateTransform::transformBoundingBox(), and QgsException::what().
Referenced by QgsMapCanvas::panToSelected(), updateFullExtent(), and QgsMapCanvas::zoomToSelected().
QStringList & QgsMapRenderer::layerSet | ( | ) |
returns current layer set
Definition at line 1069 of file qgsmaprenderer.cpp.
References mLayerSet.
Referenced by QgsComposerMap::containsAdvancedEffects(), QgsComposerMap::containsWMSLayer(), QgsMapCanvas::layer(), QgsMapCanvas::layerCount(), QgsComposerLegend::layerIdList(), QgsMapCanvas::layers(), QgsMapOverviewCanvas::layerSet(), QgsComposerMap::layersToRender(), QgsMapCanvas::setLayerSet(), QgsComposerMap::storeCurrentLayerSet(), QgsComposerMap::syncLayerSet(), and QgsMapOverviewCanvas::updateFullExtent().
QgsPoint QgsMapRenderer::layerToMapCoordinates | ( | QgsMapLayer * | theLayer, |
QgsPoint | point | ||
) |
transform point coordinates from layer's CRS to output CRS
Definition at line 898 of file qgsmaprenderer.cpp.
References QgsCoordinateTransform::ForwardTransform, hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsCoordinateTransform::transform(), transformation(), and QgsException::what().
Referenced by QgsRubberBand::addGeometry(), QgsMapToolIdentify::featureDerivedAttributes(), QgsSnapper::snapPoint(), and QgsMapTool::toMapCoordinates().
QgsRectangle QgsMapRenderer::layerToMapCoordinates | ( | QgsMapLayer * | theLayer, |
QgsRectangle | rect | ||
) |
transform rectangle from layer's CRS to output CRS
Definition at line 922 of file qgsmaprenderer.cpp.
References QgsCoordinateTransform::ForwardTransform, hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsCoordinateTransform::transform(), transformation(), and QgsException::what().
QgsPoint QgsMapRenderer::mapToLayerCoordinates | ( | QgsMapLayer * | theLayer, |
QgsPoint | point | ||
) |
transform point coordinates from output CRS to layer's CRS
Definition at line 946 of file qgsmaprenderer.cpp.
References hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsCoordinateTransform::ReverseTransform, QgsCoordinateTransform::transform(), transformation(), and QgsException::what().
Referenced by QgsMapTip::fetchFeature(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsSnapper::snapPoint(), QgsTolerance::toLayerCoordinates(), and QgsMapTool::toLayerCoordinates().
QgsRectangle QgsMapRenderer::mapToLayerCoordinates | ( | QgsMapLayer * | theLayer, |
QgsRectangle | rect | ||
) |
transform rectangle from output CRS to layer's CRS
Definition at line 968 of file qgsmaprenderer.cpp.
References hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsCoordinateTransform::ReverseTransform, QgsCoordinateTransform::transform(), transformation(), and QgsException::what().
QGis::UnitType QgsMapRenderer::mapUnits | ( | ) | const |
Definition at line 707 of file qgsmaprenderer.cpp.
References QgsScaleCalculator::mapUnits(), and mScaleCalculator.
Referenced by QgsComposerMap::initGridAnnotationFormatFromProject(), QgsMapCanvas::mapUnits(), QgsComposerMap::scale(), and writeXML().
|
signal |
Referenced by setMapUnits().
|
inline |
Definition at line 182 of file qgsmaprenderer.h.
Referenced by QgsTolerance::computeMapUnitPerPixel(), QgsMapCanvas::mapUnitsPerPixel(), and QgsRenderChecker::runTest().
|
slot |
called by signal from layer current being drawn
Definition at line 712 of file qgsmaprenderer.cpp.
References updateMap().
Referenced by render().
double QgsMapRenderer::outputDpi | ( | ) |
accessor for output dpi
Definition at line 138 of file qgsmaprenderer.cpp.
References QgsScaleCalculator::dpi(), and mScaleCalculator.
Referenced by QgsMapCanvasItem::setRenderContextVariables().
QgsRectangle QgsMapRenderer::outputExtentToLayerExtent | ( | QgsMapLayer * | theLayer, |
QgsRectangle | extent | ||
) |
transform bounding box from output CRS to layer's CRS
Definition at line 869 of file qgsmaprenderer.cpp.
References QgsCoordinateReferenceSystem::authid(), QgsCoordinateTransform::destCRS(), extent(), hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsDebugMsg, QgsCoordinateTransform::ReverseTransform, QgsCoordinateTransform::sourceCrs(), QgsRectangle::toString(), tr, transformation(), QgsCoordinateTransform::transformBoundingBox(), and QgsException::what().
QSize QgsMapRenderer::outputSize | ( | ) |
QSizeF QgsMapRenderer::outputSizeF | ( | ) |
Definition at line 148 of file qgsmaprenderer.cpp.
References mSize.
|
inline |
Definition at line 259 of file qgsmaprenderer.h.
Referenced by QgsMapCanvasItem::setRenderContextVariables().
bool QgsMapRenderer::readXML | ( | QDomNode & | theNode | ) |
read settings
Definition at line 1074 of file qgsmaprenderer.cpp.
References QGis::Degrees, QgsLayerCoordinateTransform::destAuthId, QgsLayerCoordinateTransform::destDatumTransform, QGis::Feet, QGis::Meters, mLayerCoordinateTransformInfo, QGis::NauticalMiles, QgsDebugMsg, QgsCoordinateReferenceSystem::readXML(), setDestinationCrs(), setExtent(), setMapUnits(), setProjectionsEnabled(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsLayerCoordinateTransform::srcAuthId, QgsLayerCoordinateTransform::srcDatumTransform, and QGis::UnknownUnit.
Referenced by QgsMapCanvas::readProject().
void QgsMapRenderer::render | ( | QPainter * | painter, |
double * | forceWidthScale = 0 |
||
) |
starts rendering @ param forceWidthScale Force a specific scale factor for line widths and marker sizes.
Automatically calculated from output device DPI if 0
Definition at line 219 of file qgsmaprenderer.cpp.
References QgsMapLayer::blendMode(), QgsMapLayer::cacheImage(), QgsMapLayerRegistry::clearAllLayerCaches(), QgsScaleCalculator::dpi(), QgsMapLayer::draw(), drawError(), drawingProgress(), QgsLabelingEngineInterface::drawLabeling(), QgsMapLayer::drawLabels(), QgsLabelingEngineInterface::exit(), QgsMapLayer::extent(), QgsVectorLayer::featureBlendMode(), hasCrsTransformEnabled(), QgsMapLayer::hasScaleBasedVisibility(), QgsLabelingEngineInterface::init(), QgsMapLayerRegistry::instance(), QgsProject::instance(), QgsVectorLayer::isEditable(), QgsRectangle::isEmpty(), QgsRectangle::isFinite(), QgsRenderContext::labelingEngine(), QgsVectorLayer::layerTransparency(), QgsMapLayerRegistry::mapLayer(), QgsRenderContext::mapToPixel(), QgsMapToPixel::mapUnitsPerPixel(), QgsMapLayer::maximumScale(), mDrawing, mExtent, Millimeters, QgsMapLayer::minimumScale(), mLabelingEngine, mLastExtent, mLayerSet, mOutputUnits, mOverview, mRenderContext, mRenderMutex, mScale, mScaleCalculator, mSize, QgsMapLayer::name(), onDrawingProgress(), QgsRenderContext::painter(), QgsDebugMsg, QgsMapLayer::RasterLayer, QgsRenderContext::rasterScaleFactor(), rasterScaleFactor, QgsProject::readNumEntry(), QgsRenderContext::rendererScale(), QgsRenderContext::renderingStopped(), QgsRenderContext::scaleFactor(), QgsMapLayer::setCacheImage(), QgsRenderContext::setCoordinateTransform(), QgsRenderContext::setDrawEditingInformation(), QgsRenderContext::setExtent(), QgsRenderContext::setLabelingEngine(), QgsRenderContext::setMapToPixel(), QgsMapToPixel::setMapUnitsPerPixel(), QgsRenderContext::setPainter(), QgsRenderContext::setRasterScaleFactor(), QgsRenderContext::setRendererScale(), QgsRenderContext::setRenderingStopped(), QgsRenderContext::setScaleFactor(), QgsRenderContext::setSelectionColor(), QgsMapToPixel::setYMaximum(), splitLayersExtent(), QgsRectangle::toString(), transformation(), QgsMapLayer::type(), QgsRenderContext::useAdvancedEffects(), QgsMapLayer::VectorLayer, and QgsLabelingEngineInterface::willUseLayer().
Referenced by QgsComposerMap::draw(), QgsMapOverviewCanvas::refresh(), QgsMapCanvasMap::render(), QgsRenderChecker::runTest(), and QgsMapCanvas::saveAsImage().
|
inline |
Accessor for render context.
Definition at line 280 of file qgsmaprenderer.h.
Referenced by QgsComposerMap::draw(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsMapToolIdentify::identifyVectorLayer(), QgsHighlight::paint(), QgsMapCanvas::paintEvent(), and QgsMapCanvas::setRenderFlag().
|
inline |
Scale denominator.
Definition at line 178 of file qgsmaprenderer.h.
Referenced by QgsComposerMap::draw(), QgsPalLabeling::drawLabeling(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsMapToolIdentify::identifyVectorLayer(), QgsMapCanvas::scale(), and QgsMapCanvas::updateScale().
void QgsMapRenderer::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs, |
bool | refreshCoordinateTransformInfo = true |
||
) |
sets destination coordinate reference system
Definition at line 740 of file qgsmaprenderer.cpp.
References destinationSrsChanged(), QgsRectangle::isEmpty(), mDestCRS, mDistArea, mExtent, mLayerCoordinateTransformInfo, QgsDebugMsg, setExtent(), QgsDistanceArea::setSourceCrs(), QgsCoordinateReferenceSystem::srsid(), QgsCoordinateReferenceSystem::toProj4(), QgsCoordinateTransform::transformBoundingBox(), and updateFullExtent().
Referenced by QgsMapOverviewCanvas::destinationSrsChanged(), QgsComposerMap::draw(), and readXML().
bool QgsMapRenderer::setExtent | ( | const QgsRectangle & | extent | ) |
sets extent and checks whether suitable (returns false if not)
Definition at line 82 of file qgsmaprenderer.cpp.
References adjustExtentToSize(), extent(), QgsRectangle::height(), QgsRectangle::isEmpty(), mExtent, mLastExtent, QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by QgsComposerMap::draw(), readXML(), setDestinationCrs(), QgsMapCanvas::setExtent(), QgsMapOverviewCanvas::updateFullExtent(), QgsMapCanvas::zoomToNextExtent(), and QgsMapCanvas::zoomToPreviousExtent().
void QgsMapRenderer::setLabelingEngine | ( | QgsLabelingEngineInterface * | iface | ) |
Set labeling engine.
Previous engine (if any) is deleted. Takes ownership of the engine. Added in QGIS v1.4
Definition at line 1260 of file qgsmaprenderer.cpp.
References mLabelingEngine.
Referenced by QgsComposerMap::draw().
void QgsMapRenderer::setLayerSet | ( | const QStringList & | layers | ) |
change current layer set
Definition at line 1062 of file qgsmaprenderer.cpp.
References mLayerSet, QgsDebugMsg, and updateFullExtent().
Referenced by QgsComposerMap::draw(), QgsMapOverviewCanvas::setLayerSet(), and QgsMapCanvas::setLayerSet().
void QgsMapRenderer::setMapUnits | ( | QGis::UnitType | u | ) |
Definition at line 697 of file qgsmaprenderer.cpp.
References mapUnitsChanged(), mScaleCalculator, QgsScaleCalculator::setMapUnits(), and updateScale().
Referenced by QgsMapRenderer(), readXML(), and QgsMapCanvas::setMapUnits().
void QgsMapRenderer::setOutputSize | ( | QSize | size, |
int | dpi | ||
) |
Definition at line 124 of file qgsmaprenderer.cpp.
References adjustExtentToSize(), mScaleCalculator, mSize, and QgsScaleCalculator::setDpi().
Referenced by QgsComposerMap::draw(), QgsMapOverviewCanvas::paintEvent(), QgsMapCanvasMap::resize(), and QgsRenderChecker::runTest().
void QgsMapRenderer::setOutputSize | ( | QSizeF | size, |
double | dpi | ||
) |
Definition at line 131 of file qgsmaprenderer.cpp.
References adjustExtentToSize(), mScaleCalculator, mSize, QgsScaleCalculator::setDpi(), and size.
|
inline |
Definition at line 257 of file qgsmaprenderer.h.
void QgsMapRenderer::setProjectionsEnabled | ( | bool | enabled | ) |
sets whether to use projections for this layer set
Definition at line 721 of file qgsmaprenderer.cpp.
References hasCrsTransformEnabled(), hasCrsTransformEnabledChanged(), mDistArea, mLastExtent, mProjectionsEnabled, QgsDebugMsg, QgsDistanceArea::setEllipsoidalMode(), QgsRectangle::setMinimal(), and updateFullExtent().
Referenced by QgsComposerMap::draw(), QgsMapOverviewCanvas::hasCrsTransformEnabled(), and readXML().
|
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 181 of file qgsmaprenderer.h.
Referenced by QgsComposerMap::draw().
|
protected |
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 780 of file qgsmaprenderer.cpp.
References QgsMapLayer::crs(), extent(), QgsCoordinateReferenceSystem::geographicFlag(), hasCrsTransformEnabled(), QgsDebugMsg, QgsCoordinateTransform::ReverseTransform, QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsCoordinateTransform::transform(), transformation(), QgsCoordinateTransform::transformBoundingBox(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by render().
const QgsCoordinateTransform * QgsMapRenderer::transformation | ( | const QgsMapLayer * | layer | ) | const |
Definition at line 1268 of file qgsmaprenderer.cpp.
References QgsCoordinateReferenceSystem::authid(), QgsMapLayer::crs(), datumTransformInfoRequested(), QgsMapLayer::id(), QgsCoordinateTransformCache::instance(), mDestCRS, mLayerCoordinateTransformInfo, and QgsCoordinateTransformCache::transform().
Referenced by QgsPalLabeling::addDiagramLayer(), QgsHighlight::init(), layerExtentToOutputExtent(), layerToMapCoordinates(), mapToLayerCoordinates(), outputExtentToLayerExtent(), QgsPalLabeling::prepareLayer(), render(), and splitLayersExtent().
void QgsMapRenderer::updateFullExtent | ( | ) |
updates extent of the layer set
Definition at line 987 of file qgsmaprenderer.cpp.
References QgsMapLayer::extent(), extent(), QgsRectangle::height(), QgsMapLayerRegistry::instance(), QgsRectangle::isEmpty(), layerExtentToOutputExtent(), QgsMapLayerRegistry::mapLayer(), mFullExtent, mLayerSet, QgsMapLayer::name(), QgsDebugMsg, QgsRectangle::set(), QgsRectangle::setMinimal(), QgsRectangle::toString(), QgsRectangle::unionRect(), QgsRectangle::width(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by fullExtent(), setDestinationCrs(), QgsMapOverviewCanvas::setLayerSet(), setLayerSet(), setProjectionsEnabled(), and QgsMapCanvas::updateFullExtent().
|
signal |
Referenced by onDrawingProgress().
void QgsMapRenderer::updateScale | ( | ) |
Recalculate the map scale.
Definition at line 77 of file qgsmaprenderer.cpp.
References QgsScaleCalculator::calculate(), mExtent, mScale, mScaleCalculator, and mSize.
Referenced by adjustExtentToSize(), and setMapUnits().
|
inline |
Definition at line 184 of file qgsmaprenderer.h.
bool QgsMapRenderer::writeXML | ( | QDomNode & | theNode, |
QDomDocument & | theDoc | ||
) |
write settings
Definition at line 1174 of file qgsmaprenderer.cpp.
References QGis::Degrees, destinationCrs(), extent(), QGis::Feet, hasCrsTransformEnabled(), mapUnits(), QGis::Meters, mLayerCoordinateTransformInfo, QGis::NauticalMiles, qgsDoubleToString(), QGis::UnknownUnit, QgsCoordinateReferenceSystem::writeXML(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by QgsMapCanvas::writeProject().
|
protected |
destination spatial reference system of the projection
Definition at line 382 of file qgsmaprenderer.h.
Referenced by destinationCrs(), QgsMapRenderer(), setDestinationCrs(), transformation(), and ~QgsMapRenderer().
|
protected |
tool for measuring
Definition at line 391 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), setDestinationCrs(), setProjectionsEnabled(), and ~QgsMapRenderer().
|
staticprotected |
indicates drawing in progress
Definition at line 352 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), and render().
|
protected |
current extent to be drawn
Definition at line 364 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), extent(), render(), setDestinationCrs(), setExtent(), and updateScale().
|
protected |
full extent of the layer set
Definition at line 388 of file qgsmaprenderer.h.
Referenced by fullExtent(), and updateFullExtent().
|
protected |
Labeling engine (NULL by default)
Definition at line 400 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), render(), setLabelingEngine(), and ~QgsMapRenderer().
|
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 371 of file qgsmaprenderer.h.
Referenced by render(), setExtent(), and setProjectionsEnabled().
|
protected |
Definition at line 405 of file qgsmaprenderer.h.
Referenced by addLayerCoordinateTransform(), clearLayerCoordinateTransforms(), readXML(), setDestinationCrs(), transformation(), and writeXML().
|
protected |
stores array of layers to be rendered (identified by string)
Definition at line 385 of file qgsmaprenderer.h.
Referenced by layerSet(), render(), setLayerSet(), and updateFullExtent().
|
protected |
map units per pixel
Definition at line 355 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize().
|
protected |
Output units.
Definition at line 397 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), and render().
|
protected |
indicates whether it's map image for overview
Definition at line 374 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), and render().
|
protected |
detemines whether on the fly projection support is enabled
Definition at line 379 of file qgsmaprenderer.h.
Referenced by hasCrsTransformEnabled(), QgsMapRenderer(), and setProjectionsEnabled().
|
protected |
Encapsulates context of rendering.
Definition at line 394 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), and render().
|
protected |
Locks rendering loop for concurrent draws.
Definition at line 403 of file qgsmaprenderer.h.
Referenced by render().
|
protected |
Map scale denominator at its current zoom level.
Definition at line 358 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), QgsMapRenderer(), render(), and updateScale().
|
protected |
scale calculator
Definition at line 361 of file qgsmaprenderer.h.
Referenced by mapUnits(), outputDpi(), QgsMapRenderer(), render(), setMapUnits(), setOutputSize(), updateScale(), and ~QgsMapRenderer().
|
protected |
Definition at line 376 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), outputSize(), outputSizeF(), QgsMapRenderer(), render(), setOutputSize(), and updateScale().