QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
20 class QAction;
21 class QgsMapCanvas;
22 class QgsMessageBar;
23 class QgsMessageBarItem;
24 
38 class GUI_EXPORT QgsMapCanvasTracer : public QgsTracer
39 {
40  Q_OBJECT
41 
42  public:
44  explicit QgsMapCanvasTracer( QgsMapCanvas* canvas, QgsMessageBar* messageBar = 0 );
46 
48  QAction* actionEnableTracing() const { return mActionEnableTracing; }
49 
52  void setActionEnableTracing( QAction* action ) { mActionEnableTracing = action; }
53 
57  static QgsMapCanvasTracer* tracerForCanvas( QgsMapCanvas* canvas );
58 
60  void reportError( PathError err, bool addingVertex );
61 
62  protected:
64  virtual void configure();
65 
66  private slots:
67  void onCurrentLayerChanged();
68 
69  private:
71 
72  QgsMapCanvas* mCanvas;
73  QgsMessageBar* mMessageBar;
74  QgsMessageBarItem* mLastMessage;
75 
76  QAction* mActionEnableTracing;
77 };
78 
79 #endif // QGSMAPCANVASTRACER_H
virtual void configure()
Allows derived classes to setup the settings just before the tracer is initialized.
Definition: qgstracer.h:106
Utility class that construct a planar graph from the input vector layers and provides shortest path s...
Definition: qgstracer.h:38
QAction * actionEnableTracing() const
Access to action that user may use to toggle tracing on/off. May be null if no action was associated...
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:42
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:109
void setActionEnableTracing(QAction *action)
Assign "enable tracing" checkable action to the tracer.
Extension of QgsTracer that provides extra functionality:
PathError
Possible errors that may happen when calling findShortestPath()
Definition: qgstracer.h:85