QGIS API Documentation
2.0.1-Dufour
|
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) |
void | hasCrsTransformEnabled (bool flag) |
void | destinationSrsChanged () |
void | updateMap () |
void | mapUnitsChanged () |
void | drawError (QgsMapLayer *) |
emitted when layer's draw() returned false |
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) |
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. |
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. |
Static Protected Attributes | |
static bool | mDrawing = false |
indicates drawing in progress |
Private Member Functions | |
const QgsCoordinateTransform * | tr (QgsMapLayer *layer) |
A non GUI class for rendering a map layer set onto a QPainter.
Definition at line 119 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 136 of file qgsmaprenderer.h.
Output units for pen width and point marker width/height.
Definition at line 126 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.
|
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().
|
inline |
Definition at line 169 of file qgsmaprenderer.h.
Referenced by QgsPalLabeling::addDiagramLayer(), QgsMapOverviewCanvas::drawExtentRect(), QgsPalLabeling::drawLabeling(), QgsMapCanvas::getCoordinateTransform(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsPalLabeling::prepareLayer(), QgsSnapper::snapPoint(), and QgsTolerance::toLayerCoordinates().
const QgsCoordinateReferenceSystem & QgsMapRenderer::destinationCrs | ( | ) | const |
returns CRS of destination coordinate reference system
Definition at line 766 of file qgsmaprenderer.cpp.
References mDestCRS, QgsDebugMsgLevel, QgsCoordinateReferenceSystem::srsid(), and QgsCoordinateReferenceSystem::toProj4().
Referenced by QgsPalLabeling::addDiagramLayer(), QgsAtlasComposition::beginRender(), QgsMapOverviewCanvas::destinationSrsChanged(), QgsComposerMap::draw(), QgsComposerAttributeTable::getFeatureAttributes(), QgsMapToolIdentify::identifyRasterLayer(), QgsComposerScaleBar::mapWidth(), QgsPalLabeling::prepareLayer(), QgsHighlight::QgsHighlight(), 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 188 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 1019 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 1231 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 1195 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 734 of file qgsmaprenderer.cpp.
References mProjectionsEnabled.
Referenced by QgsPalLabeling::addDiagramLayer(), QgsTolerance::computeMapUnitPerPixel(), QgsComposerMap::draw(), QgsComposerAttributeTable::getFeatureAttributes(), QgsMapCanvas::hasCrsTransformEnabled(), layerExtentToOutputExtent(), layerToMapCoordinates(), mapToLayerCoordinates(), QgsComposerScaleBar::mapWidth(), outputExtentToLayerExtent(), QgsPalLabeling::prepareLayer(), QgsHighlight::QgsHighlight(), render(), setProjectionsEnabled(), splitLayersExtent(), and writeXML().
|
signal |
|
inline |
Definition at line 179 of file qgsmaprenderer.h.
|
inline |
Labeling engine (NULL if there's no custom engine)
Definition at line 278 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 829 of file qgsmaprenderer.cpp.
References extent(), hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsDebugMsg, QgsRectangle::toString(), tr(), QgsCoordinateTransform::transformBoundingBox(), and QgsException::what().
Referenced by QgsMapCanvas::panToSelected(), updateFullExtent(), and QgsMapCanvas::zoomToSelected().
QStringList & QgsMapRenderer::layerSet | ( | ) |
returns current layer set
Definition at line 1032 of file qgsmaprenderer.cpp.
References mLayerSet.
Referenced by QgsAtlasComposition::beginRender(), QgsComposerMap::containsAdvancedEffects(), QgsComposerMap::containsWMSLayer(), QgsComposerMap::draw(), QgsAtlasComposition::endRender(), QgsMapCanvas::layer(), QgsMapCanvas::layerCount(), QgsComposerLegend::layerIdList(), QgsMapCanvas::layers(), QgsMapOverviewCanvas::layerSet(), 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 873 of file qgsmaprenderer.cpp.
References QgsCoordinateTransform::ForwardTransform, hasCrsTransformEnabled(), QgsMessageLog::logMessage(), tr(), QgsCoordinateTransform::transform(), 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 893 of file qgsmaprenderer.cpp.
References QgsCoordinateTransform::ForwardTransform, hasCrsTransformEnabled(), QgsMessageLog::logMessage(), tr(), QgsCoordinateTransform::transform(), and QgsException::what().
QgsPoint QgsMapRenderer::mapToLayerCoordinates | ( | QgsMapLayer * | theLayer, |
QgsPoint | point | ||
) |
transform point coordinates from output CRS to layer's CRS
Definition at line 913 of file qgsmaprenderer.cpp.
References hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsCoordinateTransform::ReverseTransform, tr(), QgsCoordinateTransform::transform(), 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 933 of file qgsmaprenderer.cpp.
References hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsCoordinateTransform::ReverseTransform, tr(), QgsCoordinateTransform::transform(), 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 176 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 851 of file qgsmaprenderer.cpp.
References extent(), hasCrsTransformEnabled(), QgsMessageLog::logMessage(), QgsDebugMsg, QgsCoordinateTransform::ReverseTransform, QgsRectangle::toString(), tr(), 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 253 of file qgsmaprenderer.h.
Referenced by QgsMapCanvasItem::setRenderContextVariables().
bool QgsMapRenderer::readXML | ( | QDomNode & | theNode | ) |
read settings
Definition at line 1037 of file qgsmaprenderer.cpp.
References QGis::Degrees, QGis::Feet, QGis::Meters, QgsDebugMsg, QgsCoordinateReferenceSystem::readXML(), setDestinationCrs(), setExtent(), setMapUnits(), setProjectionsEnabled(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), 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 QgsCoordinateReferenceSystem::authid(), QgsMapLayer::blendMode(), QgsMapLayer::cacheImage(), QgsMapLayerRegistry::clearAllLayerCaches(), QgsMapLayer::crs(), QgsScaleCalculator::dpi(), QgsMapLayer::draw(), drawError(), drawingProgress(), QgsLabelingEngineInterface::drawLabeling(), QgsMapLayer::drawLabels(), QgsLabelingEngineInterface::exit(), QgsMapLayer::extent(), QgsVectorLayer::featureBlendMode(), hasCrsTransformEnabled(), QgsMapLayer::hasScaleBasedVisibility(), QgsLabelingEngineInterface::init(), QgsCoordinateTransformCache::instance(), QgsMapLayerRegistry::instance(), QgsProject::instance(), QgsVectorLayer::isEditable(), QgsRectangle::isEmpty(), QgsRectangle::isFinite(), QgsRenderContext::labelingEngine(), QgsVectorLayer::layerTransparency(), QgsMapLayerRegistry::mapLayer(), QgsRenderContext::mapToPixel(), QgsMapToPixel::mapUnitsPerPixel(), QgsMapLayer::maximumScale(), mDestCRS, 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(), QgsCoordinateTransformCache::transform(), 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 274 of file qgsmaprenderer.h.
Referenced by QgsComposerMap::draw(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsMapToolIdentify::identifyVectorLayer(), QgsMapCanvas::paintEvent(), and QgsMapCanvas::setRenderFlag().
|
inline |
Scale denominator.
Definition at line 172 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 | ) |
sets destination coordinate reference system
Definition at line 739 of file qgsmaprenderer.cpp.
References destinationSrsChanged(), QgsRectangle::isEmpty(), mDestCRS, mDistArea, mExtent, 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 1176 of file qgsmaprenderer.cpp.
References mLabelingEngine.
Referenced by QgsComposerMap::draw().
void QgsMapRenderer::setLayerSet | ( | const QStringList & | layers | ) |
change current layer set
Definition at line 1025 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 251 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(), 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 175 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 775 of file qgsmaprenderer.cpp.
References QgsMapLayer::crs(), extent(), QgsCoordinateReferenceSystem::geographicFlag(), hasCrsTransformEnabled(), QgsDebugMsg, QgsCoordinateTransform::ReverseTransform, QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), tr(), QgsCoordinateTransform::transform(), QgsCoordinateTransform::transformBoundingBox(), QgsPoint::x(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by render().
|
private |
Definition at line 1184 of file qgsmaprenderer.cpp.
References QgsCoordinateReferenceSystem::authid(), QgsMapLayer::crs(), QgsCoordinateTransformCache::instance(), mDestCRS, and QgsCoordinateTransformCache::transform().
Referenced by layerExtentToOutputExtent(), layerToMapCoordinates(), mapToLayerCoordinates(), outputExtentToLayerExtent(), and splitLayersExtent().
void QgsMapRenderer::updateFullExtent | ( | ) |
updates extent of the layer set
Definition at line 950 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 178 of file qgsmaprenderer.h.
bool QgsMapRenderer::writeXML | ( | QDomNode & | theNode, |
QDomDocument & | theDoc | ||
) |
write settings
Definition at line 1107 of file qgsmaprenderer.cpp.
References QGis::Degrees, destinationCrs(), extent(), QGis::Feet, hasCrsTransformEnabled(), mapUnits(), QGis::Meters, 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 356 of file qgsmaprenderer.h.
Referenced by destinationCrs(), QgsMapRenderer(), render(), setDestinationCrs(), tr(), and ~QgsMapRenderer().
|
protected |
tool for measuring
Definition at line 365 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), setDestinationCrs(), setProjectionsEnabled(), and ~QgsMapRenderer().
|
staticprotected |
indicates drawing in progress
Definition at line 326 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), and render().
|
protected |
current extent to be drawn
Definition at line 338 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), extent(), render(), setDestinationCrs(), setExtent(), and updateScale().
|
protected |
full extent of the layer set
Definition at line 362 of file qgsmaprenderer.h.
Referenced by fullExtent(), and updateFullExtent().
|
protected |
Labeling engine (NULL by default)
Definition at line 374 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 345 of file qgsmaprenderer.h.
Referenced by render(), setExtent(), and setProjectionsEnabled().
|
protected |
stores array of layers to be rendered (identified by string)
Definition at line 359 of file qgsmaprenderer.h.
Referenced by layerSet(), render(), setLayerSet(), and updateFullExtent().
|
protected |
map units per pixel
Definition at line 329 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize().
|
protected |
Output units.
Definition at line 371 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), and render().
|
protected |
indicates whether it's map image for overview
Definition at line 348 of file qgsmaprenderer.h.
Referenced by QgsMapRenderer(), and render().
|
protected |
detemines whether on the fly projection support is enabled
Definition at line 353 of file qgsmaprenderer.h.
Referenced by hasCrsTransformEnabled(), QgsMapRenderer(), and setProjectionsEnabled().
|
protected |
Encapsulates context of rendering.
Definition at line 368 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), and render().
|
protected |
Locks rendering loop for concurrent draws.
Definition at line 377 of file qgsmaprenderer.h.
Referenced by render().
|
protected |
Map scale denominator at its current zoom level.
Definition at line 332 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), QgsMapRenderer(), render(), and updateScale().
|
protected |
scale calculator
Definition at line 335 of file qgsmaprenderer.h.
Referenced by mapUnits(), outputDpi(), QgsMapRenderer(), render(), setMapUnits(), setOutputSize(), updateScale(), and ~QgsMapRenderer().
|
protected |
Definition at line 350 of file qgsmaprenderer.h.
Referenced by adjustExtentToSize(), outputSize(), outputSizeF(), QgsMapRenderer(), render(), setOutputSize(), and updateScale().