QGIS API Documentation
2.4.0-Chugiak
|
Map canvas is a class for displaying all GIS data types on a canvas. More...
#include <qgsmapcanvas.h>
Classes | |
class | CanvasProperties |
Public Types | |
enum | WheelAction { WheelZoom, WheelZoomAndRecenter, WheelZoomToMouseCursor, WheelNothing } |
Public Slots | |
void | refresh () |
Repaints the canvas map. More... | |
void | selectionChangedSlot () |
Receives signal about selection change, and pass it on with layer info. More... | |
void | saveAsImage (QString theFileName, QPixmap *QPixmap=0, QString="PNG") |
Save the convtents of the map canvas to disk as an image. More... | |
void | layerStateChange () |
This slot is connected to the visibility change of one or more layers. More... | |
void | setRenderFlag (bool theFlag) |
Whether to suppress rendering or not. More... | |
bool | renderFlag () |
State of render suppression flag. More... | |
bool | hasCrsTransformEnabled () |
A simple helper method to find out if on the fly projections are enabled or not. More... | |
Q_DECL_DEPRECATED void | updateMap () |
void | stopRendering () |
stop rendering (if there is any right now) More... | |
Q_DECL_DEPRECATED void | showError (QgsMapLayer *mapLayer) |
void | readProject (const QDomDocument &) |
called to read map canvas settings from project More... | |
void | writeProject (QDomDocument &) |
called to write map canvas settings to project More... | |
void | getDatumTransformInfo (const QgsMapLayer *ml, const QString &srcAuthId, const QString &destAuthId) |
ask user about datum transformation More... | |
Signals | |
Q_DECL_DEPRECATED void | setProgress (int, int) |
Let the owner know how far we are with render operations. More... | |
void | xyCoordinates (const QgsPoint &p) |
emits current mouse position More... | |
void | scaleChanged (double) |
Emitted when the scale of the map changes. More... | |
void | extentsChanged () |
Emitted when the extents of the map change. More... | |
void | renderComplete (QPainter *) |
Emitted when the canvas has rendered. More... | |
void | mapCanvasRefreshed () |
Emitted when canvas finished a refresh request. More... | |
void | renderStarting () |
Emitted when the canvas is about to be rendered. More... | |
void | layersChanged () |
Emitted when a new set of layers has been received. More... | |
void | keyPressed (QKeyEvent *e) |
Emit key press event. More... | |
void | keyReleased (QKeyEvent *e) |
Emit key release event. More... | |
void | mapToolSet (QgsMapTool *tool) |
Emit map tool changed event. More... | |
void | mapToolSet (QgsMapTool *newTool, QgsMapTool *oldTool) |
Emit map tool changed with the old tool. More... | |
void | selectionChanged (QgsMapLayer *layer) |
Emitted when selection in any layer gets changed. More... | |
void | zoomLastStatusChanged (bool) |
Emitted when zoom last status changed. More... | |
void | zoomNextStatusChanged (bool) |
Emitted when zoom next status changed. More... | |
void | hasCrsTransformEnabledChanged (bool flag) |
Emitted when on-the-fly projection has been turned on/off. More... | |
void | destinationCrsChanged () |
Emitted when map CRS has changed. More... | |
void | mapUnitsChanged () |
Emmitted when map units are changed. More... | |
Public Member Functions | |
QgsMapCanvas (QWidget *parent=0, const char *name=0) | |
Constructor. More... | |
~QgsMapCanvas () | |
Destructor. More... | |
void | setLayerSet (QList< QgsMapCanvasLayer > &layers) |
void | setCurrentLayer (QgsMapLayer *layer) |
void | updateOverview () |
void | enableOverviewMode (QgsMapOverviewCanvas *overview) |
const QgsMapSettings & | mapSettings () const |
Get access to properties used for map rendering. More... | |
void | setCrsTransformEnabled (bool enabled) |
sets whether to use projections for this layer set More... | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &crs) |
sets destination coordinate reference system More... | |
const QgsLabelingResults * | labelingResults () const |
Get access to the labeling results (may be null) More... | |
void | setCachingEnabled (bool enabled) |
Set whether to cache images of rendered layers. More... | |
bool | isCachingEnabled () const |
Check whether images of rendered layers are curerently being cached. More... | |
void | clearCache () |
Make sure to remove any rendered images from cache (does nothing if cache is not enabled) More... | |
void | setParallelRenderingEnabled (bool enabled) |
Set whether the layers are rendered in parallel or sequentially. More... | |
bool | isParallelRenderingEnabled () const |
Check whether the layers are rendered in parallel or sequentially. More... | |
void | setMapUpdateInterval (int timeMiliseconds) |
Set how often map preview should be updated while it is being rendered (in milliseconds) More... | |
int | mapUpdateInterval () const |
Find out how often map preview should be updated while it is being rendered (in milliseconds) More... | |
QgsMapCanvasMap * | map () |
Q_DECL_DEPRECATED QgsMapRenderer * | mapRenderer () |
Q_DECL_DEPRECATED QPaintDevice & | canvasPaintDevice () |
Accessor for the canvas paint device. More... | |
double | scale () |
Get the last reported scale of the canvas. More... | |
Q_DECL_DEPRECATED void | clear () |
Clear the map canvas. More... | |
double | mapUnitsPerPixel () const |
Returns the mapUnitsPerPixel (map units per pixel) for the canvas. More... | |
QgsRectangle | extent () const |
Returns the current zoom exent of the map canvas. More... | |
QgsRectangle | fullExtent () const |
Returns the combined exent for all layers on the map canvas. More... | |
void | setExtent (const QgsRectangle &r) |
Set the extent of the map canvas. More... | |
void | zoomToFullExtent () |
Zoom to the full extent of all layers. More... | |
void | zoomToPreviousExtent () |
Zoom to the previous extent (view) More... | |
void | zoomToNextExtent () |
Zoom to the next extent (view) More... | |
void | clearExtentHistory () |
void | zoomToSelected (QgsVectorLayer *layer=NULL) |
Zoom to the extent of the selected features of current (vector) layer. More... | |
void | panToSelected (QgsVectorLayer *layer=NULL) |
Pan to the selected features of current (vector) layer keeping same extent. More... | |
void | setMapTool (QgsMapTool *mapTool) |
Sets the map tool currently being used on the canvas. More... | |
void | unsetMapTool (QgsMapTool *mapTool) |
Unset the current map tool or last non zoom tool. More... | |
QgsMapTool * | mapTool () |
Returns the currently active tool. More... | |
virtual void | setCanvasColor (const QColor &_newVal) |
Write property of QColor bgColor. More... | |
virtual QColor | canvasColor () const |
Read property of QColor bgColor. More... | |
void | setSelectionColor (const QColor &color) |
Set color of selected vector features. More... | |
void | updateScale () |
Emits signal scaleChanged to update scale in main window. More... | |
Q_DECL_DEPRECATED void | updateFullExtent () |
Updates the full extent. More... | |
QgsMapLayer * | layer (int index) |
return the map layer at position index in the layer stack More... | |
int | layerCount () const |
return number of layers on the map More... | |
QList< QgsMapLayer * > | layers () const |
return list of layers within map canvas. Added in v1.5 More... | |
void | freeze (bool frz=true) |
bool | isFrozen () |
Q_DECL_DEPRECATED void | setDirty (bool _dirty) |
Flag the canvas as dirty and needed a refresh. More... | |
Q_DECL_DEPRECATED bool | isDirty () const |
Return the state of the canvas (dirty or not) More... | |
void | setMapUnits (QGis::UnitType mapUnits) |
Set map units (needed by project properties dialog) More... | |
QGis::UnitType | mapUnits () const |
Get the current canvas map units. More... | |
const QgsMapToPixel * | getCoordinateTransform () |
Get the current coordinate transform. More... | |
bool | isDrawing () |
Find out whether rendering is in progress. More... | |
QgsMapLayer * | currentLayer () |
returns current layer (set by legend widget) More... | |
void | setWheelAction (WheelAction action, double factor=2) |
set wheel action and zoom factor (should be greater than 1) More... | |
void | zoomIn () |
Zoom in with fixed factor. More... | |
void | zoomOut () |
Zoom out with fixed factor. More... | |
void | zoomScale (double scale) |
Zoom to a specific scale. More... | |
void | zoomByFactor (double scaleFactor) |
Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in. More... | |
void | zoomWithCenter (int x, int y, bool zoomIn) |
Zooms in/out with a given center. More... | |
void | enableAntiAliasing (bool theFlag) |
used to determine if anti-aliasing is enabled or not More... | |
bool | antiAliasingEnabled () const |
true if antialising is enabled More... | |
Q_DECL_DEPRECATED void | useImageToRender (bool theFlag) |
Select which Qt class to render with. More... | |
void | panActionEnd (QPoint releasePoint) |
Ends pan action and redraws the canvas. More... | |
void | panAction (QMouseEvent *event) |
Called when mouse is moving and pan is activated. More... | |
QPoint | mouseLastXY () |
returns last position of mouse cursor More... | |
void | setPreviewModeEnabled (bool previewEnabled) |
Enables a preview mode for the map canvas. More... | |
bool | previewModeEnabled () const |
Returns whether a preview mode is enabled for the map canvas. More... | |
void | setPreviewMode (QgsPreviewEffect::PreviewMode mode) |
Sets a preview mode for the map canvas. More... | |
QgsPreviewEffect::PreviewMode | previewMode () const |
Returns the current preview mode for the map canvas. More... | |
Protected Member Functions | |
void | keyPressEvent (QKeyEvent *e) |
Overridden key press event. More... | |
void | keyReleaseEvent (QKeyEvent *e) |
Overridden key release event. More... | |
void | mouseDoubleClickEvent (QMouseEvent *e) |
Overridden mouse double click event. More... | |
void | mouseMoveEvent (QMouseEvent *e) |
Overridden mouse move event. More... | |
void | mousePressEvent (QMouseEvent *e) |
Overridden mouse press event. More... | |
void | mouseReleaseEvent (QMouseEvent *e) |
Overridden mouse release event. More... | |
void | wheelEvent (QWheelEvent *e) |
Overridden mouse wheel event. More... | |
void | resizeEvent (QResizeEvent *e) |
Overridden resize event. More... | |
void | paintEvent (QPaintEvent *e) |
Overridden paint event. More... | |
void | dragEnterEvent (QDragEnterEvent *e) |
Overridden drag enter event. More... | |
void | moveCanvasContents (bool reset=false) |
called when panning is in action, reset indicates end of panning More... | |
void | updateCanvasItemPositions () |
called on resize or changed extent to notify canvas items to change their rectangle More... | |
void | connectNotify (const char *signal) |
debugging member invoked when a connect() is made to this object More... | |
void | updateDatumTransformEntries () |
Make sure the datum transform store is properly populated. More... | |
Protected Attributes | |
std::auto_ptr< CanvasProperties > | mCanvasProperties |
Handle pattern for implementation object. More... | |
Private Slots | |
void | mapToolDestroyed () |
called when current maptool is destroyed More... | |
void | rendererJobFinished () |
called when a renderer job has finished successfully or when it was cancelled More... | |
void | mapUpdateTimeout () |
void | refreshMap () |
Private Member Functions | |
QgsMapCanvas (QgsMapCanvas const &) | |
this class is non-copyable More... | |
Private Attributes | |
QgsMapSettings | mSettings |
encompases all map settings necessary for map rendering More... | |
QgsMapRenderer * | mMapRenderer |
all map rendering is done in this class More... | |
QgsMapCanvasMap * | mMap |
owns pixmap with rendered map and controls rendering More... | |
QgsMapOverviewCanvas * | mMapOverview |
map overview widget - it's controlled by QgsMapCanvas More... | |
bool | mFrozen |
Flag indicating if the map canvas is frozen. More... | |
bool | mRefreshScheduled |
Flag that allows squashing multiple refresh() calls into just one delayed rendering job. More... | |
bool | mRenderFlag |
determines whether user has requested to suppress rendering More... | |
QgsMapLayer * | mCurrentLayer |
current layer in legend More... | |
QGraphicsScene * | mScene |
graphics scene manages canvas items More... | |
QgsMapTool * | mMapTool |
pointer to current map tool More... | |
QgsMapTool * | mLastNonZoomMapTool |
previous tool if current is for zooming/panning More... | |
QList< QgsRectangle > | mLastExtent |
recently used extent More... | |
int | mLastExtentIndex |
double | mWheelZoomFactor |
Scale factor multiple for default zoom in/out. More... | |
WheelAction | mWheelAction |
Mouse wheel action. More... | |
QTimer | mMapUpdateTimer |
Timer that periodically fires while map rendering is in progress to update the visible map. More... | |
QgsMapRendererQImageJob * | mJob |
Job that takes care of map rendering in background. More... | |
bool | mJobCancelled |
Flag determining whether the active job has been cancelled. More... | |
QgsLabelingResults * | mLabelingResults |
Labeling results from the recently rendered map. More... | |
bool | mUseParallelRendering |
Whether layers are rendered sequentially or in parallel. More... | |
bool | mDrawRenderingStats |
Whether to add rendering stats to the rendered image. More... | |
QgsMapRendererCache * | mCache |
Optionally use cache with rendered map layers for the current map settings. More... | |
QTimer * | mResizeTimer |
QgsPreviewEffect * | mPreviewEffect |
Map canvas is a class for displaying all GIS data types on a canvas.
Definition at line 104 of file qgsmapcanvas.h.
Enumerator | |
---|---|
WheelZoom | |
WheelZoomAndRecenter | |
WheelZoomToMouseCursor | |
WheelNothing |
Definition at line 110 of file qgsmapcanvas.h.
QgsMapCanvas::QgsMapCanvas | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
Constructor.
Definition at line 172 of file qgsmapcanvas.cpp.
References QgsMapSettings::DrawEditingInfo, QgsProject::instance(), mapUpdateTimeout(), mCurrentLayer, mFrozen, mLastExtentIndex, mLastNonZoomMapTool, mMap, mMapOverview, mMapRenderer, mMapTool, mMapUpdateTimer, moveCanvasContents(), mPreviewEffect, mRefreshScheduled, mRenderFlag, mResizeTimer, mScene, mSettings, QgsMapSettings::outputDpi(), readProject(), refresh(), QgsMapSettings::setFlag(), QgsMapSettings::setOutputSize(), QgsMapRenderer::setOutputSize(), setWheelAction(), QgsMapSettings::UseRenderingOptimization, WheelZoom, and writeProject().
QgsMapCanvas::~QgsMapCanvas | ( | ) |
Destructor.
Definition at line 254 of file qgsmapcanvas.cpp.
References QgsMapRendererJob::cancel(), QgsMapTool::deactivate(), mCache, mJob, mLabelingResults, mLastNonZoomMapTool, mMapRenderer, mMapTool, and mScene.
|
private |
this class is non-copyable
Otherwise std::auto_ptr would pass the object responsiblity on to the copy like a hot potato leaving the copyer in a weird state.
|
inline |
true if antialising is enabled
Definition at line 319 of file qgsmapcanvas.h.
References QgsMapSettings::Antialiasing.
Referenced by QgsMapCanvasItem::paint().
|
virtual |
Read property of QColor bgColor.
Definition at line 1457 of file qgsmapcanvas.cpp.
References mScene.
QPaintDevice & QgsMapCanvas::canvasPaintDevice | ( | ) |
Accessor for the canvas paint device.
Definition at line 1507 of file qgsmapcanvas.cpp.
References mMap, QgsMapCanvasMap::paintDevice(), Q_NOWARN_DEPRECATED_POP, and Q_NOWARN_DEPRECATED_PUSH.
void QgsMapCanvas::clear | ( | ) |
Clear the map canvas.
Definition at line 865 of file qgsmapcanvas.cpp.
References refresh().
void QgsMapCanvas::clearCache | ( | ) |
Make sure to remove any rendered images from cache (does nothing if cache is not enabled)
Definition at line 549 of file qgsmapcanvas.cpp.
References QgsMapRendererCache::clear(), and mCache.
void QgsMapCanvas::clearExtentHistory | ( | ) |
Definition at line 923 of file qgsmapcanvas.cpp.
References extent(), mLastExtent, mLastExtentIndex, zoomLastStatusChanged(), and zoomNextStatusChanged().
Referenced by readProject().
|
protected |
debugging member invoked when a connect() is made to this object
Definition at line 1554 of file qgsmapcanvas.cpp.
References QgsDebugMsg.
QgsMapLayer * QgsMapCanvas::currentLayer | ( | ) |
returns current layer (set by legend widget)
Definition at line 586 of file qgsmapcanvas.cpp.
References mCurrentLayer.
Referenced by QgsMapToolIdentify::identify(), setLayerSet(), QgsMapCanvasSnapper::snapToBackgroundLayers(), and QgsMapCanvasSnapper::snapToCurrentLayer().
|
signal |
Emitted when map CRS has changed.
Referenced by enableOverviewMode(), and setDestinationCrs().
|
protected |
Overridden drag enter event.
Definition at line 1830 of file qgsmapcanvas.cpp.
void QgsMapCanvas::enableAntiAliasing | ( | bool | theFlag | ) |
used to determine if anti-aliasing is enabled or not
Definition at line 293 of file qgsmapcanvas.cpp.
References QgsMapSettings::Antialiasing, QgsMapOverviewCanvas::enableAntiAliasing(), mMapOverview, mSettings, and QgsMapSettings::setFlag().
void QgsMapCanvas::enableOverviewMode | ( | QgsMapOverviewCanvas * | overview | ) |
Definition at line 449 of file qgsmapcanvas.cpp.
References destinationCrsChanged(), hasCrsTransformEnabled(), hasCrsTransformEnabledChanged(), and mMapOverview.
QgsRectangle QgsMapCanvas::extent | ( | ) | const |
Returns the current zoom exent of the map canvas.
Definition at line 799 of file qgsmapcanvas.cpp.
References mapSettings(), and QgsMapSettings::visibleExtent().
Referenced by QgsMapToolZoom::canvasReleaseEvent(), clearExtentHistory(), QgsMapOverviewCanvas::drawExtentRect(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), QgsMapToolIdentify::identify(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsHighlight::paint(), QgsHighlight::paintPoint(), QgsMapToolTouch::pinchTriggered(), setExtent(), QgsHighlight::updateRect(), wheelEvent(), zoomToFullExtent(), and zoomToSelected().
|
signal |
Emitted when the extents of the map change.
Referenced by resizeEvent(), setExtent(), zoomToNextExtent(), and zoomToPreviousExtent().
void QgsMapCanvas::freeze | ( | bool | frz = true | ) |
Freeze/thaw the map canvas. This is used to prevent the canvas from responding to events while layers are being added/removed etc.
frz | Boolean specifying if the canvas should be frozen (true) or thawed (false). Default is true. |
Definition at line 1496 of file qgsmapcanvas.cpp.
References mFrozen.
QgsRectangle QgsMapCanvas::fullExtent | ( | ) | const |
Returns the combined exent for all layers on the map canvas.
Definition at line 804 of file qgsmapcanvas.cpp.
References QgsMapSettings::fullExtent(), and mapSettings().
Referenced by QgsMapOverviewCanvas::updateFullExtent(), and zoomToFullExtent().
const QgsMapToPixel * QgsMapCanvas::getCoordinateTransform | ( | ) |
Get the current coordinate transform.
Definition at line 358 of file qgsmapcanvas.cpp.
References mapSettings(), and QgsMapSettings::mapToPixel().
Referenced by QgsMapToolPan::canvasReleaseEvent(), QgsMapToolZoom::canvasReleaseEvent(), QgsMapToolTouch::canvasReleaseEvent(), QgsMapToolIdentify::identify(), mouseMoveEvent(), panActionEnd(), QgsMapToolTouch::pinchTriggered(), QgsRubberBand::setToCanvasRectangle(), QgsMapCanvasSnapper::snapToBackgroundLayers(), QgsMapCanvasItem::toCanvasCoordinates(), QgsMapTool::toCanvasCoordinates(), QgsMapCanvasItem::toMapCoordinates(), QgsMapTool::toMapCoordinates(), wheelEvent(), and zoomWithCenter().
|
slot |
ask user about datum transformation
Ask user which datum transform to use.
Definition at line 1746 of file qgsmapcanvas.cpp.
References QgsDatumTransformStore::addEntry(), QgsMapRenderer::addLayerCoordinateTransform(), QgsCoordinateReferenceSystem::authid(), QgsCRSCache::crsByAuthId(), QgsCoordinateTransform::datumTransformations(), QgsMapSettings::datumTransformStore(), QgsMapLayer::id(), QgsCRSCache::instance(), mMapRenderer, mSettings, QgsMapLayer::name(), and QgsDatumTransformDialog::setDatumTransformInfo().
Referenced by updateDatumTransformEntries().
|
slot |
A simple helper method to find out if on the fly projections are enabled or not.
Definition at line 934 of file qgsmapcanvas.cpp.
References QgsMapSettings::hasCrsTransformEnabled(), and mapSettings().
Referenced by enableOverviewMode(), QgsMapToolIdentify::featureDerivedAttributes(), and QgsMapToolIdentify::identifyRasterLayer().
|
signal |
Emitted when on-the-fly projection has been turned on/off.
Referenced by enableOverviewMode(), and setCrsTransformEnabled().
bool QgsMapCanvas::isCachingEnabled | ( | ) | const |
Check whether images of rendered layers are curerently being cached.
Definition at line 544 of file qgsmapcanvas.cpp.
References mCache.
Referenced by setCachingEnabled().
bool QgsMapCanvas::isDirty | ( | ) | const |
Return the state of the canvas (dirty or not)
Definition at line 343 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::isDrawing | ( | ) |
Find out whether rendering is in progress.
Definition at line 350 of file qgsmapcanvas.cpp.
References mJob.
bool QgsMapCanvas::isFrozen | ( | ) |
Accessor for frozen status of canvas
Definition at line 1501 of file qgsmapcanvas.cpp.
References mFrozen.
bool QgsMapCanvas::isParallelRenderingEnabled | ( | ) | const |
Check whether the layers are rendered in parallel or sequentially.
Definition at line 560 of file qgsmapcanvas.cpp.
References mUseParallelRendering.
|
signal |
Emit key press event.
Referenced by keyPressEvent().
|
protected |
Overridden key press event.
Definition at line 1004 of file qgsmapcanvas.cpp.
References keyPressed(), QgsMapTool::keyPressEvent(), mapSettings(), mCanvasProperties, mDrawRenderingStats, mMapTool, mUseParallelRendering, QgsDebugMsg, refresh(), setExtent(), QgsRectangle::setXMaximum(), QgsRectangle::setXMinimum(), QgsRectangle::setYMaximum(), QgsRectangle::setYMinimum(), QgsMapSettings::visibleExtent(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), QgsRectangle::yMinimum(), zoomIn(), and zoomOut().
|
signal |
Emit key release event.
Referenced by keyReleaseEvent().
|
protected |
Overridden key release event.
Definition at line 1111 of file qgsmapcanvas.cpp.
References keyReleased(), QgsMapTool::keyReleaseEvent(), mCanvasProperties, mMapTool, panActionEnd(), and QgsDebugMsg.
const QgsLabelingResults * QgsMapCanvas::labelingResults | ( | ) | const |
Get access to the labeling results (may be null)
Definition at line 523 of file qgsmapcanvas.cpp.
References mLabelingResults.
QgsMapLayer * QgsMapCanvas::layer | ( | int | index | ) |
return the map layer at position index in the layer stack
Definition at line 317 of file qgsmapcanvas.cpp.
References QgsMapLayerRegistry::instance(), QgsMapSettings::layers(), layers(), QgsMapLayerRegistry::mapLayer(), and mapSettings().
Referenced by QgsMapToolIdentify::identify(), layers(), selectionChangedSlot(), setCurrentLayer(), setLayerSet(), and updateDatumTransformEntries().
int QgsMapCanvas::layerCount | ( | ) | const |
return number of layers on the map
Definition at line 1467 of file qgsmapcanvas.cpp.
References QgsMapSettings::layers(), and mapSettings().
Referenced by QgsMapToolIdentify::identify(), and setLayerSet().
QList< QgsMapLayer * > QgsMapCanvas::layers | ( | ) | const |
return list of layers within map canvas. Added in v1.5
Definition at line 1473 of file qgsmapcanvas.cpp.
References QgsMapLayerRegistry::instance(), layer(), QgsMapLayerRegistry::mapLayer(), and mapSettings().
Referenced by layer(), QgsFormAnnotationItem::updateVisibility(), and QgsHtmlAnnotationItem::updateVisibility().
|
signal |
Emitted when a new set of layers has been received.
Referenced by setLayerSet().
|
slot |
This slot is connected to the visibility change of one or more layers.
Definition at line 1486 of file qgsmapcanvas.cpp.
References refresh().
QgsMapCanvasMap * QgsMapCanvas::map | ( | ) |
Definition at line 306 of file qgsmapcanvas.cpp.
References mMap.
|
signal |
Emitted when canvas finished a refresh request.
Referenced by rendererJobFinished().
QgsMapRenderer * QgsMapCanvas::mapRenderer | ( | ) |
Definition at line 311 of file qgsmapcanvas.cpp.
References mMapRenderer.
const QgsMapSettings & QgsMapCanvas::mapSettings | ( | ) | const |
Get access to properties used for map rendering.
Definition at line 474 of file qgsmapcanvas.cpp.
References mSettings.
Referenced by QgsRubberBand::addGeometry(), QgsMapOverviewCanvas::destinationSrsChanged(), extent(), QgsMapToolIdentify::featureDerivedAttributes(), QgsMapTip::fetchFeature(), fullExtent(), QgsAttributeTableFilterModel::generateListOfVisibleFeatures(), getCoordinateTransform(), hasCrsTransformEnabled(), QgsMapToolIdentify::identifyRasterLayer(), QgsMapToolIdentify::identifyVectorLayer(), QgsHighlight::init(), keyPressEvent(), layer(), layerCount(), layers(), mapUnits(), mapUnitsPerPixel(), QgsMapCanvasRendererSync::onCrsTransformC2R(), QgsMapCanvasRendererSync::onDestCrsC2R(), QgsMapCanvasRendererSync::onExtentC2R(), QgsMapCanvasRendererSync::onLayersC2R(), QgsMapCanvasRendererSync::onMapUnitsC2R(), QgsHighlight::paint(), panActionEnd(), panToSelected(), QgsMapCanvasSnapper::QgsMapCanvasSnapper(), saveAsImage(), scale(), QgsMapTool::searchRadiusMU(), setLayerSet(), QgsMapCanvasSnapper::setMapCanvas(), QgsScaleRangeWidget::setMaxScaleFromCanvas(), QgsScaleRangeWidget::setMinScaleFromCanvas(), QgsMapCanvasItem::setRenderContextVariables(), QgsMapCanvasSnapper::snapToBackgroundLayers(), QgsMapCanvasSnapper::snapToCurrentLayer(), QgsMapTool::toLayerCoordinates(), QgsMapTool::toMapCoordinates(), updateScale(), wheelEvent(), zoomByFactor(), zoomToSelected(), and zoomWithCenter().
QgsMapTool * QgsMapCanvas::mapTool | ( | ) |
Returns the currently active tool.
Definition at line 1585 of file qgsmapcanvas.cpp.
References mMapTool.
|
privateslot |
called when current maptool is destroyed
Definition at line 1838 of file qgsmapcanvas.cpp.
References mMapTool, and QgsDebugMsg.
Referenced by setMapTool().
|
signal |
Emit map tool changed event.
Referenced by setMapTool(), and unsetMapTool().
|
signal |
Emit map tool changed with the old tool.
QGis::UnitType QgsMapCanvas::mapUnits | ( | ) | const |
Get the current canvas map units.
Definition at line 1536 of file qgsmapcanvas.cpp.
References mapSettings(), and QgsMapSettings::mapUnits().
Referenced by QgsMapToolIdentify::convertMeasurement(), and QgsMapToolIdentify::displayUnits().
|
signal |
double QgsMapCanvas::mapUnitsPerPixel | ( | ) | const |
Returns the mapUnitsPerPixel (map units per pixel) for the canvas.
Definition at line 1514 of file qgsmapcanvas.cpp.
References mapSettings(), and QgsMapSettings::mapUnitsPerPixel().
Referenced by QgsMapToolIdentify::identify(), saveAsImage(), and QgsRubberBand::updateRect().
int QgsMapCanvas::mapUpdateInterval | ( | ) | const |
Find out how often map preview should be updated while it is being rendered (in milliseconds)
Definition at line 570 of file qgsmapcanvas.cpp.
References mMapUpdateTimer.
|
privateslot |
Definition at line 724 of file qgsmapcanvas.cpp.
References mJob, mMap, mSettings, QgsMapRendererQImageJob::renderedImage(), QgsMapCanvasMap::setContent(), and QgsMapSettings::visibleExtent().
Referenced by QgsMapCanvas().
|
protected |
Overridden mouse double click event.
Definition at line 1143 of file qgsmapcanvas.cpp.
References QgsMapTool::canvasDoubleClickEvent(), and mMapTool.
QPoint QgsMapCanvas::mouseLastXY | ( | ) |
returns last position of mouse cursor
Definition at line 1658 of file qgsmapcanvas.cpp.
References mCanvasProperties.
|
protected |
Overridden mouse move event.
Definition at line 1360 of file qgsmapcanvas.cpp.
References QgsMapTool::canvasMoveEvent(), getCoordinateTransform(), mCanvasProperties, mMapTool, panAction(), QgsMapToPixel::toMapCoordinates(), and xyCoordinates().
|
protected |
Overridden mouse press event.
Definition at line 1151 of file qgsmapcanvas.cpp.
References QgsMapTool::canvasPressEvent(), mCanvasProperties, and mMapTool.
|
protected |
Overridden mouse release event.
Definition at line 1178 of file qgsmapcanvas.cpp.
References QgsMapTool::canvasReleaseEvent(), QgsVectorLayer::isEditable(), QgsMapTool::isEditTool(), QgsMapTool::isTransient(), mCanvasProperties, mCurrentLayer, mLastNonZoomMapTool, mMapTool, panActionEnd(), QgsDebugMsg, and setMapTool().
|
protected |
called when panning is in action, reset indicates end of panning
Definition at line 1644 of file qgsmapcanvas.cpp.
References mCanvasProperties.
Referenced by panAction(), panActionEnd(), QgsMapCanvas(), and resizeEvent().
|
protected |
Overridden paint event.
Definition at line 1245 of file qgsmapcanvas.cpp.
void QgsMapCanvas::panAction | ( | QMouseEvent * | event | ) |
Called when mouse is moving and pan is activated.
Definition at line 1636 of file qgsmapcanvas.cpp.
References moveCanvasContents().
Referenced by QgsMapToolPan::canvasMoveEvent(), QgsMapToolTouch::canvasMoveEvent(), and mouseMoveEvent().
void QgsMapCanvas::panActionEnd | ( | QPoint | releasePoint | ) |
Ends pan action and redraws the canvas.
Definition at line 1590 of file qgsmapcanvas.cpp.
References getCoordinateTransform(), mapSettings(), mCanvasProperties, moveCanvasContents(), refresh(), setExtent(), QgsRectangle::setXMinimum(), QgsMapToPixel::toMapCoordinates(), QgsMapSettings::visibleExtent(), QgsPoint::x(), and QgsPoint::y().
Referenced by QgsMapToolPan::canvasReleaseEvent(), QgsMapToolTouch::canvasReleaseEvent(), keyReleaseEvent(), and mouseReleaseEvent().
void QgsMapCanvas::panToSelected | ( | QgsVectorLayer * | layer = NULL | ) |
Pan to the selected features of current (vector) layer keeping same extent.
Definition at line 981 of file qgsmapcanvas.cpp.
References QgsVectorLayer::boundingBoxOfSelected(), QgsRectangle::center(), QgsMapSettings::layerExtentToOutputExtent(), mapSettings(), mCurrentLayer, refresh(), QgsVectorLayer::selectedFeatureCount(), and setExtent().
QgsPreviewEffect::PreviewMode QgsMapCanvas::previewMode | ( | ) | const |
Returns the current preview mode for the map canvas.
This setting only has an effect if previewModeEnabled is true.
Definition at line 1693 of file qgsmapcanvas.cpp.
References QgsPreviewEffect::mode(), mPreviewEffect, and QgsPreviewEffect::PreviewGrayscale.
bool QgsMapCanvas::previewModeEnabled | ( | ) | const |
Returns whether a preview mode is enabled for the map canvas.
Definition at line 1673 of file qgsmapcanvas.cpp.
References mPreviewEffect.
|
slot |
called to read map canvas settings from project
Definition at line 1703 of file qgsmapcanvas.cpp.
References clearExtentHistory(), QgsMapSettings::datumTransformStore(), QgsMapSettings::destinationCrs(), QgsMapSettings::extent(), QgsMapSettings::hasCrsTransformEnabled(), QgsMapSettings::mapUnits(), mSettings, QgsDebugMsg, QgsMapSettings::readXML(), setCrsTransformEnabled(), setDestinationCrs(), setExtent(), and setMapUnits().
Referenced by QgsMapCanvas().
|
slot |
Repaints the canvas map.
Definition at line 592 of file qgsmapcanvas.cpp.
References QgsMapSettings::hasValidSettings(), mFrozen, mRefreshScheduled, mRenderFlag, mSettings, QgsDebugMsg, and refreshMap().
Referenced by QgsMapToolPan::canvasReleaseEvent(), QgsMapToolZoom::canvasReleaseEvent(), QgsMapToolTouch::canvasReleaseEvent(), clear(), keyPressEvent(), layerStateChange(), QgsMapOverviewCanvas::mouseReleaseEvent(), panActionEnd(), panToSelected(), QgsMapToolTouch::pinchTriggered(), QgsMapCanvas(), selectionChangedSlot(), setCrsTransformEnabled(), setDestinationCrs(), setDirty(), setLayerSet(), setMapUnits(), setRenderFlag(), wheelEvent(), zoomByFactor(), zoomToFullExtent(), zoomToNextExtent(), zoomToPreviousExtent(), zoomToSelected(), and zoomWithCenter().
|
privateslot |
Definition at line 620 of file qgsmapcanvas.cpp.
References QgsMapLayerRegistry::instance(), QgsMapSettings::layers(), mCache, mJob, mJobCancelled, mMapUpdateTimer, mRefreshScheduled, mSettings, mUseParallelRendering, QgsDebugMsg, rendererJobFinished(), renderStarting(), QgsMapRendererJob::setCache(), QgsMapRendererJob::setRequestedGeometryCacheForLayers(), QgsExpression::setSpecialColumn(), QgsMapRendererJob::start(), stopRendering(), and tr.
Referenced by refresh().
|
signal |
Emitted when the canvas has rendered.
Passes a pointer to the painter on which the map was drawn. This is useful for plugins that wish to draw on the map after it has been rendered. Passing the painter allows plugins to work when the map is being rendered onto a pixmap other than the mapCanvas own pixmap member.TODO: deprecate when decorations are reimplemented as map canvas items
Referenced by rendererJobFinished(), and saveAsImage().
|
privateslot |
called when a renderer job has finished successfully or when it was cancelled
Definition at line 663 of file qgsmapcanvas.cpp.
References QgsMapRendererJob::errors(), QgsMapRendererJob::Error::layerID, QgsMessageLog::logMessage(), mapCanvasRefreshed(), mDrawRenderingStats, QgsMapRendererJob::Error::message, mJob, mJobCancelled, mLabelingResults, mMap, mMapUpdateTimer, mSettings, mUseParallelRendering, QgsDebugMsg, renderComplete(), QgsMapRendererQImageJob::renderedImage(), QgsMapRendererJob::renderingTime(), QgsMapCanvasMap::setContent(), QgsMapRendererJob::takeLabelingResults(), tr, and QgsMapSettings::visibleExtent().
Referenced by refreshMap().
|
inlineslot |
State of render suppression flag.
Definition at line 383 of file qgsmapcanvas.h.
|
signal |
|
protected |
Overridden resize event.
Definition at line 1221 of file qgsmapcanvas.cpp.
References extentsChanged(), mMapRenderer, moveCanvasContents(), mResizeTimer, mScene, mSettings, QgsMapSettings::outputDpi(), QgsMapSettings::setOutputSize(), QgsMapRenderer::setOutputSize(), updateCanvasItemPositions(), and updateScale().
|
slot |
Save the convtents of the map canvas to disk as an image.
Definition at line 746 of file qgsmapcanvas.cpp.
References QgsMapCanvasMap::contentImage(), mapSettings(), mapUnitsPerPixel(), mMap, mSettings, qgsDoubleToString(), renderComplete(), QgsMapRendererCustomPainterJob::start(), QgsMapSettings::visibleExtent(), QgsMapRendererCustomPainterJob::waitForFinished(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().
double QgsMapCanvas::scale | ( | ) |
Get the last reported scale of the canvas.
Definition at line 332 of file qgsmapcanvas.cpp.
References mapSettings(), and QgsMapSettings::scale().
Referenced by QgsMapCanvasItem::setRenderContextVariables(), updateScale(), and zoomScale().
|
signal |
Emitted when the scale of the map changes.
Referenced by updateScale().
|
signal |
Emitted when selection in any layer gets changed.
Referenced by selectionChangedSlot(), and setLayerSet().
|
slot |
Receives signal about selection change, and pass it on with layer info.
Definition at line 1822 of file qgsmapcanvas.cpp.
References layer(), refresh(), and selectionChanged().
Referenced by setLayerSet().
void QgsMapCanvas::setCachingEnabled | ( | bool | enabled | ) |
Set whether to cache images of rendered layers.
Definition at line 528 of file qgsmapcanvas.cpp.
References isCachingEnabled(), and mCache.
|
virtual |
Write property of QColor bgColor.
Definition at line 1439 of file qgsmapcanvas.cpp.
References mScene, mSettings, and QgsMapSettings::setBackgroundColor().
void QgsMapCanvas::setCrsTransformEnabled | ( | bool | enabled | ) |
sets whether to use projections for this layer set
Definition at line 479 of file qgsmapcanvas.cpp.
References QgsMapSettings::hasCrsTransformEnabled(), hasCrsTransformEnabledChanged(), mSettings, refresh(), QgsMapSettings::setCrsTransformEnabled(), and updateDatumTransformEntries().
Referenced by QgsMapCanvasRendererSync::onCrsTransformR2C(), and readProject().
void QgsMapCanvas::setCurrentLayer | ( | QgsMapLayer * | layer | ) |
Definition at line 327 of file qgsmapcanvas.cpp.
References layer(), and mCurrentLayer.
void QgsMapCanvas::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
sets destination coordinate reference system
Definition at line 493 of file qgsmapcanvas.cpp.
References QgsMapSettings::destinationCrs(), destinationCrsChanged(), QgsMapSettings::hasCrsTransformEnabled(), QgsRectangle::isEmpty(), mSettings, QgsDebugMsg, refresh(), QgsMapSettings::setDestinationCrs(), setExtent(), updateDatumTransformEntries(), and QgsMapSettings::visibleExtent().
Referenced by QgsMapCanvasRendererSync::onDestCrsR2C(), and readProject().
void QgsMapCanvas::setDirty | ( | bool | _dirty | ) |
Flag the canvas as dirty and needed a refresh.
Definition at line 337 of file qgsmapcanvas.cpp.
References refresh().
void QgsMapCanvas::setExtent | ( | const QgsRectangle & | r | ) |
Set the extent of the map canvas.
Definition at line 810 of file qgsmapcanvas.cpp.
References QgsRectangle::center(), extent(), extentsChanged(), QgsRectangle::height(), QgsRectangle::isEmpty(), mLastExtent, mLastExtentIndex, mSettings, QgsDebugMsg, QgsMapSettings::setExtent(), updateCanvasItemPositions(), updateScale(), QgsRectangle::width(), QgsPoint::x(), QgsPoint::y(), zoomLastStatusChanged(), and zoomNextStatusChanged().
Referenced by QgsMapToolPan::canvasReleaseEvent(), QgsMapToolZoom::canvasReleaseEvent(), QgsMapToolTouch::canvasReleaseEvent(), keyPressEvent(), QgsMapOverviewCanvas::mouseReleaseEvent(), QgsMapCanvasRendererSync::onExtentR2C(), panActionEnd(), panToSelected(), QgsMapToolTouch::pinchTriggered(), readProject(), setDestinationCrs(), wheelEvent(), zoomByFactor(), zoomToFullExtent(), zoomToSelected(), and zoomWithCenter().
void QgsMapCanvas::setLayerSet | ( | QList< QgsMapCanvasLayer > & | layers | ) |
Definition at line 363 of file qgsmapcanvas.cpp.
References currentLayer(), QgsMapLayer::id(), QgsMapCanvasLayer::isInOverview(), QgsMapCanvasLayer::isVisible(), QgsMapCanvasLayer::layer(), layer(), layerCount(), QgsMapSettings::layers(), layersChanged(), QgsMapOverviewCanvas::layerSet(), mapSettings(), mMapOverview, mSettings, QgsDebugMsg, refresh(), selectionChanged(), selectionChangedSlot(), QgsMapSettings::setLayers(), QgsMapOverviewCanvas::setLayerSet(), updateDatumTransformEntries(), and updateOverview().
void QgsMapCanvas::setMapTool | ( | QgsMapTool * | mapTool | ) |
Sets the map tool currently being used on the canvas.
Definition at line 1384 of file qgsmapcanvas.cpp.
References QgsMapTool::activate(), QgsMapTool::deactivate(), QgsMapTool::isTransient(), mapToolDestroyed(), mapToolSet(), mLastNonZoomMapTool, and mMapTool.
Referenced by mouseReleaseEvent().
void QgsMapCanvas::setMapUnits | ( | QGis::UnitType | mapUnits | ) |
Set map units (needed by project properties dialog)
Definition at line 1520 of file qgsmapcanvas.cpp.
References QgsMapSettings::mapUnits(), mapUnitsChanged(), mSettings, QgsDebugMsg, refresh(), QgsMapSettings::setMapUnits(), and updateScale().
Referenced by QgsMapCanvasRendererSync::onMapUnitsR2C(), and readProject().
void QgsMapCanvas::setMapUpdateInterval | ( | int | timeMiliseconds | ) |
Set how often map preview should be updated while it is being rendered (in milliseconds)
Definition at line 565 of file qgsmapcanvas.cpp.
References mMapUpdateTimer.
void QgsMapCanvas::setParallelRenderingEnabled | ( | bool | enabled | ) |
Set whether the layers are rendered in parallel or sequentially.
Definition at line 555 of file qgsmapcanvas.cpp.
References mUseParallelRendering.
void QgsMapCanvas::setPreviewMode | ( | QgsPreviewEffect::PreviewMode | mode | ) |
Sets a preview mode for the map canvas.
This setting only has an effect if previewModeEnabled is true.
mode | preview mode for the canvas |
Definition at line 1683 of file qgsmapcanvas.cpp.
References mPreviewEffect, and QgsPreviewEffect::setMode().
void QgsMapCanvas::setPreviewModeEnabled | ( | bool | previewEnabled | ) |
Enables a preview mode for the map canvas.
previewEnabled | set to true to enable a preview mode |
Definition at line 1663 of file qgsmapcanvas.cpp.
References mPreviewEffect.
|
signal |
Let the owner know how far we are with render operations.
|
slot |
Whether to suppress rendering or not.
Definition at line 1542 of file qgsmapcanvas.cpp.
References mRenderFlag, refresh(), and stopRendering().
void QgsMapCanvas::setSelectionColor | ( | const QColor & | color | ) |
Set color of selected vector features.
Definition at line 1462 of file qgsmapcanvas.cpp.
References mSettings, and QgsMapSettings::setSelectionColor().
void QgsMapCanvas::setWheelAction | ( | WheelAction | action, |
double | factor = 2 |
||
) |
set wheel action and zoom factor (should be greater than 1)
Definition at line 1327 of file qgsmapcanvas.cpp.
References mWheelAction, and mWheelZoomFactor.
Referenced by QgsMapCanvas().
|
slot |
Definition at line 1653 of file qgsmapcanvas.cpp.
|
slot |
stop rendering (if there is any right now)
Definition at line 730 of file qgsmapcanvas.cpp.
References QgsMapRendererJob::cancel(), mJob, mJobCancelled, and QgsDebugMsg.
Referenced by refreshMap(), and setRenderFlag().
void QgsMapCanvas::unsetMapTool | ( | QgsMapTool * | mapTool | ) |
Unset the current map tool or last non zoom tool.
This is called from destructor of map tools to make sure that this map tool won't be used any more. You don't have to call it manualy, QgsMapTool takes care of it.
Definition at line 1421 of file qgsmapcanvas.cpp.
References QgsMapTool::deactivate(), mapToolSet(), mLastNonZoomMapTool, and mMapTool.
Referenced by QgsMapTool::~QgsMapTool().
|
protected |
called on resize or changed extent to notify canvas items to change their rectangle
Definition at line 1252 of file qgsmapcanvas.cpp.
References mScene, and QgsMapCanvasItem::updatePosition().
Referenced by resizeEvent(), setExtent(), zoomToNextExtent(), and zoomToPreviousExtent().
|
protected |
Make sure the datum transform store is properly populated.
Definition at line 1561 of file qgsmapcanvas.cpp.
References QgsCoordinateReferenceSystem::authid(), QgsMapLayer::crs(), QgsMapSettings::datumTransformStore(), QgsMapSettings::destinationCrs(), QgsVectorLayer::geometryType(), getDatumTransformInfo(), QgsMapSettings::hasCrsTransformEnabled(), QgsDatumTransformStore::hasEntryForLayer(), QgsMapLayerRegistry::instance(), layer(), QgsMapSettings::layers(), QgsMapLayerRegistry::mapLayer(), mSettings, and QGis::NoGeometry.
Referenced by setCrsTransformEnabled(), setDestinationCrs(), and setLayerSet().
|
inline |
Updates the full extent.
Definition at line 252 of file qgsmapcanvas.h.
|
slot |
Definition at line 741 of file qgsmapcanvas.cpp.
void QgsMapCanvas::updateOverview | ( | ) |
Definition at line 576 of file qgsmapcanvas.cpp.
References mMapOverview, and QgsMapOverviewCanvas::refresh().
Referenced by setLayerSet().
void QgsMapCanvas::updateScale | ( | ) |
Emits signal scaleChanged to update scale in main window.
Definition at line 859 of file qgsmapcanvas.cpp.
References mapSettings(), scale(), and scaleChanged().
Referenced by resizeEvent(), setExtent(), setMapUnits(), zoomToNextExtent(), and zoomToPreviousExtent().
void QgsMapCanvas::useImageToRender | ( | bool | theFlag | ) |
Select which Qt class to render with.
Definition at line 301 of file qgsmapcanvas.cpp.
|
protected |
Overridden mouse wheel event.
Definition at line 1270 of file qgsmapcanvas.cpp.
References extent(), getCoordinateTransform(), mapSettings(), mMapTool, mWheelAction, mWheelZoomFactor, QgsDebugMsg, refresh(), QgsRectangle::scale(), setExtent(), QgsMapSettings::visibleExtent(), QgsMapTool::wheelEvent(), WheelNothing, WheelZoom, WheelZoomAndRecenter, WheelZoomToMouseCursor, QgsPoint::x(), QgsPoint::y(), zoomIn(), zoomOut(), and zoomWithCenter().
|
slot |
called to write map canvas settings to project
Definition at line 1726 of file qgsmapcanvas.cpp.
References mSettings, QgsDebugMsg, and QgsMapSettings::writeXML().
Referenced by QgsMapCanvas().
|
signal |
void QgsMapCanvas::zoomByFactor | ( | double | scaleFactor | ) |
Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in.
Definition at line 1814 of file qgsmapcanvas.cpp.
References mapSettings(), refresh(), QgsRectangle::scale(), setExtent(), and QgsMapSettings::visibleExtent().
Referenced by zoomIn(), zoomOut(), and zoomScale().
void QgsMapCanvas::zoomIn | ( | ) |
Zoom in with fixed factor.
Definition at line 1333 of file qgsmapcanvas.cpp.
References mWheelZoomFactor, and zoomByFactor().
Referenced by keyPressEvent(), and wheelEvent().
|
signal |
Emitted when zoom last status changed.
Referenced by clearExtentHistory(), setExtent(), zoomToNextExtent(), and zoomToPreviousExtent().
|
signal |
Emitted when zoom next status changed.
Referenced by clearExtentHistory(), setExtent(), zoomToNextExtent(), and zoomToPreviousExtent().
void QgsMapCanvas::zoomOut | ( | ) |
Zoom out with fixed factor.
Definition at line 1338 of file qgsmapcanvas.cpp.
References mWheelZoomFactor, and zoomByFactor().
Referenced by keyPressEvent(), QgsMapToolTouch::pinchTriggered(), and wheelEvent().
void QgsMapCanvas::zoomScale | ( | double | scale | ) |
Zoom to a specific scale.
Definition at line 1343 of file qgsmapcanvas.cpp.
References scale(), and zoomByFactor().
void QgsMapCanvas::zoomToFullExtent | ( | ) |
Zoom to the full extent of all layers.
Definition at line 872 of file qgsmapcanvas.cpp.
References extent(), fullExtent(), QgsRectangle::isEmpty(), refresh(), QgsRectangle::scale(), and setExtent().
void QgsMapCanvas::zoomToNextExtent | ( | ) |
Zoom to the next extent (view)
Definition at line 906 of file qgsmapcanvas.cpp.
References extentsChanged(), mLastExtent, mLastExtentIndex, mSettings, refresh(), QgsMapSettings::setExtent(), updateCanvasItemPositions(), updateScale(), zoomLastStatusChanged(), and zoomNextStatusChanged().
void QgsMapCanvas::zoomToPreviousExtent | ( | ) |
Zoom to the previous extent (view)
Definition at line 888 of file qgsmapcanvas.cpp.
References extentsChanged(), mLastExtent, mLastExtentIndex, mSettings, refresh(), QgsMapSettings::setExtent(), updateCanvasItemPositions(), updateScale(), zoomLastStatusChanged(), and zoomNextStatusChanged().
void QgsMapCanvas::zoomToSelected | ( | QgsVectorLayer * | layer = NULL | ) |
Zoom to the extent of the selected features of current (vector) layer.
Added in version 1.2: optionally specify different than current layer
Definition at line 939 of file qgsmapcanvas.cpp.
References QgsVectorLayer::boundingBoxOfSelected(), QgsRectangle::center(), extent(), QgsRectangle::isEmpty(), QgsMapSettings::layerExtentToOutputExtent(), mapSettings(), mCurrentLayer, refresh(), QgsRectangle::scale(), QgsVectorLayer::selectedFeatureCount(), and setExtent().
void QgsMapCanvas::zoomWithCenter | ( | int | x, |
int | y, | ||
bool | zoomIn | ||
) |
Zooms in/out with a given center.
Definition at line 1348 of file qgsmapcanvas.cpp.
References getCoordinateTransform(), mapSettings(), mWheelZoomFactor, refresh(), QgsRectangle::scale(), setExtent(), QgsMapToPixel::toMapPoint(), and QgsMapSettings::visibleExtent().
Referenced by QgsMapToolTouch::canvasDoubleClickEvent(), QgsMapToolZoom::canvasReleaseEvent(), and wheelEvent().
|
private |
Optionally use cache with rendered map layers for the current map settings.
Definition at line 625 of file qgsmapcanvas.h.
Referenced by clearCache(), isCachingEnabled(), refreshMap(), setCachingEnabled(), and ~QgsMapCanvas().
|
protected |
Handle pattern for implementation object.
Definition at line 540 of file qgsmapcanvas.h.
Referenced by keyPressEvent(), keyReleaseEvent(), mouseLastXY(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveCanvasContents(), and panActionEnd().
|
private |
current layer in legend
Definition at line 585 of file qgsmapcanvas.h.
Referenced by currentLayer(), mouseReleaseEvent(), panToSelected(), QgsMapCanvas(), setCurrentLayer(), and zoomToSelected().
|
private |
Whether to add rendering stats to the rendered image.
Definition at line 622 of file qgsmapcanvas.h.
Referenced by keyPressEvent(), and rendererJobFinished().
|
private |
Flag indicating if the map canvas is frozen.
Definition at line 576 of file qgsmapcanvas.h.
Referenced by freeze(), isFrozen(), QgsMapCanvas(), and refresh().
|
private |
Job that takes care of map rendering in background.
Definition at line 610 of file qgsmapcanvas.h.
Referenced by isDrawing(), mapUpdateTimeout(), refreshMap(), rendererJobFinished(), stopRendering(), and ~QgsMapCanvas().
|
private |
Flag determining whether the active job has been cancelled.
Definition at line 613 of file qgsmapcanvas.h.
Referenced by refreshMap(), rendererJobFinished(), and stopRendering().
|
private |
Labeling results from the recently rendered map.
Definition at line 616 of file qgsmapcanvas.h.
Referenced by labelingResults(), rendererJobFinished(), and ~QgsMapCanvas().
|
private |
recently used extent
Definition at line 597 of file qgsmapcanvas.h.
Referenced by clearExtentHistory(), setExtent(), zoomToNextExtent(), and zoomToPreviousExtent().
|
private |
Definition at line 598 of file qgsmapcanvas.h.
Referenced by clearExtentHistory(), QgsMapCanvas(), setExtent(), zoomToNextExtent(), and zoomToPreviousExtent().
|
private |
previous tool if current is for zooming/panning
Definition at line 594 of file qgsmapcanvas.h.
Referenced by mouseReleaseEvent(), QgsMapCanvas(), setMapTool(), unsetMapTool(), and ~QgsMapCanvas().
|
private |
owns pixmap with rendered map and controls rendering
Definition at line 570 of file qgsmapcanvas.h.
Referenced by canvasPaintDevice(), map(), mapUpdateTimeout(), QgsMapCanvas(), rendererJobFinished(), and saveAsImage().
|
private |
map overview widget - it's controlled by QgsMapCanvas
Definition at line 573 of file qgsmapcanvas.h.
Referenced by enableAntiAliasing(), enableOverviewMode(), QgsMapCanvas(), setLayerSet(), and updateOverview().
|
private |
all map rendering is done in this class
Definition at line 567 of file qgsmapcanvas.h.
Referenced by getDatumTransformInfo(), mapRenderer(), QgsMapCanvas(), resizeEvent(), and ~QgsMapCanvas().
|
private |
pointer to current map tool
Definition at line 591 of file qgsmapcanvas.h.
Referenced by keyPressEvent(), keyReleaseEvent(), mapTool(), mapToolDestroyed(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), QgsMapCanvas(), setMapTool(), unsetMapTool(), wheelEvent(), and ~QgsMapCanvas().
|
private |
Timer that periodically fires while map rendering is in progress to update the visible map.
Definition at line 607 of file qgsmapcanvas.h.
Referenced by mapUpdateInterval(), QgsMapCanvas(), refreshMap(), rendererJobFinished(), and setMapUpdateInterval().
|
private |
Definition at line 629 of file qgsmapcanvas.h.
Referenced by previewMode(), previewModeEnabled(), QgsMapCanvas(), setPreviewMode(), and setPreviewModeEnabled().
|
private |
Flag that allows squashing multiple refresh() calls into just one delayed rendering job.
Definition at line 579 of file qgsmapcanvas.h.
Referenced by QgsMapCanvas(), refresh(), and refreshMap().
|
private |
determines whether user has requested to suppress rendering
Definition at line 582 of file qgsmapcanvas.h.
Referenced by QgsMapCanvas(), refresh(), and setRenderFlag().
|
private |
Definition at line 627 of file qgsmapcanvas.h.
Referenced by QgsMapCanvas(), and resizeEvent().
|
private |
graphics scene manages canvas items
Definition at line 588 of file qgsmapcanvas.h.
Referenced by canvasColor(), QgsMapCanvas(), resizeEvent(), setCanvasColor(), updateCanvasItemPositions(), and ~QgsMapCanvas().
|
private |
encompases all map settings necessary for map rendering
Definition at line 564 of file qgsmapcanvas.h.
Referenced by enableAntiAliasing(), getDatumTransformInfo(), mapSettings(), mapUpdateTimeout(), QgsMapCanvas(), readProject(), refresh(), refreshMap(), rendererJobFinished(), resizeEvent(), saveAsImage(), setCanvasColor(), setCrsTransformEnabled(), setDestinationCrs(), setExtent(), setLayerSet(), setMapUnits(), setSelectionColor(), updateDatumTransformEntries(), writeProject(), zoomToNextExtent(), and zoomToPreviousExtent().
|
private |
Whether layers are rendered sequentially or in parallel.
Definition at line 619 of file qgsmapcanvas.h.
Referenced by isParallelRenderingEnabled(), keyPressEvent(), refreshMap(), rendererJobFinished(), and setParallelRenderingEnabled().
|
private |
Mouse wheel action.
Definition at line 604 of file qgsmapcanvas.h.
Referenced by setWheelAction(), and wheelEvent().
|
private |
Scale factor multiple for default zoom in/out.
Definition at line 601 of file qgsmapcanvas.h.
Referenced by setWheelAction(), wheelEvent(), zoomIn(), zoomOut(), and zoomWithCenter().