QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
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"
30 #include "qgsproject.h"
31 #include "qgsdistancearea.h"
32 #include "qgsmaprendererjob.h"
33 
34 #include <QDomDocument>
35 #include <QGraphicsView>
36 
37 #include "qgsmapsettings.h" // TEMPORARY
38 #include "qgsprevieweffect.h" //for QgsPreviewEffect::PreviewMode
39 
40 #include <QTimer>
41 #include <QGestureEvent>
42 #include "qgis_gui.h"
43 
44 class QWheelEvent;
45 class QPixmap;
46 class QPaintEvent;
47 class QKeyEvent;
48 class ResizeEvent;
49 
50 class QColor;
51 class QDomDocument;
52 class QPaintDevice;
53 class QMouseEvent;
54 class QRubberBand;
55 class QGraphicsScene;
56 
57 class QgsMapToPixel;
58 class QgsMapLayer;
59 class QgsHighlight;
60 class QgsVectorLayer;
61 
62 class QgsLabelingResults;
63 
66 class QgsMapSettings;
67 class QgsMapCanvasMap;
69 class QgsMapTool;
70 class QgsSnappingUtils;
71 class QgsRubberBand;
77 
79 class QgsScreenHelper;
80 
82 
83 class QMenu;
84 class QgsMapMouseEvent;
85 
86 
92 class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsExpressionContextGenerator
93 {
94 
95 #ifdef SIP_RUN
97  if ( qobject_cast<QgsMapCanvas *>( sipCpp ) != nullptr )
98  sipType = sipType_QgsMapCanvas;
99  else
100  sipType = nullptr;
101  SIP_END
102 #endif
103 
104  Q_OBJECT
105  Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )
106  Q_PROPERTY( bool previewJobsEnabled READ previewJobsEnabled WRITE setPreviewJobsEnabled )
107 
108  public:
109 
111  QgsMapCanvas( QWidget *parent SIP_TRANSFERTHIS = nullptr );
112 
113  ~QgsMapCanvas() override;
114 
125  void addOverlayWidget( QWidget *widget SIP_TRANSFER, Qt::Edge edge );
126 
130  double magnificationFactor() const;
131 
142  void setLayers( const QList<QgsMapLayer *> &layers );
143 
144  void setCurrentLayer( QgsMapLayer *layer );
145 
149  const QgsMapSettings &mapSettings() const SIP_KEEPREFERENCE;
150 
157  QgsMapSettings &mapSettings() SIP_SKIP;
158 
165  void setTemporalController( QgsTemporalController *controller );
166 
173  const QgsTemporalController *temporalController() const;
174 
178  void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
179 
183  void setMapSettingsFlags( Qgis::MapSettingsFlags flags );
184 
192  const QgsLabelingResults *labelingResults( bool allowOutdatedResults = true ) const;
193 
203  const QgsRenderedItemResults *renderedItemResults( bool allowOutdatedResults = true ) const;
204 
212  void setCachingEnabled( bool enabled );
213 
221  bool isCachingEnabled() const;
222 
226  void clearCache();
227 
236  QgsMapRendererCache *cache();
237 
242  void cancelJobs() SIP_SKIP;
243 
252  void waitWhileRendering();
253 
257  void setParallelRenderingEnabled( bool enabled );
258 
262  bool isParallelRenderingEnabled() const;
263 
267  void setMapUpdateInterval( int timeMilliseconds );
268 
272  int mapUpdateInterval() const;
273 
278  double scale() const;
279 
281  double mapUnitsPerPixel() const;
282 
284  QgsRectangle extent() const;
285 
294  QgsRectangle fullExtent() const;
295 
305  QgsRectangle projectExtent() const;
306 
318  void setExtent( const QgsRectangle &r, bool magnified = false );
319 
328  bool setReferencedExtent( const QgsReferencedRectangle &extent ) SIP_THROW( QgsCsException );
329 
333  double rotation() const;
334 
338  void setRotation( double degrees );
339 
343  void setCenter( const QgsPointXY &center );
344 
348  QgsPointXY center() const;
349 
355  void zoomToFullExtent();
356 
365  void zoomToProjectExtent();
366 
368  void zoomToPreviousExtent();
369 
371  void zoomToNextExtent();
372 
374  void clearExtentHistory();
375 
376 
382  void zoomToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids );
383 
390  void panToFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids, bool alwaysRecenter = true );
391 
393  void panToSelected( QgsMapLayer *layer = nullptr );
394 
400  void panToSelected( const QList<QgsMapLayer *> &layers );
401 
413  void flashFeatureIds( QgsVectorLayer *layer, const QgsFeatureIds &ids,
414  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
415  int flashes = 3, int duration = 500 );
416 
428  void flashGeometries( const QList< QgsGeometry > &geometries, const QgsCoordinateReferenceSystem &crs = QgsCoordinateReferenceSystem(),
429  const QColor &startColor = QColor( 255, 0, 0, 255 ), const QColor &endColor = QColor( 255, 0, 0, 0 ),
430  int flashes = 3, int duration = 500 );
431 
433  void setMapTool( QgsMapTool *mapTool, bool clean = false );
434 
442  void unsetMapTool( QgsMapTool *mapTool );
443 
445  QgsMapTool *mapTool();
446 
452  void setProject( QgsProject *project );
453 
460  QgsProject *project();
461 
463  void setCanvasColor( const QColor &_newVal );
465  QColor canvasColor() const;
466 
470  void setSelectionColor( const QColor &color );
471 
475  QColor selectionColor() const;
476 
478  void updateScale();
479 
481  QgsMapLayer *layer( int index );
482 
493  QgsMapLayer *layer( const QString &id );
494 
498  int layerCount() const;
499 
508  QList<QgsMapLayer *> layers( bool expandGroupLayers = false ) const;
509 
519  void freeze( bool frozen = true );
520 
528  bool isFrozen() const;
529 
538  bool renderFlag() const { return mRenderFlag; }
539 
544  Qgis::DistanceUnit mapUnits() const;
545 
550  QMap<QString, QString> layerStyleOverrides() const;
551 
562  void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
563 
581  void setTheme( const QString &theme );
582 
587  QString theme() const { return mTheme; }
588 
590  const QgsMapToPixel *getCoordinateTransform();
591 
593  bool isDrawing();
594 
596  QgsMapLayer *currentLayer();
597 
599  void setWheelFactor( double factor );
600 
608  void zoomScale( double scale, bool ignoreScaleLock = false );
609 
617  void zoomByFactor( double scaleFactor, const QgsPointXY *center = nullptr, bool ignoreScaleLock = false );
618 
620  void zoomWithCenter( int x, int y, bool zoomIn );
621 
626  void zoomToFeatureExtent( QgsRectangle &rect );
627 
632  bool scaleLocked() const { return mScaleLocked;}
633 
635  void enableAntiAliasing( bool flag );
636 
638  bool antiAliasingEnabled() const;
639 
641  void enableMapTileRendering( bool flag );
642 
643  // following 2 methods should be moved elsewhere or changed to private
644  // currently used by pan map tool
646  void panActionEnd( QPoint releasePoint );
647 
648 #ifndef SIP_RUN
649 
655  void panActionStart( QPoint releasePoint );
656 #endif
657 
659  void panAction( QMouseEvent *event );
660 
662  QPoint mouseLastXY();
663 
669  void setPreviewModeEnabled( bool previewEnabled );
670 
677  bool previewModeEnabled() const;
678 
687  void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
688 
696  QgsPreviewEffect::PreviewMode previewMode() const;
697 
705  QgsSnappingUtils *snappingUtils() const;
706 
714  void setSnappingUtils( QgsSnappingUtils *utils );
715 
725  void setExpressionContextScope( const QgsExpressionContextScope &scope ) { mExpressionContextScope = scope; }
726 
734  QgsExpressionContextScope &expressionContextScope() { return mExpressionContextScope; }
735 
742  const QgsExpressionContextScope &expressionContextScope() const { return mExpressionContextScope; } SIP_SKIP
743 
750  QgsExpressionContextScope *defaultExpressionContextScope() const SIP_FACTORY;
751 
752  QgsExpressionContext createExpressionContext() const override;
753 
758  void setSegmentationTolerance( double tolerance );
759 
764  void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
765 
769  QList< QgsMapCanvasAnnotationItem *> annotationItems() const;
770 
775  bool annotationsVisible() const { return mAnnotationsVisible; }
776 
781  void setAnnotationsVisible( bool visible );
782 
786  void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
787 
791  const QgsLabelingEngineSettings &labelingEngineSettings() const;
792 
800  bool previewJobsEnabled() const;
801 
809  void setPreviewJobsEnabled( bool enabled );
810 
816  void setCustomDropHandlers( const QVector<QPointer<QgsCustomDropHandler >> &handlers ) SIP_SKIP;
817 
828  void setTemporalRange( const QgsDateTimeRange &range );
829 
836  const QgsDateTimeRange &temporalRange() const;
837 
849  void installInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
850 
858  void removeInteractionBlocker( QgsMapCanvasInteractionBlocker *blocker );
859 
865  bool allowInteraction( QgsMapCanvasInteractionBlocker::Interaction interaction ) const;
866 
874  void setMapController( QgsAbstract2DMapController *controller SIP_TRANSFER );
875 
876  public slots:
877 
879  void refresh();
880 
889  void refreshAllLayers();
890 
899  void redrawAllLayers();
900 
902  void selectionChangedSlot();
903 
905  void saveAsImage( const QString &fileName, QPixmap *QPixmap = nullptr, const QString & = "PNG" );
906 
908  void layerStateChange();
909 
917  void setRenderFlag( bool flag );
918 
922  void stopRendering();
923 
925  void readProject( const QDomDocument & );
926 
928  void writeProject( QDomDocument & );
929 
937  void setMagnificationFactor( double factor, const QgsPointXY *center = nullptr );
938 
943  void setScaleLocked( bool isLocked );
944 
946  void zoomIn();
947 
949  void zoomOut();
950 
955  void zoomToSelected( QgsMapLayer *layer = nullptr );
956 
962  void zoomToSelected( const QList<QgsMapLayer *> &layers );
963 
969  void setZoomResolutions( const QList<double> &resolutions ) { mZoomResolutions = resolutions; }
970 
974  double zoomInFactor() const;
975 
979  double zoomOutFactor() const;
980 
986  const QList<double> &zoomResolutions() const { return mZoomResolutions; }
987 
996  QgsDoubleRange zRange() const;
997 
1006  void setZRange( const QgsDoubleRange &range );
1007 
1008  private slots:
1010  void mapToolDestroyed();
1011 
1013  void rendererJobFinished();
1014 
1016  void previewJobFinished();
1017 
1018  void mapUpdateTimeout();
1019 
1020  void refreshMap();
1021 
1022  void mapThemeChanged( const QString &theme );
1024  void mapThemeRenamed( const QString &theme, const QString &newTheme );
1025 
1026  void updateDevicePixelFromScreen();
1027 
1028  void onElevationShadingRendererChanged();
1029 
1030  signals:
1031 
1036  void xyCoordinates( const QgsPointXY &p );
1037 
1039  void scaleChanged( double );
1040 
1047  void scaleLockChanged( bool locked );
1048 
1049 
1052 
1056  void rotationChanged( double );
1057 
1061  void magnificationChanged( double );
1062 
1067 
1068  // TODO: deprecate when decorations are reimplemented as map canvas items
1069 
1080  void renderComplete( QPainter * );
1081 
1082  // ### QGIS 3: renamte to mapRefreshFinished()
1085 
1086  // ### QGIS 3: rename to mapRefreshStarted()
1089 
1095 
1098 
1100  void keyPressed( QKeyEvent *e );
1101 
1103  void keyReleased( QKeyEvent *e );
1104 
1108  void mapToolSet( QgsMapTool *newTool, QgsMapTool *oldTool );
1109 
1116 
1119 
1122 
1127 
1132 
1137 
1142 
1147  void themeChanged( const QString &theme );
1148 
1150  void messageEmitted( const QString &title, const QString &message, Qgis::MessageLevel = Qgis::MessageLevel::Info );
1151 
1159  void renderErrorOccurred( const QString &error, QgsMapLayer *layer );
1160 
1171  void panDistanceBearingChanged( double distance, Qgis::DistanceUnit unit, double bearing );
1172 
1177  void tapAndHoldGestureOccurred( const QgsPointXY &mapPoint, QTapAndHoldGesture *gesture );
1178 
1185 
1195 
1202  void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event );
1203 
1204  protected:
1205 
1206  bool event( QEvent *e ) override;
1207  void keyPressEvent( QKeyEvent *e ) override;
1208  void keyReleaseEvent( QKeyEvent *e ) override;
1209  void mouseDoubleClickEvent( QMouseEvent *e ) override;
1210  void mouseMoveEvent( QMouseEvent *e ) override;
1211  void mousePressEvent( QMouseEvent *e ) override;
1212  void mouseReleaseEvent( QMouseEvent *e ) override;
1213  void wheelEvent( QWheelEvent *e ) override;
1214  void resizeEvent( QResizeEvent *e ) override;
1215  void paintEvent( QPaintEvent *e ) override;
1216  void dragEnterEvent( QDragEnterEvent *e ) override;
1217  bool viewportEvent( QEvent *event ) override;
1218 
1220  void moveCanvasContents( bool reset = false );
1221 
1222  void dropEvent( QDropEvent *event ) override;
1223 
1224  void showEvent( QShowEvent *event ) override;
1225 
1231  void emitExtentsChanged();
1232 
1234  class CanvasProperties;
1235 
1237  std::unique_ptr<CanvasProperties> mCanvasProperties;
1238 
1239 #if 0
1240 
1245  void connectNotify( const char *signal ) override;
1246 #endif
1247 
1248  protected slots:
1250  void updateCanvasItemPositions();
1251 
1252  private slots:
1253 
1254  void layerRepaintRequested( bool deferred );
1255 
1256  void autoRefreshTriggered();
1257 
1258  void updateAutoRefreshTimer();
1259 
1260  void projectThemesChanged();
1261 
1262  void startPreviewJob( int number );
1263 
1264  void temporalControllerModeChanged();
1265 
1266  private:
1267 
1268  // Restore scale RAII
1269  class ScaleRestorer
1270  {
1271  public:
1272  ScaleRestorer( QgsMapCanvas *canvas ):
1273  mCanvas( canvas )
1274  {
1275  mLockedScale = mCanvas->mapSettings().scale();
1276  };
1277 
1278  ~ScaleRestorer()
1279  {
1280  QgsRectangle newExtent = mCanvas->mapSettings().extent();
1281  newExtent.scale( mLockedScale / mCanvas->mapSettings().scale() );
1282  mCanvas->mSettings.setExtent( newExtent );
1283  };
1284 
1285  private:
1286  QgsMapCanvas *mCanvas;
1287  double mLockedScale;
1288  };
1289 
1290  QgsOverlayWidgetLayout *mLayout = nullptr;
1291 
1293  QgsMapSettings mSettings;
1294 
1296  QgsMapCanvasMap *mMap = nullptr;
1297 
1298  QgsScreenHelper *mScreenHelper = nullptr;
1299 
1304  QgsTemporalController *mController = nullptr;
1305 
1307  bool mFrozen = false;
1308 
1310  bool mRefreshScheduled = false;
1311 
1313  bool mRefreshAfterJob = false;
1314 
1316  bool mRenderFlag = true;
1317 
1319  QPointer< QgsMapLayer > mCurrentLayer;
1320 
1322  QGraphicsScene *mScene = nullptr;
1323 
1325  QgsMapTool *mMapTool = nullptr;
1326 
1328  QgsProject *mProject = nullptr;
1329 
1331  QList <QgsRectangle> mLastExtent;
1332  int mLastExtentIndex = -1;
1333 
1335  double mWheelZoomFactor = 2.0;
1336 
1338  QTimer mMapUpdateTimer;
1339 
1341  QgsMapRendererQImageJob *mJob = nullptr;
1342 
1344  bool mJobCanceled = false;
1345 
1347  std::unique_ptr< QgsLabelingResults > mLabelingResults;
1348 
1350  bool mLabelingResultsOutdated = false;
1351 
1356  std::unique_ptr< QgsRenderedItemResults > mRenderedItemResults;
1357 
1362  std::unique_ptr< QgsRenderedItemResults > mPreviousRenderedItemResults;
1363 
1369  bool mRenderedItemResultsOutdated = false;
1370 
1372  bool mUseParallelRendering = false;
1373 
1375  bool mDrawRenderingStats = false;
1376 
1378  QgsMapRendererCache *mCache = nullptr;
1379 
1380  QTimer *mResizeTimer = nullptr;
1381  QTimer *mRefreshTimer = nullptr;
1382 
1383  QgsPreviewEffect *mPreviewEffect = nullptr;
1384 
1385  QgsRectangle imageRect( const QImage &img, const QgsMapSettings &mapSettings );
1386 
1387  QgsSnappingUtils *mSnappingUtils = nullptr;
1388 
1389  QList< QgsMapRendererQImageJob * > mPreviewJobs;
1390 
1392  bool mScaleLocked = false;
1393 
1394  QgsExpressionContextScope mExpressionContextScope;
1395 
1397  QRect mZoomRect;
1398 
1400  bool mZoomDragging = false;
1401 
1403  std::unique_ptr< QgsRubberBand > mZoomRubberBand;
1404 
1405  QCursor mZoomCursor;
1406 
1407  QTimer mAutoRefreshTimer;
1408 
1409  QTimer mPreviewTimer;
1410  QMetaObject::Connection mPreviewTimerConnection;
1411 
1412  QString mTheme;
1413 
1414  QgsPointXY mCursorPoint;
1415 
1416  bool mAnnotationsVisible = true;
1417 
1418  bool mUsePreviewJobs = false;
1419 
1420  QHash< QString, int > mLastLayerRenderTime;
1421 
1422  QVector<QPointer<QgsCustomDropHandler >> mDropHandlers;
1423 
1424  QgsDistanceArea mDa;
1425  QList<double> mZoomResolutions;
1426 
1427  QList< QgsMapCanvasInteractionBlocker * > mInteractionBlockers;
1428 
1429  int mBlockItemPositionUpdates = 0;
1430  int mBlockExtentChangedSignal = 0;
1431  int mBlockScaleChangedSignal = 0;
1432 
1433  std::unique_ptr< QgsTemporaryCursorOverride > mTemporaryCursorOverride;
1434 
1442  QMap <QString, QDateTime> mRendererErrors;
1443 
1444 
1445  QPointer< QgsAbstract2DMapController > mMapController;
1446 
1451  QgsPointXY cursorPoint() const;
1452 
1456  void updateMapSize();
1457 
1462  void beginZoomRect( QPoint pos );
1463 
1468  void endZoomRect( QPoint pos );
1469 
1471  void stopZoomRect();
1472 
1474  void startPan();
1475 
1477  void stopPan();
1478 
1487  bool boundingBoxOfFeatureIds( const QgsFeatureIds &ids, QgsVectorLayer *layer, QgsRectangle &bbox, QString &errorMsg ) const;
1488 
1495  QgsRectangle optimalExtentForPointLayer( QgsVectorLayer *layer, const QgsPointXY &center, int scaleFactor = 5 );
1496 
1497  void setLayersPrivate( const QList<QgsMapLayer *> &layers );
1498 
1499  void startPreviewJobs();
1500  void stopPreviewJobs();
1501  void schedulePreviewJob( int number );
1502 
1506  bool panOperationInProgress();
1507 
1508  int nextZoomLevel( const QList<double> &resolutions, bool zoomIn = true ) const;
1509 
1514  void clearTemporalCache();
1515 
1519  void clearElevationCache();
1520 
1521  void showContextMenu( QgsMapMouseEvent *event );
1522 
1527  void notifyRendererErrors( const QgsMapRendererJob::Errors &errors );
1528 
1529  friend class TestQgsMapCanvas;
1530 
1531 }; // class QgsMapCanvas
1532 
1533 // clazy:excludeall=qstring-allocations
1534 
1535 #endif
QFlags< MapSettingsFlag > MapSettingsFlags
Map settings flags.
Definition: qgis.h:2224
DistanceUnit
Units of distance.
Definition: qgis.h:4090
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:99
Abstract base class for all 2D map controllers.
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:67
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
QgsRange which stores a range of double values.
Definition: qgsrange.h:231
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:93
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:986
void selectionChanged(QgsMapLayer *layer)
Emitted when selection in any layer gets changed.
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:969
QString theme() const
Returns the map's theme shown in the canvas, if set.
Definition: qgsmapcanvas.h:587
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 panDistanceBearingChanged(double distance, Qgis::DistanceUnit unit, double bearing)
Emitted whenever the distance or bearing of an in-progress panning operation is changed.
void rotationChanged(double)
Emitted when the rotation of the map changes.
bool scaleLocked() const
Returns whether the scale is locked, so zooming can be performed using magnication.
Definition: qgsmapcanvas.h:632
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
Definition: qgsmapcanvas.h:734
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:538
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:742
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:725
Base class for all map layer types.
Definition: qgsmaplayer.h:75
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.
QList< QgsMapRendererJob::Error > Errors
Intermediate base class adding functionality that allows client to query the rendered image.
The QgsMapSettings class contains configuration for rendering of the map.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:39
Abstract base class for all map tools.
Definition: qgsmaptool.h:71
A custom layout which can be used to overlay child widgets over a parent widget.
A class to represent a 2D point.
Definition: qgspointxy.h:60
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:107
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:267
A QgsRectangle with associated coordinate reference system.
Stores collated details of rendered items during a map rendering operation.
A class for drawing transient features (e.g.
Definition: qgsrubberband.h:54
A utility class for dynamic handling of changes to screen properties.
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 ...
Temporarily sets a cursor override for the QApplication for the lifetime of the object.
Definition: qgsguiutils.h:255
Represents a vector layer which manages a vector based data sets.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:191
#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_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76
#define SIP_THROW(name,...)
Definition: qgis_sip.h:203
#define SIP_END
Definition: qgis_sip.h:208
QSet< QgsFeatureId > QgsFeatureIds
Definition: qgsfeatureid.h:37
const QgsCoordinateReferenceSystem & crs