QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 ()
 
QActionactionEnableTracing () 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< QgsPointfindShortestPath (const QgsPoint &p1, const QgsPoint &p2, PathError *error=nullptr)
 Given two points, find the shortest path and return points on the way. More...
 
bool hasCrsTransformEnabled () const
 Return true if reprojection to destination CRS is enabled. 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 QgsPoint &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 setCrsTransformEnabled (bool enabled)
 Set whether to do reprojection to destination CRS. 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...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Static Public Member Functions

static QgsMapCanvasTracertracerForCanvas (QgsMapCanvas *canvas)
 Retrieve instance of this class associated with given canvas (if any). More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

virtual void configure ()
 Sets configuration from current snapping settings and canvas settings. More...
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

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...
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

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).

Note
added in QGIS 2.14

Definition at line 38 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 27 of file qgsmapcanvastracer.cpp.

◆ ~QgsMapCanvasTracer()

QgsMapCanvasTracer::~QgsMapCanvasTracer ( )

Definition at line 47 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 48 of file qgsmapcanvastracer.h.

◆ configure()

void QgsMapCanvasTracer::configure ( )
protectedvirtual

Sets configuration from current snapping settings and canvas settings.

Reimplemented from QgsTracer.

Definition at line 92 of file qgsmapcanvastracer.cpp.

◆ reportError()

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

Report a path finding error to the user.

Definition at line 57 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 52 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 52 of file qgsmapcanvastracer.cpp.


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