QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgsmapcanvastracer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmapcanvastracer.h
3 ---------------------
4 begin : January 2016
5 copyright : (C) 2016 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSMAPCANVASTRACER_H
16#define QGSMAPCANVASTRACER_H
17
18#include "qgstracer.h"
19#include "qgis_gui.h"
20
21class QAction;
22class QgsMapCanvas;
23class QgsMessageBar;
25
40class GUI_EXPORT QgsMapCanvasTracer : public QgsTracer
41{
42 Q_OBJECT
43
44 public:
46 explicit QgsMapCanvasTracer( QgsMapCanvas *canvas, QgsMessageBar *messageBar = nullptr );
47 ~QgsMapCanvasTracer() override;
48
50 QAction *actionEnableTracing() const { return mActionEnableTracing; }
51
56 void setActionEnableTracing( QAction *action ) { mActionEnableTracing = action; }
57
61 QAction *actionEnableSnapping() const { return mActionEnableSnapping; }
62
67 void setActionEnableSnapping( QAction *action ) { mActionEnableSnapping = action; }
68
74 static QgsMapCanvasTracer *tracerForCanvas( QgsMapCanvas *canvas );
75
77 void reportError( PathError err, bool addingVertex );
78
79 protected:
81 void configure() override;
82
83 private slots:
84 void onCurrentLayerChanged();
85
86 private:
87 QgsMapCanvas *mCanvas = nullptr;
88 QgsMessageBar *mMessageBar = nullptr;
89 QgsMessageBarItem *mLastMessage = nullptr;
90
91 QAction *mActionEnableTracing = nullptr;
92 QAction *mActionEnableSnapping = nullptr;
93};
94
95#endif // QGSMAPCANVASTRACER_H
Extension of QgsTracer that provides extra functionality:
void setActionEnableTracing(QAction *action)
Assign "enable tracing" checkable action to the tracer.
QAction * actionEnableSnapping() const
Access to action that user may use to toggle snapping on/off.
QAction * actionEnableTracing() const
Access to action that user may use to toggle tracing on/off. May be nullptr if no action was associat...
void setActionEnableSnapping(QAction *action)
Assign "enable snapping" checkable action to the tracer.
Map canvas is a class for displaying all GIS data types on a canvas.
Represents an item shown within a QgsMessageBar widget.
A bar for displaying non-blocking messages to the user.
Utility class that construct a planar graph from the input vector layers and provides shortest path s...
Definition qgstracer.h:44
virtual void configure()
Allows derived classes to setup the settings just before the tracer is initialized.
Definition qgstracer.h:170