QGIS API Documentation  2.99.0-Master (7d4f81d)
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsMapCanvasTracer Class Reference

Extension of QgsTracer that provides extra functionality: More...

#include <qgsmapcanvastracer.h>

Inheritance diagram for QgsMapCanvasTracer:
Inheritance graph
[legend]

Public Member Functions

 QgsMapCanvasTracer (QgsMapCanvas *canvas, QgsMessageBar *messageBar=0)
 Create tracer associated with a particular map canvas, optionally message bar for reporting. More...
 
 ~QgsMapCanvasTracer ()
 
QAction * actionEnableTracing () const
 Access to action that user may use to toggle tracing on/off. May be null if no action was associated. More...
 
void reportError (PathError err, bool addingVertex)
 Report a path finding error to the user. More...
 
void setActionEnableTracing (QAction *action)
 Assign "enable tracing" checkable action to the tracer. More...
 
- Public Member Functions inherited from QgsTracer
 QgsTracer ()
 
 ~QgsTracer ()
 
QgsCoordinateReferenceSystem destinationCrs () const
 Get CRS used for tracing. More...
 
QgsRectangle extent () const
 Get extent to which graph's features will be limited (empty extent means no limit) More...
 
QVector< QgsPointXYfindShortestPath (const QgsPointXY &p1, const QgsPointXY &p2, PathError *error=nullptr)
 Given two points, find the shortest path and return points on the way. More...
 
bool hasTopologyProblem () const
 Whether there was an error during graph creation due to noding exception, indicating some input data topology problems. More...
 
bool init ()
 Build the internal data structures. More...
 
bool isInitialized () const
 Whether the internal data structures have been initialized. More...
 
bool isPointSnapped (const QgsPointXY &pt)
 Find out whether the point is snapped to a vertex or edge (i.e. it can be used for tracing start/stop) More...
 
QList< QgsVectorLayer * > layers () const
 Get layers used for tracing. More...
 
int maxFeatureCount () const
 Get maximum possible number of features in graph. If the number is exceeded, graph is not created. More...
 
void setDestinationCrs (const QgsCoordinateReferenceSystem &crs)
 Set CRS used for tracing. More...
 
void setExtent (const QgsRectangle &extent)
 Set extent to which graph's features will be limited (empty extent means no limit) More...
 
void setLayers (const QList< QgsVectorLayer *> &layers)
 Set layers used for tracing. More...
 
void setMaxFeatureCount (int count)
 Get maximum possible number of features in graph. If the number is exceeded, graph is not created. More...
 

Static Public Member Functions

static QgsMapCanvasTracertracerForCanvas (QgsMapCanvas *canvas)
 Retrieve instance of this class associated with given canvas (if any). More...
 

Protected Member Functions

virtual void configure ()
 Sets configuration from current snapping settings and canvas settings. More...
 

Additional Inherited Members

- Public Types inherited from QgsTracer
enum  PathError {
  ErrNone, ErrTooManyFeatures, ErrPoint1, ErrPoint2,
  ErrNoPath
}
 Possible errors that may happen when calling findShortestPath() More...
 
- Protected Slots inherited from QgsTracer
void invalidateGraph ()
 Destroy the existing graph structure if any (de-initialize) More...
 

Detailed Description

Extension of QgsTracer that provides extra functionality:

A simple registry of tracer instances associated to map canvas instances is kept for convenience. (Map tools do not need to create their local tracer instances and map canvas API is not "polluted" by this optional functionality).

Since
QGIS 2.14

Definition at line 39 of file qgsmapcanvastracer.h.

Constructor & Destructor Documentation

◆ QgsMapCanvasTracer()

QgsMapCanvasTracer::QgsMapCanvasTracer ( QgsMapCanvas canvas,
QgsMessageBar messageBar = 0 
)
explicit

Create tracer associated with a particular map canvas, optionally message bar for reporting.

Definition at line 33 of file qgsmapcanvastracer.cpp.

◆ ~QgsMapCanvasTracer()

QgsMapCanvasTracer::~QgsMapCanvasTracer ( )

Definition at line 53 of file qgsmapcanvastracer.cpp.

Member Function Documentation

◆ actionEnableTracing()

QAction* QgsMapCanvasTracer::actionEnableTracing ( ) const
inline

Access to action that user may use to toggle tracing on/off. May be null if no action was associated.

Definition at line 49 of file qgsmapcanvastracer.h.

◆ configure()

void QgsMapCanvasTracer::configure ( )
protectedvirtual

Sets configuration from current snapping settings and canvas settings.

Reimplemented from QgsTracer.

Definition at line 98 of file qgsmapcanvastracer.cpp.

◆ reportError()

void QgsMapCanvasTracer::reportError ( QgsTracer::PathError  err,
bool  addingVertex 
)

Report a path finding error to the user.

Definition at line 63 of file qgsmapcanvastracer.cpp.

◆ setActionEnableTracing()

void QgsMapCanvasTracer::setActionEnableTracing ( QAction *  action)
inline

Assign "enable tracing" checkable action to the tracer.

The action is used to determine whether tracing is currently enabled by the user

Definition at line 53 of file qgsmapcanvastracer.h.

◆ tracerForCanvas()

QgsMapCanvasTracer * QgsMapCanvasTracer::tracerForCanvas ( QgsMapCanvas canvas)
static

Retrieve instance of this class associated with given canvas (if any).

The class keeps a simple registry of tracers associated with map canvas instances for easier access to the common tracer by various map tools

Definition at line 58 of file qgsmapcanvastracer.cpp.


The documentation for this class was generated from the following files: