QGIS API Documentation  3.21.0-Master (2d5a580dfc)
qgsmapcanvas.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmapcanvas.h - description
3  -------------------
4  begin : Sun Jun 30 2002
5  copyright : (C) 2002 by Gary E.Sherman
6  email : sherman at mrcc.com
7 ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSMAPCANVAS_H
19 #define QGSMAPCANVAS_H
20 
21 #include "qgsconfig.h"
22 #include "qgis_sip.h"
23 
24 #include "qgsexpressioncontext.h"
25 #include "qgsrectangle.h"
26 #include "qgsfeatureid.h"
27 #include "qgsgeometry.h"
28 #include "qgscustomdrophandler.h"
29 #include "qgstemporalrangeobject.h"
31 #include "qgsproject.h"
32 
33 #include <QDomDocument>
34 #include <QGraphicsView>
35 
36 #include "qgsmapsettings.h" // TEMPORARY
37 #include "qgsprevieweffect.h" //for QgsPreviewEffect::PreviewMode
38 
39 #include <QTimer>
40 #include <QGestureEvent>
41 #include "qgis_gui.h"
42 
43 class QWheelEvent;
44 class QPixmap;
45 class QPaintEvent;
46 class QKeyEvent;
47 class ResizeEvent;
48 
49 class QColor;
50 class QDomDocument;
51 class QPaintDevice;
52 class QMouseEvent;
53 class QRubberBand;
54 class QGraphicsScene;
55 
56 class QgsMapToPixel;
57 class QgsMapLayer;
58 class QgsHighlight;
59 class QgsVectorLayer;
60 
61 class QgsLabelingResults;
62 
65 class QgsMapSettings;
66 class QgsMapCanvasMap;
68 class QgsMapTool;
69 class QgsSnappingUtils;
70 class QgsRubberBand;
73 
75 
76 class QMenu;
77 class QgsMapMouseEvent;
78 
79 
85 class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContextGenerator
86 {
87 
88 #ifdef SIP_RUN
90  if ( qobject_cast<QgsMapCanvas *>( sipCpp ) != nullptr )
91  sipType = sipType_QgsMapCanvas;
92  else
93  sipType = nullptr;
94  SIP_END
95 #endif
96 
97  Q_OBJECT
98  Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )
99  Q_PROPERTY( bool previewJobsEnabled READ previewJobsEnabled WRITE setPreviewJobsEnabled )
100 
101  public:
102 
104  QgsMapCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr );
105 
106  ~QgsMapCanvas() override;
107 
112  double magnificationFactor() const;
113 
125  void setLayers( const QList<QgsMapLayer *> &layers );
126 
127  void setCurrentLayer( QgsMapLayer *layer );
128 
133  const QgsMapSettings &mapSettings() const SIP_KEEPREFERENCE;
134 
141  void setTemporalController( QgsTemporalController *controller );
142 
149  const QgsTemporalController *temporalController() const;
150 
155  void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
156 
161  void setMapSettingsFlags( QgsMapSettings::Flags flags );
162 
171  const QgsLabelingResults *labelingResults( bool allowOutdatedResults = true ) const;
172 
177  void setCachingEnabled( bool enabled );
178 
183  bool isCachingEnabled() const;
184 
189  void clearCache();
190 
200  void waitWhileRendering();
201 
206  void setParallelRenderingEnabled( bool enabled );
207 
212  bool isParallelRenderingEnabled() const;
213 
218  void setMapUpdateInterval( int timeMilliseconds );
219 
224  int mapUpdateInterval() const;
225 
230  double scale() const;
231 
233  double mapUnitsPerPixel() const;
234 
236  QgsRectangle extent() const;
237 
246  QgsRectangle fullExtent() const;
247 
257  QgsRectangle projectExtent() const;
258 
270  void setExtent( const QgsRectangle &r, bool magnified = false );
271 
280  bool setReferencedExtent( const QgsReferencedRectangle &extent ) SIP_THROW( QgsCsException );
281 
286  double rotation() const;
287 
292  void setRotation( double degrees );
293 
298  void setCenter( const QgsPointXY &center );
299 
304  QgsPointXY center() const;
305 
311  void zoomToFullExtent();
312 
321  void zoomToProjectExtent();
322 
324  void zoomToPreviousExtent();
325 
327  void zoomToNextExtent();
328 
330  void clearExtentHistory();
331 
332 
338  void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
339 
346  void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter = true );
347 
349  void panToSelected( QgsVectorLayer *layer = nullptr );
350 
356  void panToSelected( const QList<QgsMapLayer *> &layers );
357 
370  void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids,
371  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
372  int flashes = 3, int duration = 500 );
373 
386  void flashGeometries( const QList< QgsGeometry > &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(),
387  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
388  int flashes = 3, int duration = 500 );
389 
391  void setMapTool( QgsMapTool *mapTool, bool clean = false );
392 
400  void unsetMapTool( QgsMapTool *mapTool );
401 
403  QgsMapTool *mapTool();
404 
410  void setProject( QgsProject *project );
411 
418  QgsProject *project();
419 
421  void setCanvasColor( const QColor &_newVal );
423  QColor canvasColor() const;
424 
429  void setSelectionColor( const QColor &color );
430 
435  QColor selectionColor() const;
436 
438  void updateScale();
439 
441  QgsMapLayer *layer( int index );
442 
444  int layerCount() const;
445 
450  QList<QgsMapLayer *> layers() const;
451 
461  void freeze( bool frozen = true );
462 
470  bool isFrozen() const;
471 
480  bool renderFlag() const { return mRenderFlag; }
481 
486  QgsUnitTypes::DistanceUnit mapUnits() const;
487 
493  QMap<QString, QString> layerStyleOverrides() const;
494 
506  void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
507 
526  void setTheme( const QString &theme );
527 
533  QString theme() const { return mTheme; }
534 
536  const QgsMapToPixel *getCoordinateTransform();
537 
539  bool isDrawing();
540 
542  QgsMapLayer *currentLayer();
543 
545  void setWheelFactor( double factor );
546 
554  void zoomScale( double scale, bool ignoreScaleLock = false );
555 
563  void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr, bool ignoreScaleLock = false );
564 
566  void zoomWithCenter( int x, int y, bool zoomIn );
567 
572  void zoomToFeatureExtent( QgsRectangle &rect );
573 
579  bool scaleLocked() const { return mScaleLocked;}
580 
582  void enableAntiAliasing( bool flag );
583 
585  bool antiAliasingEnabled() const { return mSettings.testFlag( QgsMapSettings::Antialiasing ); }
586 
588  void enableMapTileRendering( bool flag );
589 
590  // following 2 methods should be moved elsewhere or changed to private
591  // currently used by pan map tool
593  void panActionEnd( QPoint releasePoint );
594 
595 #ifndef SIP_RUN
596 
602  void panActionStart( QPoint releasePoint );
603 #endif
604 
606  void panAction( QMouseEvent *event );
607 
609  QPoint mouseLastXY();
610 
617  void setPreviewModeEnabled( bool previewEnabled );
618 
626  bool previewModeEnabled() const;
627 
637  void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
638 
647  QgsPreviewEffect::PreviewMode previewMode() const;
648 
657  QgsSnappingUtils *snappingUtils() const;
658 
667  void setSnappingUtils( QgsSnappingUtils *utils );
668 
679  void setExpressionContextScope( const QgsExpressionContextScope &scope ) { mExpressionContextScope = scope; }
680 
689  QgsExpressionContextScope &expressionContextScope() { return mExpressionContextScope; }
690 
698  const QgsExpressionContextScope &expressionContextScope() const { return mExpressionContextScope; } SIP_SKIP
699 
706  QgsExpressionContextScope *defaultExpressionContextScope() const SIP_FACTORY;
707 
708  QgsExpressionContext createExpressionContext() const override;
709 
714  void setSegmentationTolerance( double tolerance );
715 
720  void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
721 
726  QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
727 
733  bool annotationsVisible() const { return mAnnotationsVisible; }
734 
740  void setAnnotationsVisible( bool visible );
741 
746  void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
747 
752  const QgsLabelingEngineSettings &labelingEngineSettings() const;
753 
762  bool previewJobsEnabled() const;
763 
772  void setPreviewJobsEnabled( bool enabled );
773 
779  void setCustomDropHandlers( const QVector<QPointer<QgsCustomDropHandler >> &handlers ) SIP_SKIP;
780 
791  void setTemporalRange( const QgsDateTimeRange &range );
792 
799  const QgsDateTimeRange &temporalRange() const;
800 
812  void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
813 
821  void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
822 
828  bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
829 
830  public slots:
831 
833  void refresh();
834 
844  void refreshAllLayers();
845 
854  void redrawAllLayers();
855 
857  void selectionChangedSlot();
858 
860  void saveAsImage( const QString &fileName, QPixmap *QPixmap = nullptr, const QString & = "PNG" );
861 
863  void layerStateChange();
864 
872  void setRenderFlag( bool flag );
873 
878  void stopRendering();
879 
881  void readProject( const QDomDocument & );
882 
884  void writeProject( QDomDocument & );
885 
894  void setMagnificationFactor( double factor, const QgsPointXY *center = nullptr );
895 
901  void setScaleLocked( bool isLocked );
902 
904  void zoomIn();
905 
907  void zoomOut();
908 
913  void zoomToSelected( QgsVectorLayer *layer = nullptr );
914 
920  void zoomToSelected( const QList<QgsMapLayer *> &layers );
921 
927  void setZoomResolutions( const QList<double> &resolutions ) { mZoomResolutions = resolutions; }
928 
932  double zoomInFactor() const;
933 
937  double zoomOutFactor() const;
938 
944  const QList<double> &zoomResolutions() const { return mZoomResolutions; }
945 
954  QgsDoubleRange zRange() const;
955 
964  void setZRange( const QgsDoubleRange &range );
965 
966  private slots:
968  void mapToolDestroyed();
969 
971  void rendererJobFinished();
972 
974  void previewJobFinished();
975 
976  void mapUpdateTimeout();
977 
978  void refreshMap();
979 
980  void mapThemeChanged( const QString &theme );
982  void mapThemeRenamed( const QString &theme, const QString &newTheme );
983 
984  void updateDevicePixelFromScreen();
985 
986  signals:
987 
992  void xyCoordinates( const QgsPointXY &p );
993 
995  void scaleChanged( double );
996 
1003  void scaleLockChanged( bool locked );
1004 
1005 
1008 
1013  void rotationChanged( double );
1014 
1019  void magnificationChanged( double );
1020 
1026 
1027  // TODO: deprecate when decorations are reimplemented as map canvas items
1028 
1039  void renderComplete( QPainter * );
1040 
1041  // ### QGIS 3: renamte to mapRefreshFinished()
1044 
1045  // ### QGIS 3: rename to mapRefreshStarted()
1048 
1054 
1057 
1059  void keyPressed( QKeyEvent *e );
1060 
1062  void keyReleased( QKeyEvent *e );
1063 
1068  void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
1069 
1070 
1073 
1076 
1079 
1085 
1091 
1097 
1103 
1109  void themeChanged( const QString &theme );
1110 
1112  void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel = Qgis::MessageLevel::Info );
1113 
1121  void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
1122 
1133  void panDistanceBearingChanged( double distance, QgsUnitTypes::DistanceUnit unit, double bearing );
1134 
1139  void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
1140 
1147 
1157 
1164  void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
1165 
1166  protected:
1167 
1168  bool event( QEvent *e ) override;
1169  void keyPressEvent( QKeyEvent *e ) override;
1170  void keyReleaseEvent( QKeyEvent *e ) override;
1171  void mouseDoubleClickEvent( QMouseEvent *e ) override;
1172  void mouseMoveEvent( QMouseEvent *e ) override;
1173  void mousePressEvent( QMouseEvent *e ) override;
1174  void mouseReleaseEvent( QMouseEvent *e ) override;
1175  void wheelEvent( QWheelEvent *e ) override;
1176  void resizeEvent( QResizeEvent *e ) override;
1177  void paintEvent( QPaintEvent *e ) override;
1178  void dragEnterEvent( QDragEnterEvent *e ) override;
1179  bool viewportEvent( QEvent *event ) override;
1180 
1182  void moveCanvasContents( bool reset = false );
1183 
1184  void dropEvent( QDropEvent *event ) override;
1185 
1186  void showEvent( QShowEvent *event ) override;
1187 
1189  class CanvasProperties;
1190 
1192  std::unique_ptr<CanvasProperties> mCanvasProperties;
1193 
1194 #if 0
1195 
1200  void connectNotify( const char *signal ) override;
1201 #endif
1202 
1203  protected slots:
1205  void updateCanvasItemPositions();
1206 
1207  private slots:
1208 
1209  void layerRepaintRequested( bool deferred );
1210 
1211  void autoRefreshTriggered();
1212 
1213  void updateAutoRefreshTimer();
1214 
1215  void projectThemesChanged();
1216 
1217  void startPreviewJob( int number );
1218 
1219  private:
1220 
1221  // Restore scale RAII
1222  class ScaleRestorer
1223  {
1224  public:
1225  ScaleRestorer( QgsMapCanvas *canvas ):
1226  mCanvas( canvas )
1227  {
1228  mLockedScale = mCanvas->mapSettings().scale();
1229  };
1230 
1231  ~ScaleRestorer()
1232  {
1233  QgsRectangle newExtent = mCanvas->mapSettings().extent();
1234  newExtent.scale( mLockedScale / mCanvas->mapSettings().scale() );
1235  mCanvas->mSettings.setExtent( newExtent );
1236  };
1237 
1238  private:
1239  QgsMapCanvas *mCanvas;
1240  double mLockedScale;
1241  };
1242 
1244  QgsMapSettings mSettings;
1245 
1247  QgsMapCanvasMap *mMap = nullptr;
1248 
1253  QgsTemporalController *mController = nullptr;
1254 
1256  bool mFrozen = false;
1257 
1259  bool mRefreshScheduled = false;
1260 
1262  bool mRefreshAfterJob = false;
1263 
1265  bool mRenderFlag = true;
1266 
1268  QPointer< QgsMapLayer > mCurrentLayer;
1269 
1271  QGraphicsScene *mScene = nullptr;
1272 
1274  QgsMapTool *mMapTool = nullptr;
1275 
1277  QgsMapTool *mLastNonZoomMapTool = nullptr;
1278 
1280  QgsProject *mProject = nullptr;
1281 
1283  QList <QgsRectangle> mLastExtent;
1284  int mLastExtentIndex = -1;
1285 
1287  double mWheelZoomFactor = 2.0;
1288 
1290  QTimer mMapUpdateTimer;
1291 
1293  QgsMapRendererQImageJob *mJob = nullptr;
1294 
1296  bool mJobCanceled = false;
1297 
1299  std::unique_ptr< QgsLabelingResults > mLabelingResults;
1300 
1302  bool mLabelingResultsOutdated = false;
1303 
1305  bool mUseParallelRendering = false;
1306 
1308  bool mDrawRenderingStats = false;
1309 
1311  QgsMapRendererCache *mCache = nullptr;
1312 
1313  QTimer *mResizeTimer = nullptr;
1314  QTimer *mRefreshTimer = nullptr;
1315 
1316  QgsPreviewEffect *mPreviewEffect = nullptr;
1317 
1318  QgsRectangle imageRect( const QImage &img, const QgsMapSettings &mapSettings );
1319 
1320  QgsSnappingUtils *mSnappingUtils = nullptr;
1321 
1322  QList< QgsMapRendererQImageJob * > mPreviewJobs;
1323 
1325  bool mScaleLocked = false;
1326 
1327  QgsExpressionContextScope mExpressionContextScope;
1328 
1330  QRect mZoomRect;
1331 
1333  bool mZoomDragging = false;
1334 
1336  std::unique_ptr< QgsRubberBand > mZoomRubberBand;
1337 
1338  QCursor mZoomCursor;
1339 
1340  QTimer mAutoRefreshTimer;
1341 
1342  QTimer mPreviewTimer;
1343  QMetaObject::Connection mPreviewTimerConnection;
1344 
1345  QString mTheme;
1346 
1347  QgsPointXY mCursorPoint;
1348 
1349  bool mAnnotationsVisible = true;
1350 
1351  bool mUsePreviewJobs = false;
1352 
1353  QHash< QString, int > mLastLayerRenderTime;
1354 
1355  QVector<QPointer<QgsCustomDropHandler >> mDropHandlers;
1356 
1357  QgsDistanceArea mDa;
1358  QList<double> mZoomResolutions;
1359 
1360  QList< QgsMapCanvasInteractionBlocker * > mInteractionBlockers;
1361 
1362  int mBlockItemPositionUpdates = 0;
1363 
1364  QMetaObject::Connection mScreenDpiChangedConnection;
1365 
1370  QgsPointXY cursorPoint() const;
1371 
1376  void updateMapSize();
1377 
1383  void beginZoomRect( QPoint pos );
1384 
1390  void endZoomRect( QPoint pos );
1391 
1400  bool boundingBoxOfFeatureIds( const QgsFeatureIds &ids, QgsVectorLayer *layer, QgsRectangle &bbox, QString &errorMsg ) const;
1401 
1408  QgsRectangle optimalExtentForPointLayer( QgsVectorLayer *layer, const QgsPointXY &center, int scaleFactor = 5 );
1409 
1410  void setLayersPrivate( const QList<QgsMapLayer *> &layers );
1411 
1412  void startPreviewJobs();
1413  void stopPreviewJobs();
1414  void schedulePreviewJob( int number );
1415 
1419  bool panOperationInProgress();
1420 
1421  int nextZoomLevel( const QList<double> &resolutions, bool zoomIn = true ) const;
1422 
1427  void clearTemporalCache();
1428 
1432  void clearElevationCache();
1433 
1434  void showContextMenu( QgsMapMouseEvent *event );
1435 
1436  friend class TestQgsMapCanvas;
1437 
1438 }; // class QgsMapCanvas
1439 
1440 // clazy:excludeall=qstring-allocations
1441 
1442 #endif
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:106
Abstract base class for all geometries.
This class represents a coordinate reference system (CRS).
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:66
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
QgsRange which stores a range of double values.
Definition: qgsrange.h:203
Abstract interface for generating an expression context.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A class for highlight features on the map.
Definition: qgshighlight.h:62
Stores global configuration for labeling engine.
Class that stores computed placement from labeling engine.
An interactive map canvas item which displays a QgsAnnotation.
An interface for objects which block interactions with a QgsMapCanvas.
Interaction
Available interactions to block.
Deprecated to be deleted, stuff from here should be moved elsewhere.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:86
void messageEmitted(const QString &title, const QString &message, Qgis::MessageLevel=Qgis::MessageLevel::Info)
emit a message (usually to be displayed in a message bar)
void contextMenuAboutToShow(QMenu *menu, QgsMapMouseEvent *event)
Emitted before the map canvas context menu will be shown.
const QList< double > & zoomResolutions() const
Definition: qgsmapcanvas.h:944
void extentsChanged()
Emitted when the extents of the map change.
void xyCoordinates(const QgsPointXY &p)
Emits current mouse position.
void magnificationChanged(double)
Emitted when the scale of the map changes.
void setZoomResolutions(const QList< double > &resolutions)
Set a list of resolutions (map units per pixel) to which to "snap to" when zooming the map.
Definition: qgsmapcanvas.h:927
bool antiAliasingEnabled() const
true if antialiasing is enabled
Definition: qgsmapcanvas.h:585
QString theme() const
Returns the map's theme shown in the canvas, if set.
Definition: qgsmapcanvas.h:533
void renderComplete(QPainter *)
Emitted when the canvas has rendered.
void tapAndHoldGestureOccurred(const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture)
Emitted whenever a tap and hold gesture occurs at the specified map point.
void zoomNextStatusChanged(bool)
Emitted when zoom next status changed.
void rotationChanged(double)
Emitted when the rotation of the map changes.
void selectionChanged(QgsVectorLayer *layer)
Emitted when selection in any layer gets changed.
bool scaleLocked() const
Returns whether the scale is locked, so zooming can be performed using magnication.
Definition: qgsmapcanvas.h:579
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
Definition: qgsmapcanvas.h:689
void zRangeChanged()
Emitted when the map canvas z (elevation) range changes.
void mapToolSet(QgsMapTool *newTool, QgsMapTool *oldTool)
Emit map tool changed with the old tool.
void canvasColorChanged()
Emitted when canvas background color changes.
void currentLayerChanged(QgsMapLayer *layer)
Emitted when the current layer is changed.
void renderErrorOccurred(const QString &error, QgsMapLayer *layer)
Emitted whenever an error is encountered during a map render operation.
void mapRefreshCanceled()
Emitted when the pending map refresh has been canceled.
void renderStarting()
Emitted when the canvas is about to be rendered.
std::unique_ptr< CanvasProperties > mCanvasProperties
Handle pattern for implementation object.
void keyReleased(QKeyEvent *e)
Emit key release event.
void layerStyleOverridesChanged()
Emitted when the configuration of overridden layer styles changes.
void scaleChanged(double)
Emitted when the scale of the map changes.
void scaleLockChanged(bool locked)
Emitted when the scale locked state of the map changes.
bool renderFlag() const
Returns true if canvas render is disabled as a result of user disabling renders via the GUI.
Definition: qgsmapcanvas.h:480
void panDistanceBearingChanged(double distance, QgsUnitTypes::DistanceUnit unit, double bearing)
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
void temporalRangeChanged()
Emitted when the map canvas temporal range changes.
void themeChanged(const QString &theme)
Emitted when the canvas has been assigned a different map theme.
void destinationCrsChanged()
Emitted when map CRS has changed.
void transformContextChanged()
Emitted when the canvas transform context is changed.
void keyPressed(QKeyEvent *e)
Emit key press event.
void mapCanvasRefreshed()
Emitted when canvas finished a refresh request.
void zoomLastStatusChanged(bool)
Emitted when zoom last status changed.
const QgsExpressionContextScope & expressionContextScope() const
Returns a const reference to the expression context scope for the map canvas.
Definition: qgsmapcanvas.h:698
void layersChanged()
Emitted when a new set of layers has been received.
void setExpressionContextScope(const QgsExpressionContextScope &scope)
Sets an expression context scope for the map canvas.
Definition: qgsmapcanvas.h:679
Base class for all map layer types.
Definition: qgsmaplayer.h:71
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
A widget that displays an overview map.
This class is responsible for keeping cache of rendered images resulting from a map rendering job.
Intermediate base class adding functionality that allows client to query the rendered image.
The QgsMapSettings class contains configuration for rendering of the map.
@ Antialiasing
Enable anti-aliasing for map rendering.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:39
Abstract base class for all map tools.
Definition: qgsmaptool.h:66
A class to represent a 2D point.
Definition: qgspointxy.h:59
A graphics effect which can be applied to a widget to simulate various printing and color blindness m...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:101
A rectangle specified with double values.
Definition: qgsrectangle.h:42
void scale(double scaleFactor, const QgsPointXY *c=nullptr)
Scale the rectangle around its center point.
Definition: qgsrectangle.h:256
A QgsRectangle with associated coordinate reference system.
A class for drawing transient features (e.g.
Definition: qgsrubberband.h:51
This class has all the configuration of snapping and can return answers to snapping queries.
A controller base class for temporal objects, contains a signal for notifying updates of the objects ...
DistanceUnit
Units of distance.
Definition: qgsunittypes.h:68
Represents a vector layer which manages a vector based data sets.
#define SIP_THROW(name)
Definition: qgis_sip.h:189
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
#define SIP_KEEPREFERENCE
Definition: qgis_sip.h:86
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_END
Definition: qgis_sip.h:194
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
const QgsCoordinateReferenceSystem & crs