QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
Map canvas is a class for displaying all GIS data types on a canvas. More...
#include <qgsmapcanvas.h>
Classes | |
class | CanvasProperties |
Deprecated to be deleted, stuff from here should be moved elsewhere. More... | |
Public Slots | |
void | layerStateChange () |
This slot is connected to the visibility change of one or more layers. More... | |
void | readProject (const QDomDocument &) |
called to read map canvas settings from project More... | |
void | redrawAllLayers () |
Clears all cached images and redraws all layers. More... | |
void | refresh () |
Repaints the canvas map. More... | |
void | refreshAllLayers () |
Reload all layers (including refreshing layer properties from their data sources), clears the cache and refreshes the canvas. More... | |
void | saveAsImage (const QString &fileName, QPixmap *QPixmap=nullptr, const QString &="PNG") |
Save the contents of the map canvas to disk as an image. More... | |
void | selectionChangedSlot () |
Receives signal about selection change, and pass it on with layer info. More... | |
void | setMagnificationFactor (double factor, const QgsPointXY *center=nullptr) |
Sets the factor of magnification to apply to the map canvas. More... | |
void | setRenderFlag (bool flag) |
Sets whether a user has disabled canvas renders via the GUI. More... | |
void | setScaleLocked (bool isLocked) |
Lock the scale, so zooming can be performed using magnication. More... | |
void | setZoomResolutions (const QList< double > &resolutions) |
Set a list of resolutions (map units per pixel) to which to "snap to" when zooming the map. More... | |
void | setZRange (const QgsDoubleRange &range) |
Sets the range of z-values which will be visible in the map. More... | |
void | stopRendering () |
stop rendering (if there is any right now) More... | |
void | writeProject (QDomDocument &) |
called to write map canvas settings to project More... | |
void | zoomIn () |
Zoom in with fixed factor. More... | |
double | zoomInFactor () const |
Returns the zoom in factor. More... | |
void | zoomOut () |
Zoom out with fixed factor. More... | |
double | zoomOutFactor () const |
Returns the zoom in factor. More... | |
const QList< double > & | zoomResolutions () const |
void | zoomToSelected (const QList< QgsMapLayer * > &layers) |
Zoom to the combined extent of the selected features of all provided (vector) layers. More... | |
void | zoomToSelected (QgsMapLayer *layer=nullptr) |
Zoom to the extent of the selected features of provided map layer. More... | |
QgsDoubleRange | zRange () const |
Returns the range of z-values which will be visible in the map. More... | |
Signals | |
void | canvasColorChanged () |
Emitted when canvas background color changes. More... | |
void | contextMenuAboutToShow (QMenu *menu, QgsMapMouseEvent *event) |
Emitted before the map canvas context menu will be shown. More... | |
void | currentLayerChanged (QgsMapLayer *layer) |
Emitted when the current layer is changed. More... | |
void | destinationCrsChanged () |
Emitted when map CRS has changed. More... | |
void | extentsChanged () |
Emitted when the extents of the map change. More... | |
void | keyPressed (QKeyEvent *e) |
Emit key press event. More... | |
void | keyReleased (QKeyEvent *e) |
Emit key release event. More... | |
void | layersChanged () |
Emitted when a new set of layers has been received. More... | |
void | layerStyleOverridesChanged () |
Emitted when the configuration of overridden layer styles changes. More... | |
void | magnificationChanged (double) |
Emitted when the scale of the map changes. More... | |
void | mapCanvasRefreshed () |
Emitted when canvas finished a refresh request. More... | |
void | mapRefreshCanceled () |
Emitted when the pending map refresh has been canceled. More... | |
void | mapToolSet (QgsMapTool *newTool, QgsMapTool *oldTool) |
Emit map tool changed with the old tool. More... | |
void | messageEmitted (const QString &title, const QString &message, Qgis::MessageLevel=Qgis::MessageLevel::Info) |
emit a message (usually to be displayed in a message bar) More... | |
void | panDistanceBearingChanged (double distance, QgsUnitTypes::DistanceUnit unit, double bearing) |
Emitted whenever the distance or bearing of an in-progress panning operation is changed. More... | |
void | renderComplete (QPainter *) |
Emitted when the canvas has rendered. More... | |
void | renderErrorOccurred (const QString &error, QgsMapLayer *layer) |
Emitted whenever an error is encountered during a map render operation. More... | |
void | renderStarting () |
Emitted when the canvas is about to be rendered. More... | |
void | rotationChanged (double) |
Emitted when the rotation of the map changes. More... | |
void | scaleChanged (double) |
Emitted when the scale of the map changes. More... | |
void | scaleLockChanged (bool locked) |
Emitted when the scale locked state of the map changes. More... | |
void | selectionChanged (QgsMapLayer *layer) |
Emitted when selection in any layer gets changed. More... | |
void | tapAndHoldGestureOccurred (const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture) |
Emitted whenever a tap and hold gesture occurs at the specified map point. More... | |
void | temporalRangeChanged () |
Emitted when the map canvas temporal range changes. More... | |
void | themeChanged (const QString &theme) |
Emitted when the canvas has been assigned a different map theme. More... | |
void | transformContextChanged () |
Emitted when the canvas transform context is changed. More... | |
void | xyCoordinates (const QgsPointXY &p) |
Emits current mouse position. More... | |
void | zoomLastStatusChanged (bool) |
Emitted when zoom last status changed. More... | |
void | zoomNextStatusChanged (bool) |
Emitted when zoom next status changed. More... | |
void | zRangeChanged () |
Emitted when the map canvas z (elevation) range changes. More... | |
Public Member Functions | |
QgsMapCanvas (QWidget *parent=nullptr) | |
Constructor. More... | |
~QgsMapCanvas () override | |
bool | allowInteraction (QgsMapCanvasInteractionBlocker::Interaction interaction) const |
Returns true if the specified interaction is currently permitted on the canvas. More... | |
QList< QgsMapCanvasAnnotationItem * > | annotationItems () const |
Returns a list of all annotation items in the canvas. More... | |
bool | annotationsVisible () const |
Returns true if annotations are visible within the map canvas. More... | |
bool | antiAliasingEnabled () const |
true if antialiasing is enabled More... | |
void | cancelJobs () |
Cancel any rendering job, in a blocking way. More... | |
QColor | canvasColor () const |
Read property of QColor bgColor. More... | |
QgsPointXY | center () const |
Gets map center, in geographical coordinates. More... | |
void | clearCache () |
Make sure to remove any rendered images from cache (does nothing if cache is not enabled) More... | |
void | clearExtentHistory () |
Clears the list of extents and sets current extent as first item. More... | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. More... | |
QgsMapLayer * | currentLayer () |
returns current layer (set by legend widget) More... | |
QgsExpressionContextScope * | defaultExpressionContextScope () const |
Creates a new scope which contains default variables and functions relating to the map canvas. More... | |
void | enableAntiAliasing (bool flag) |
used to determine if anti-aliasing is enabled or not More... | |
void | enableMapTileRendering (bool flag) |
sets map tile rendering flag More... | |
QgsExpressionContextScope & | expressionContextScope () |
Returns a reference to the expression context scope for the map canvas. More... | |
const QgsExpressionContextScope & | expressionContextScope () const |
Returns a const reference to the expression context scope for the map canvas. More... | |
QgsRectangle | extent () const |
Returns the current zoom extent of the map canvas. More... | |
void | flashFeatureIds (QgsVectorLayer *layer, const QgsFeatureIds &ids, const QColor &startColor=QColor(255, 0, 0, 255), const QColor &endColor=QColor(255, 0, 0, 0), int flashes=3, int duration=500) |
Causes a set of features with matching ids from a vector layer to flash within the canvas. More... | |
void | flashGeometries (const QList< QgsGeometry > &geometries, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), const QColor &startColor=QColor(255, 0, 0, 255), const QColor &endColor=QColor(255, 0, 0, 0), int flashes=3, int duration=500) |
Causes a set of geometries to flash within the canvas. More... | |
void | freeze (bool frozen=true) |
Freeze/thaw the map canvas. More... | |
QgsRectangle | fullExtent () const |
Returns the combined extent for all layers on the map canvas. More... | |
const QgsMapToPixel * | getCoordinateTransform () |
Gets the current coordinate transform. More... | |
void | installInteractionBlocker (QgsMapCanvasInteractionBlocker *blocker) |
Installs an interaction blocker onto the canvas, which may prevent certain map canvas interactions from occurring. More... | |
bool | isCachingEnabled () const |
Check whether images of rendered layers are curerently being cached. More... | |
bool | isDrawing () |
Find out whether rendering is in progress. More... | |
bool | isFrozen () const |
Returns true if canvas is frozen. More... | |
bool | isParallelRenderingEnabled () const |
Check whether the layers are rendered in parallel or sequentially. More... | |
const QgsLabelingEngineSettings & | labelingEngineSettings () const |
Returns global labeling engine settings from the internal map settings. More... | |
const QgsLabelingResults * | labelingResults (bool allowOutdatedResults=true) const |
Gets access to the labeling results (may be nullptr ). More... | |
QgsMapLayer * | layer (const QString &id) |
Returns the map layer with the matching ID, or nullptr if no layers could be found. More... | |
QgsMapLayer * | layer (int index) |
Returns the map layer at position index in the layer stack. More... | |
int | layerCount () const |
Returns number of layers on the map. More... | |
QList< QgsMapLayer * > | layers (bool expandGroupLayers=false) const |
Returns the list of layers shown within the map canvas. More... | |
QMap< QString, QString > | layerStyleOverrides () const |
Returns the stored overrides of styles for layers. More... | |
double | magnificationFactor () const |
Returns the magnification factor. More... | |
const QgsMapSettings & | mapSettings () const |
Gets access to properties used for map rendering. More... | |
QgsMapTool * | mapTool () |
Returns the currently active tool. More... | |
QgsUnitTypes::DistanceUnit | mapUnits () const |
Convenience function for returning the current canvas map units. More... | |
double | mapUnitsPerPixel () const |
Returns the mapUnitsPerPixel (map units per pixel) for the canvas. More... | |
int | mapUpdateInterval () const |
Find out how often map preview should be updated while it is being rendered (in milliseconds) More... | |
QPoint | mouseLastXY () |
returns last position of mouse cursor More... | |
void | panAction (QMouseEvent *event) |
Called when mouse is moving and pan is activated. More... | |
void | panActionEnd (QPoint releasePoint) |
Ends pan action and redraws the canvas. More... | |
void | panActionStart (QPoint releasePoint) |
Starts a pan action. More... | |
void | panToFeatureIds (QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter=true) |
Centers canvas extent to feature ids. More... | |
void | panToSelected (const QList< QgsMapLayer * > &layers) |
Pan to the combined extent of the selected features of all provided (vector) layers. More... | |
void | panToSelected (QgsMapLayer *layer=nullptr) |
Pan to the selected features of current ayer keeping same extent. More... | |
bool | previewJobsEnabled () const |
Returns true if canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) are enabled for the canvas. More... | |
QgsPreviewEffect::PreviewMode | previewMode () const |
Returns the current preview mode for the map canvas. More... | |
bool | previewModeEnabled () const |
Returns whether a preview mode is enabled for the map canvas. More... | |
QgsProject * | project () |
Returns the project linked to this canvas. More... | |
QgsRectangle | projectExtent () const |
Returns the associated project's full extent, in the canvas' CRS. More... | |
void | removeInteractionBlocker (QgsMapCanvasInteractionBlocker *blocker) |
Removes an interaction blocker from the canvas. More... | |
const QgsRenderedItemResults * | renderedItemResults (bool allowOutdatedResults=true) const |
Gets access to the rendered item results (may be nullptr ), which includes the results of rendering annotation items in the canvas map. More... | |
bool | renderFlag () const |
Returns true if canvas render is disabled as a result of user disabling renders via the GUI. More... | |
double | rotation () const |
Gets the current map canvas rotation in clockwise degrees. More... | |
double | scale () const |
Returns the last reported scale of the canvas. More... | |
bool | scaleLocked () const |
Returns whether the scale is locked, so zooming can be performed using magnication. More... | |
QColor | selectionColor () const |
Returns color for selected features. More... | |
void | setAnnotationsVisible (bool visible) |
Sets whether annotations are visible in the canvas. More... | |
void | setCachingEnabled (bool enabled) |
Set whether to cache images of rendered layers. More... | |
void | setCanvasColor (const QColor &_newVal) |
Write property of QColor bgColor. More... | |
void | setCenter (const QgsPointXY ¢er) |
Set the center of the map canvas, in geographical coordinates. More... | |
void | setCurrentLayer (QgsMapLayer *layer) |
void | setCustomDropHandlers (const QVector< QPointer< QgsCustomDropHandler > > &handlers) |
Sets a list of custom drop handlers to use when drop events occur on the canvas. More... | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &crs) |
Sets destination coordinate reference system. More... | |
void | setExpressionContextScope (const QgsExpressionContextScope &scope) |
Sets an expression context scope for the map canvas. More... | |
void | setExtent (const QgsRectangle &r, bool magnified=false) |
Sets the extent of the map canvas to the specified rectangle. More... | |
void | setLabelingEngineSettings (const QgsLabelingEngineSettings &settings) |
Sets global labeling engine settings in the internal map settings. More... | |
void | setLayers (const QList< QgsMapLayer * > &layers) |
Sets the list of layers that should be shown in the canvas. More... | |
void | setLayerStyleOverrides (const QMap< QString, QString > &overrides) |
Sets the stored overrides of styles for rendering layers. More... | |
void | setMapSettingsFlags (Qgis::MapSettingsFlags flags) |
Resets the flags for the canvas' map settings. More... | |
void | setMapTool (QgsMapTool *mapTool, bool clean=false) |
Sets the map tool currently being used on the canvas. More... | |
void | setMapUpdateInterval (int timeMilliseconds) |
Set how often map preview should be updated while it is being rendered (in milliseconds) More... | |
void | setParallelRenderingEnabled (bool enabled) |
Set whether the layers are rendered in parallel or sequentially. More... | |
void | setPreviewJobsEnabled (bool enabled) |
Sets whether canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) are enabled for the canvas. More... | |
void | setPreviewMode (QgsPreviewEffect::PreviewMode mode) |
Sets a preview mode for the map canvas. More... | |
void | setPreviewModeEnabled (bool previewEnabled) |
Enables a preview mode for the map canvas. More... | |
void | setProject (QgsProject *project) |
Sets the project linked to this canvas. More... | |
bool | setReferencedExtent (const QgsReferencedRectangle &extent) SIP_THROW(QgsCsException) |
Sets the canvas to the specified extent. More... | |
void | setRotation (double degrees) |
Set the rotation of the map canvas in clockwise degrees. More... | |
void | setSegmentationTolerance (double tolerance) |
Sets the segmentation tolerance applied when rendering curved geometries. More... | |
void | setSegmentationToleranceType (QgsAbstractGeometry::SegmentationToleranceType type) |
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation) More... | |
void | setSelectionColor (const QColor &color) |
Set color of selected vector features. More... | |
void | setSnappingUtils (QgsSnappingUtils *utils) |
Assign an instance of snapping utils to the map canvas. More... | |
void | setTemporalController (QgsTemporalController *controller) |
Sets the temporal controller for this canvas. More... | |
void | setTemporalRange (const QgsDateTimeRange &range) |
Set datetime range for the map canvas. More... | |
void | setTheme (const QString &theme) |
Sets a map theme to show in the canvas. More... | |
void | setWheelFactor (double factor) |
Sets wheel zoom factor (should be greater than 1) More... | |
QgsSnappingUtils * | snappingUtils () const |
Returns snapping utility class that is associated with map canvas. More... | |
const QgsTemporalController * | temporalController () const |
Gets access to the temporal controller that will be used to update the canvas temporal range. More... | |
const QgsDateTimeRange & | temporalRange () const |
Returns map canvas datetime range. More... | |
QString | theme () const |
Returns the map's theme shown in the canvas, if set. More... | |
void | unsetMapTool (QgsMapTool *mapTool) |
Unset the current map tool or last non zoom tool. More... | |
void | updateScale () |
Emits signal scaleChanged to update scale in main window. More... | |
void | waitWhileRendering () |
Blocks until the rendering job has finished. More... | |
void | zoomByFactor (double scaleFactor, const QgsPointXY *center=nullptr, bool ignoreScaleLock=false) |
Zoom with the factor supplied. More... | |
void | zoomScale (double scale, bool ignoreScaleLock=false) |
Zooms the canvas to a specific scale. More... | |
void | zoomToFeatureExtent (QgsRectangle &rect) |
Zooms to feature extent. More... | |
void | zoomToFeatureIds (QgsVectorLayer *layer, const QgsFeatureIds &ids) |
Set canvas extent to the bounding box of a set of features. More... | |
void | zoomToFullExtent () |
Zoom to the full extent of all layers currently visible in the canvas. More... | |
void | zoomToNextExtent () |
Zoom to the next extent (view) More... | |
void | zoomToPreviousExtent () |
Zoom to the previous extent (view) More... | |
void | zoomToProjectExtent () |
Zoom to the full extent the project associated with this canvas. More... | |
void | zoomWithCenter (int x, int y, bool zoomIn) |
Zooms in/out with a given center. More... | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
virtual QgsExpressionContext | createExpressionContext () const =0 |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. More... | |
Protected Slots | |
void | updateCanvasItemPositions () |
called on resize or changed extent to notify canvas items to change their rectangle More... | |
Protected Member Functions | |
void | dragEnterEvent (QDragEnterEvent *e) override |
void | dropEvent (QDropEvent *event) override |
bool | event (QEvent *e) override |
void | keyPressEvent (QKeyEvent *e) override |
void | keyReleaseEvent (QKeyEvent *e) override |
void | mouseDoubleClickEvent (QMouseEvent *e) override |
void | mouseMoveEvent (QMouseEvent *e) override |
void | mousePressEvent (QMouseEvent *e) override |
void | mouseReleaseEvent (QMouseEvent *e) override |
void | moveCanvasContents (bool reset=false) |
called when panning is in action, reset indicates end of panning More... | |
void | paintEvent (QPaintEvent *e) override |
void | resizeEvent (QResizeEvent *e) override |
void | showEvent (QShowEvent *event) override |
bool | viewportEvent (QEvent *event) override |
void | wheelEvent (QWheelEvent *e) override |
Protected Attributes | |
std::unique_ptr< CanvasProperties > | mCanvasProperties |
Handle pattern for implementation object. More... | |
Properties | |
bool | previewJobsEnabled |
QString | theme |
Friends | |
class | TestQgsMapCanvas |
Map canvas is a class for displaying all GIS data types on a canvas.
Definition at line 89 of file qgsmapcanvas.h.
QgsMapCanvas::QgsMapCanvas | ( | QWidget * | parent = nullptr | ) |
Constructor.
Definition at line 125 of file qgsmapcanvas.cpp.
|
override |
Definition at line 251 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::allowInteraction | ( | QgsMapCanvasInteractionBlocker::Interaction | interaction | ) | const |
Returns true
if the specified interaction is currently permitted on the canvas.
Definition at line 1282 of file qgsmapcanvas.cpp.
QList< QgsMapCanvasAnnotationItem * > QgsMapCanvas::annotationItems | ( | ) | const |
Returns a list of all annotation items in the canvas.
Definition at line 3386 of file qgsmapcanvas.cpp.
|
inline |
Returns true
if annotations are visible within the map canvas.
Definition at line 772 of file qgsmapcanvas.h.
bool QgsMapCanvas::antiAliasingEnabled | ( | ) | const |
true
if antialiasing is enabled
Definition at line 334 of file qgsmapcanvas.cpp.
void QgsMapCanvas::cancelJobs | ( | ) |
Cancel any rendering job, in a blocking way.
Used for application closing.
Definition at line 285 of file qgsmapcanvas.cpp.
QColor QgsMapCanvas::canvasColor | ( | ) | const |
Read property of QColor bgColor.
Definition at line 2770 of file qgsmapcanvas.cpp.
|
signal |
Emitted when canvas background color changes.
QgsPointXY QgsMapCanvas::center | ( | ) | const |
Gets map center, in geographical coordinates.
Definition at line 1513 of file qgsmapcanvas.cpp.
void QgsMapCanvas::clearCache | ( | ) |
Make sure to remove any rendered images from cache (does nothing if cache is not enabled)
Definition at line 633 of file qgsmapcanvas.cpp.
void QgsMapCanvas::clearExtentHistory | ( | ) |
Clears the list of extents and sets current extent as first item.
Definition at line 1605 of file qgsmapcanvas.cpp.
|
signal |
Emitted before the map canvas context menu will be shown.
Can be used to extend the context menu.
|
overridevirtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
Implements QgsExpressionContextGenerator.
Definition at line 677 of file qgsmapcanvas.cpp.
QgsMapLayer * QgsMapCanvas::currentLayer | ( | ) |
returns current layer (set by legend widget)
Definition at line 665 of file qgsmapcanvas.cpp.
|
signal |
Emitted when the current layer is changed.
QgsExpressionContextScope * QgsMapCanvas::defaultExpressionContextScope | ( | ) | const |
Creates a new scope which contains default variables and functions relating to the map canvas.
Definition at line 670 of file qgsmapcanvas.cpp.
|
signal |
Emitted when map CRS has changed.
|
overrideprotected |
Definition at line 3271 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 3040 of file qgsmapcanvas.cpp.
void QgsMapCanvas::enableAntiAliasing | ( | bool | flag | ) |
used to determine if anti-aliasing is enabled or not
Definition at line 328 of file qgsmapcanvas.cpp.
void QgsMapCanvas::enableMapTileRendering | ( | bool | flag | ) |
sets map tile rendering flag
Definition at line 339 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 3324 of file qgsmapcanvas.cpp.
|
inline |
Returns a reference to the expression context scope for the map canvas.
This scope is injected into the expression context used for rendering the map, and can be used to apply specific variable overrides for expression evaluation for the map canvas render.
Definition at line 728 of file qgsmapcanvas.h.
|
inline |
Returns a const reference to the expression context scope for the map canvas.
Definition at line 737 of file qgsmapcanvas.h.
QgsRectangle QgsMapCanvas::extent | ( | ) | const |
Returns the current zoom extent of the map canvas.
Definition at line 1383 of file qgsmapcanvas.cpp.
|
signal |
Emitted when the extents of the map change.
void QgsMapCanvas::flashFeatureIds | ( | QgsVectorLayer * | layer, |
const QgsFeatureIds & | ids, | ||
const QColor & | startColor = QColor( 255, 0, 0, 255 ) , |
||
const QColor & | endColor = QColor( 255, 0, 0, 0 ) , |
||
int | flashes = 3 , |
||
int | duration = 500 |
||
) |
Causes a set of features with matching ids from a vector layer to flash within the canvas.
The startColor and endColor can be specified, along with the number of flashes and duration of each flash (in milliseconds).
Definition at line 2064 of file qgsmapcanvas.cpp.
void QgsMapCanvas::flashGeometries | ( | const QList< QgsGeometry > & | geometries, |
const QgsCoordinateReferenceSystem & | crs = QgsCoordinateReferenceSystem() , |
||
const QColor & | startColor = QColor( 255, 0, 0, 255 ) , |
||
const QColor & | endColor = QColor( 255, 0, 0, 0 ) , |
||
int | flashes = 3 , |
||
int | duration = 500 |
||
) |
Causes a set of geometries to flash within the canvas.
If crs is a valid coordinate reference system, the geometries will be automatically transformed from this CRS to the canvas CRS.
The startColor and endColor can be specified, along with the number of flashes and duration of each flash (in milliseconds).
Definition at line 2087 of file qgsmapcanvas.cpp.
void QgsMapCanvas::freeze | ( | bool | frozen = true | ) |
Freeze/thaw the map canvas.
This is used to prevent the canvas from responding to events while layers are being added/removed etc.
frozen | Boolean specifying if the canvas should be frozen (true ) or thawed (false ). Default is true . |
Definition at line 2825 of file qgsmapcanvas.cpp.
QgsRectangle QgsMapCanvas::fullExtent | ( | ) | const |
Returns the combined extent for all layers on the map canvas.
This method returns the combined extent for all layers which are currently visible in the map canvas. The returned extent will be in the same CRS as the map canvas.
Definition at line 1388 of file qgsmapcanvas.cpp.
const QgsMapToPixel * QgsMapCanvas::getCoordinateTransform | ( | ) |
Gets the current coordinate transform.
Definition at line 389 of file qgsmapcanvas.cpp.
void QgsMapCanvas::installInteractionBlocker | ( | QgsMapCanvasInteractionBlocker * | blocker | ) |
Installs an interaction blocker onto the canvas, which may prevent certain map canvas interactions from occurring.
The caller retains ownership of blocker, and must correctly call removeInteractionBlocker() before deleting the object.
Definition at line 1272 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::isCachingEnabled | ( | ) | const |
Check whether images of rendered layers are curerently being cached.
Definition at line 628 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::isDrawing | ( | ) |
Find out whether rendering is in progress.
Definition at line 382 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::isFrozen | ( | ) | const |
Returns true
if canvas is frozen.
Definition at line 2830 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::isParallelRenderingEnabled | ( | ) | const |
Check whether the layers are rendered in parallel or sequentially.
Definition at line 649 of file qgsmapcanvas.cpp.
|
signal |
Emit key press event.
|
overrideprotected |
Definition at line 2166 of file qgsmapcanvas.cpp.
|
signal |
Emit key release event.
|
overrideprotected |
Definition at line 2266 of file qgsmapcanvas.cpp.
const QgsLabelingEngineSettings & QgsMapCanvas::labelingEngineSettings | ( | ) | const |
Returns global labeling engine settings from the internal map settings.
Definition at line 3417 of file qgsmapcanvas.cpp.
const QgsLabelingResults * QgsMapCanvas::labelingResults | ( | bool | allowOutdatedResults = true | ) | const |
Gets access to the labeling results (may be nullptr
).
Since QGIS 3.20, if the allowOutdatedResults flag is false
then outdated labeling results (e.g. as a result of an ongoing canvas render) will not be returned, and instead nullptr
will be returned.
Definition at line 589 of file qgsmapcanvas.cpp.
QgsMapLayer * QgsMapCanvas::layer | ( | const QString & | id | ) |
Returns the map layer with the matching ID, or nullptr
if no layers could be found.
This method searches both layers associated with the map canvas (see layers()) and layers from the QgsProject associated with the canvas (which is current the QgsProject::instance()). It can be used to resolve layer IDs to layers which may be visible in the canvas, but not associated with a QgsProject.
Definition at line 353 of file qgsmapcanvas.cpp.
QgsMapLayer * QgsMapCanvas::layer | ( | int | index | ) |
Returns the map layer at position index in the layer stack.
Definition at line 344 of file qgsmapcanvas.cpp.
int QgsMapCanvas::layerCount | ( | ) | const |
Returns number of layers on the map.
Definition at line 2809 of file qgsmapcanvas.cpp.
QList< QgsMapLayer * > QgsMapCanvas::layers | ( | bool | expandGroupLayers = false | ) | const |
Returns the list of layers shown within the map canvas.
Since QGIS 3.24, if the expandGroupLayers option is true
then group layers will be converted to all their child layers.
Definition at line 2814 of file qgsmapcanvas.cpp.
|
signal |
Emitted when a new set of layers has been received.
|
slot |
This slot is connected to the visibility change of one or more layers.
Definition at line 2819 of file qgsmapcanvas.cpp.
QMap< QString, QString > QgsMapCanvas::layerStyleOverrides | ( | ) | const |
Returns the stored overrides of styles for layers.
Definition at line 2845 of file qgsmapcanvas.cpp.
|
signal |
Emitted when the configuration of overridden layer styles changes.
|
signal |
Emitted when the scale of the map changes.
double QgsMapCanvas::magnificationFactor | ( | ) | const |
|
signal |
Emitted when canvas finished a refresh request.
|
signal |
Emitted when the pending map refresh has been canceled.
const QgsMapSettings & QgsMapCanvas::mapSettings | ( | ) | const |
Gets access to properties used for map rendering.
Definition at line 488 of file qgsmapcanvas.cpp.
QgsMapTool * QgsMapCanvas::mapTool | ( | ) |
Returns the currently active tool.
Definition at line 2976 of file qgsmapcanvas.cpp.
|
signal |
Emit map tool changed with the old tool.
QgsUnitTypes::DistanceUnit QgsMapCanvas::mapUnits | ( | ) | const |
Convenience function for returning the current canvas map units.
The map units are dictated by the canvas' destinationCrs() map units.
Definition at line 2840 of file qgsmapcanvas.cpp.
double QgsMapCanvas::mapUnitsPerPixel | ( | ) | const |
Returns the mapUnitsPerPixel (map units per pixel) for the canvas.
Definition at line 2835 of file qgsmapcanvas.cpp.
int QgsMapCanvas::mapUpdateInterval | ( | ) | const |
Find out how often map preview should be updated while it is being rendered (in milliseconds)
Definition at line 659 of file qgsmapcanvas.cpp.
|
signal |
emit a message (usually to be displayed in a message bar)
|
overrideprotected |
Definition at line 2298 of file qgsmapcanvas.cpp.
QPoint QgsMapCanvas::mouseLastXY | ( | ) |
returns last position of mouse cursor
Definition at line 3080 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 2650 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 2381 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 2434 of file qgsmapcanvas.cpp.
|
protected |
called when panning is in action, reset indicates end of panning
Definition at line 3031 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 2530 of file qgsmapcanvas.cpp.
void QgsMapCanvas::panAction | ( | QMouseEvent * | event | ) |
Called when mouse is moving and pan is activated.
Definition at line 3014 of file qgsmapcanvas.cpp.
void QgsMapCanvas::panActionEnd | ( | QPoint | releasePoint | ) |
Ends pan action and redraws the canvas.
Definition at line 2986 of file qgsmapcanvas.cpp.
void QgsMapCanvas::panActionStart | ( | QPoint | releasePoint | ) |
Starts a pan action.
Definition at line 3005 of file qgsmapcanvas.cpp.
|
signal |
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
This signal will be emitted during a pan operation as the user moves the map, giving the total distance and bearing between the map position at the start of the pan and the current pan position.
void QgsMapCanvas::panToFeatureIds | ( | QgsVectorLayer * | layer, |
const QgsFeatureIds & | ids, | ||
bool | alwaysRecenter = true |
||
) |
Centers canvas extent to feature ids.
layer | the vector layer |
ids | the feature ids |
alwaysRecenter | if false , the canvas is recentered only if the bounding box is not contained within the current extent |
Definition at line 1874 of file qgsmapcanvas.cpp.
void QgsMapCanvas::panToSelected | ( | const QList< QgsMapLayer * > & | layers | ) |
Pan to the combined extent of the selected features of all provided (vector) layers.
layers | A list of layers |
Definition at line 1991 of file qgsmapcanvas.cpp.
void QgsMapCanvas::panToSelected | ( | QgsMapLayer * | layer = nullptr | ) |
Pan to the selected features of current ayer keeping same extent.
Definition at line 1932 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::previewJobsEnabled | ( | ) | const |
Returns true
if canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) are enabled for the canvas.
Definition at line 977 of file qgsmapcanvas.cpp.
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 3115 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::previewModeEnabled | ( | ) | const |
Returns whether a preview mode is enabled for the map canvas.
true
if a preview mode is currently enabled Definition at line 3095 of file qgsmapcanvas.cpp.
QgsProject * QgsMapCanvas::project | ( | ) |
Returns the project linked to this canvas.
The returned value may be nullptr
.
Definition at line 2981 of file qgsmapcanvas.cpp.
QgsRectangle QgsMapCanvas::projectExtent | ( | ) | const |
Returns the associated project's full extent, in the canvas' CRS.
This method returns the full extent for the project associated with this canvas. Unlike fullExtent(), this method does NOT consider which layers are actually visible in the map canvas.
Definition at line 1393 of file qgsmapcanvas.cpp.
|
slot |
called to read map canvas settings from project
Definition at line 3141 of file qgsmapcanvas.cpp.
|
slot |
Clears all cached images and redraws all layers.
Definition at line 3359 of file qgsmapcanvas.cpp.
|
slot |
Repaints the canvas map.
Definition at line 694 of file qgsmapcanvas.cpp.
|
slot |
Reload all layers (including refreshing layer properties from their data sources), clears the cache and refreshes the canvas.
Definition at line 3347 of file qgsmapcanvas.cpp.
void QgsMapCanvas::removeInteractionBlocker | ( | QgsMapCanvasInteractionBlocker * | blocker | ) |
Removes an interaction blocker from the canvas.
Definition at line 1277 of file qgsmapcanvas.cpp.
|
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.
const QgsRenderedItemResults * QgsMapCanvas::renderedItemResults | ( | bool | allowOutdatedResults = true | ) | const |
Gets access to the rendered item results (may be nullptr
), which includes the results of rendering annotation items in the canvas map.
If the allowOutdatedResults flag is false
then outdated rendered item results (e.g. as a result of an ongoing canvas render) will not be returned, and instead nullptr
will be returned.
Definition at line 597 of file qgsmapcanvas.cpp.
|
signal |
Emitted whenever an error is encountered during a map render operation.
The layer argument indicates the associated map layer, if available.
|
inline |
Returns true
if canvas render is disabled as a result of user disabling renders via the GUI.
Definition at line 519 of file qgsmapcanvas.h.
|
signal |
Emitted when the canvas is about to be rendered.
|
overrideprotected |
Definition at line 2501 of file qgsmapcanvas.cpp.
double QgsMapCanvas::rotation | ( | ) | const |
Gets the current map canvas rotation in clockwise degrees.
Definition at line 1524 of file qgsmapcanvas.cpp.
|
signal |
Emitted when the rotation of the map changes.
|
slot |
Save the contents of the map canvas to disk as an image.
Definition at line 1317 of file qgsmapcanvas.cpp.
double QgsMapCanvas::scale | ( | ) | const |
Returns the last reported scale of the canvas.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
Definition at line 377 of file qgsmapcanvas.cpp.
|
signal |
Emitted when the scale of the map changes.
|
signal |
Emitted when the scale locked state of the map changes.
locked | true if the scale is locked |
|
inline |
Returns whether the scale is locked, so zooming can be performed using magnication.
Definition at line 618 of file qgsmapcanvas.h.
|
signal |
Emitted when selection in any layer gets changed.
|
slot |
Receives signal about selection change, and pass it on with layer info.
Definition at line 3260 of file qgsmapcanvas.cpp.
QColor QgsMapCanvas::selectionColor | ( | ) | const |
Returns color for selected features.
Definition at line 2804 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setAnnotationsVisible | ( | bool | visible | ) |
Sets whether annotations are visible in the canvas.
Definition at line 3402 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setCachingEnabled | ( | bool | enabled | ) |
Set whether to cache images of rendered layers.
Definition at line 605 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setCanvasColor | ( | const QColor & | _newVal | ) |
Write property of QColor bgColor.
Definition at line 2745 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setCenter | ( | const QgsPointXY & | center | ) |
Set the center of the map canvas, in geographical coordinates.
Definition at line 1498 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setCurrentLayer | ( | QgsMapLayer * | layer | ) |
Definition at line 368 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setCustomDropHandlers | ( | const QVector< QPointer< QgsCustomDropHandler > > & | handlers | ) |
Sets a list of custom drop handlers to use when drop events occur on the canvas.
Definition at line 987 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
Sets destination coordinate reference system.
Definition at line 493 of file qgsmapcanvas.cpp.
|
inline |
Sets an expression context scope for the map canvas.
This scope is injected into the expression context used for rendering the map, and can be used to apply specific variable overrides for expression evaluation for the map canvas render. This method will overwrite the existing expression context scope for the canvas.
scope | new expression context scope |
Definition at line 718 of file qgsmapcanvas.h.
void QgsMapCanvas::setExtent | ( | const QgsRectangle & | r, |
bool | magnified = false |
||
) |
Sets the extent of the map canvas to the specified rectangle.
The magnified argument dictates whether existing canvas constraints such as a scale lock should be respected or not during the operation. If magnified is true
then an existing scale lock constraint will be applied. This means that the final visible canvas extent may not match the specified extent.
If magnified is false
then scale lock settings will be ignored, and the specified rectangle will ALWAYS be visible in the canvas.
Definition at line 1411 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setLabelingEngineSettings | ( | const QgsLabelingEngineSettings & | settings | ) |
Sets global labeling engine settings in the internal map settings.
Definition at line 3412 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setLayers | ( | const QList< QgsMapLayer * > & | layers | ) |
Sets the list of layers that should be shown in the canvas.
If the map canvas has been associated with a map theme via a call to setTheme(), then any calls to setLayers() are ignored. It is necessary to first clear the theme association by calling setTheme() with an empty string before setLayers() calls can be made.
Definition at line 394 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setLayerStyleOverrides | ( | const QMap< QString, QString > & | overrides | ) |
Sets the stored overrides of styles for rendering layers.
If the map canvas has been associated with a map theme via a call to setTheme(), then any calls to setLayerStyleOverrides() are ignored. It is necessary to first clear the theme association by calling setTheme() with an empty string before setLayerStyleOverrides() calls can be made.
Definition at line 2850 of file qgsmapcanvas.cpp.
|
slot |
Sets the factor of magnification to apply to the map canvas.
Indeed, we increase/decrease the DPI of the map settings according to this factor in order to render marker point, labels, ... bigger.
factor | The factor of magnification |
center | Optional point to re-center the map |
Definition at line 307 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setMapSettingsFlags | ( | Qgis::MapSettingsFlags | flags | ) |
Resets the flags for the canvas' map settings.
Definition at line 582 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setMapTool | ( | QgsMapTool * | mapTool, |
bool | clean = false |
||
) |
Sets the map tool currently being used on the canvas.
Definition at line 2682 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setMapUpdateInterval | ( | int | timeMilliseconds | ) |
Set how often map preview should be updated while it is being rendered (in milliseconds)
Definition at line 654 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setParallelRenderingEnabled | ( | bool | enabled | ) |
Set whether the layers are rendered in parallel or sequentially.
Definition at line 644 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setPreviewJobsEnabled | ( | bool | enabled | ) |
Sets whether canvas map preview jobs (low priority render jobs which render portions of the view just outside of the canvas extent, to allow preview of these out-of-canvas areas when panning or zooming out the map) are enabled for the canvas.
Definition at line 982 of file qgsmapcanvas.cpp.
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 3105 of file qgsmapcanvas.cpp.
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 3085 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setProject | ( | QgsProject * | project | ) |
Sets the project linked to this canvas.
Definition at line 2740 of file qgsmapcanvas.cpp.
bool QgsMapCanvas::setReferencedExtent | ( | const QgsReferencedRectangle & | extent | ) |
Sets the canvas to the specified extent.
true
if the zoom was successful.QgsCsException | if a transformation error occurred. |
Definition at line 1479 of file qgsmapcanvas.cpp.
|
slot |
Sets whether a user has disabled canvas renders via the GUI.
flag | set to false to indicate that user has disabled renders |
Definition at line 2881 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setRotation | ( | double | degrees | ) |
Set the rotation of the map canvas in clockwise degrees.
Definition at line 1529 of file qgsmapcanvas.cpp.
|
slot |
Lock the scale, so zooming can be performed using magnication.
Definition at line 2641 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setSegmentationTolerance | ( | double | tolerance | ) |
Sets the segmentation tolerance applied when rendering curved geometries.
tolerance | the segmentation tolerance |
Definition at line 3376 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setSegmentationToleranceType | ( | QgsAbstractGeometry::SegmentationToleranceType | type | ) |
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
type | the segmentation tolerance typename |
Definition at line 3381 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setSelectionColor | ( | const QColor & | color | ) |
Set color of selected vector features.
Definition at line 2775 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setSnappingUtils | ( | QgsSnappingUtils * | utils | ) |
Assign an instance of snapping utils to the map canvas.
The instance is not owned by the canvas, so it is possible to use one instance in multiple canvases.
For main canvas in QGIS, do not associate a different instance from the existing one (it is updated from the project's snapping configuration).
Definition at line 3136 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setTemporalController | ( | QgsTemporalController * | controller | ) |
Sets the temporal controller for this canvas.
The controller will be used to update the canvas' temporal range.
Definition at line 535 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setTemporalRange | ( | const QgsDateTimeRange & | range | ) |
Set datetime range for the map canvas.
The temporalRangeChanged() signal will be emitted if the temporal range has been changed.
Definition at line 1249 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setTheme | ( | const QString & | theme | ) |
Sets a map theme to show in the canvas.
The theme name must match a theme present in the associated project's QgsMapThemeCollection.
When the canvas is associated to a map theme, it will automatically follow the layer selection and layer styles from that theme. Calls to setLayers() or setLayerStyleOverrides() will have no effect, and canvases associated with a QgsLayerTreeMapCanvasBridge will no longer synchronize their state with the layer tree. In these cases it is necessary to call setTheme() with an empty string to clear the theme association and allow map updates with setLayers(), setLayerStyleOverrides(), or via QgsLayerTreeMapCanvasBridge.
If an empty string is passed then the current theme association will be cleared.
Definition at line 2860 of file qgsmapcanvas.cpp.
void QgsMapCanvas::setWheelFactor | ( | double | factor | ) |
Sets wheel zoom factor (should be greater than 1)
Definition at line 2598 of file qgsmapcanvas.cpp.
|
inlineslot |
Set a list of resolutions (map units per pixel) to which to "snap to" when zooming the map.
resolutions | A list of resolutions |
Definition at line 966 of file qgsmapcanvas.h.
|
slot |
Sets the range of z-values which will be visible in the map.
Definition at line 1809 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 3074 of file qgsmapcanvas.cpp.
QgsSnappingUtils * QgsMapCanvas::snappingUtils | ( | ) | const |
Returns snapping utility class that is associated with map canvas.
If no snapping utils instance has been associated previously, an internal will be created for convenience (so map tools do not need to test for existence of the instance).
Main canvas in QGIS returns an instance which is always up-to-date with the project's snapping configuration.
Definition at line 3125 of file qgsmapcanvas.cpp.
|
slot |
stop rendering (if there is any right now)
Definition at line 1301 of file qgsmapcanvas.cpp.
|
signal |
Emitted whenever a tap and hold gesture occurs at the specified map point.
const QgsTemporalController * QgsMapCanvas::temporalController | ( | ) | const |
Gets access to the temporal controller that will be used to update the canvas temporal range.
Definition at line 577 of file qgsmapcanvas.cpp.
const QgsDateTimeRange & QgsMapCanvas::temporalRange | ( | ) | const |
Returns map canvas datetime range.
Definition at line 1267 of file qgsmapcanvas.cpp.
|
signal |
Emitted when the map canvas temporal range changes.
|
inline |
Returns the map's theme shown in the canvas, if set.
Definition at line 572 of file qgsmapcanvas.h.
|
signal |
|
signal |
Emitted when the canvas transform context is changed.
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 manually, QgsMapTool takes care of it.
Definition at line 2722 of file qgsmapcanvas.cpp.
|
protectedslot |
called on resize or changed extent to notify canvas items to change their rectangle
Definition at line 2537 of file qgsmapcanvas.cpp.
void QgsMapCanvas::updateScale | ( | ) |
Emits signal scaleChanged to update scale in main window.
Definition at line 1542 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 3309 of file qgsmapcanvas.cpp.
void QgsMapCanvas::waitWhileRendering | ( | ) |
Blocks until the rendering job has finished.
In almost all cases you do NOT want to call this, as it will hang the UI until the rendering job is complete. It's included in API solely for unit testing and standalone Python scripts.
Definition at line 3368 of file qgsmapcanvas.cpp.
|
overrideprotected |
Definition at line 2555 of file qgsmapcanvas.cpp.
|
slot |
called to write map canvas settings to project
Definition at line 3209 of file qgsmapcanvas.cpp.
|
signal |
Emits current mouse position.
void QgsMapCanvas::zoomByFactor | ( | double | scaleFactor, |
const QgsPointXY * | center = nullptr , |
||
bool | ignoreScaleLock = false |
||
) |
Zoom with the factor supplied.
Factor > 1 zooms out, interval (0,1) zooms in If point is given, re-center on it.
If ignoreScaleLock is set to true
, then any existing constraint on the map scale of the canvas will be ignored during the zoom operation.
Definition at line 3244 of file qgsmapcanvas.cpp.
|
slot |
Zoom in with fixed factor.
Definition at line 2603 of file qgsmapcanvas.cpp.
|
slot |
Returns the zoom in factor.
Definition at line 3548 of file qgsmapcanvas.cpp.
|
signal |
Emitted when zoom last status changed.
|
signal |
Emitted when zoom next status changed.
|
slot |
Zoom out with fixed factor.
Definition at line 2609 of file qgsmapcanvas.cpp.
|
slot |
Returns the zoom in factor.
Definition at line 3561 of file qgsmapcanvas.cpp.
|
inlineslot |
Definition at line 983 of file qgsmapcanvas.h.
void QgsMapCanvas::zoomScale | ( | double | scale, |
bool | ignoreScaleLock = false |
||
) |
Zooms the canvas to a specific scale.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
If ignoreScaleLock is set to true
, then any existing constraint on the map scale of the canvas will be ignored during the zoom operation.
Definition at line 2615 of file qgsmapcanvas.cpp.
void QgsMapCanvas::zoomToFeatureExtent | ( | QgsRectangle & | rect | ) |
Zooms to feature extent.
Adds a small margin around the extent and does a pan if rect is empty (point extent)
Definition at line 1826 of file qgsmapcanvas.cpp.
void QgsMapCanvas::zoomToFeatureIds | ( | QgsVectorLayer * | layer, |
const QgsFeatureIds & | ids | ||
) |
Set canvas extent to the bounding box of a set of features.
layer | the vector layer |
ids | the feature ids |
Definition at line 1850 of file qgsmapcanvas.cpp.
void QgsMapCanvas::zoomToFullExtent | ( | ) |
Zoom to the full extent of all layers currently visible in the canvas.
Definition at line 1547 of file qgsmapcanvas.cpp.
void QgsMapCanvas::zoomToNextExtent | ( | ) |
Zoom to the next extent (view)
Definition at line 1590 of file qgsmapcanvas.cpp.
void QgsMapCanvas::zoomToPreviousExtent | ( | ) |
Zoom to the previous extent (view)
Definition at line 1574 of file qgsmapcanvas.cpp.
void QgsMapCanvas::zoomToProjectExtent | ( | ) |
Zoom to the full extent the project associated with this canvas.
This method zooms to the full extent for the project associated with this canvas. Unlike zoomToFullExtent(), this method does NOT consider which layers are actually visible in the map canvas.
Definition at line 1560 of file qgsmapcanvas.cpp.
|
slot |
Zoom to the combined extent of the selected features of all provided (vector) layers.
layers | A list of layers |
Definition at line 1729 of file qgsmapcanvas.cpp.
|
slot |
Zoom to the extent of the selected features of provided map layer.
layer | optionally specify different than current layer |
Definition at line 1649 of file qgsmapcanvas.cpp.
void QgsMapCanvas::zoomWithCenter | ( | int | x, |
int | y, | ||
bool | zoomIn | ||
) |
Zooms in/out with a given center.
Definition at line 2620 of file qgsmapcanvas.cpp.
|
slot |
Returns the range of z-values which will be visible in the map.
Definition at line 1804 of file qgsmapcanvas.cpp.
|
signal |
Emitted when the map canvas z (elevation) range changes.
|
friend |
Definition at line 1525 of file qgsmapcanvas.h.
|
protected |
Handle pattern for implementation object.
Definition at line 1234 of file qgsmapcanvas.h.
|
readwrite |
Definition at line 89 of file qgsmapcanvas.h.
|
readwrite |
Definition at line 89 of file qgsmapcanvas.h.