QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Utility class that construct a planar graph from the input vector layers and provides shortest path search for tracing of existing features. More...
#include <qgstracer.h>
Public Types | |
enum | PathError { ErrNone, ErrTooManyFeatures, ErrPoint1, ErrPoint2, ErrNoPath } |
Possible errors that may happen when calling findShortestPath() More... | |
Public Member Functions | |
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< QgsPoint > | findShortestPath (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) |
QObject * | child (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< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) 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 QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () 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) |
QThread * | thread () const |
Protected Slots | |
void | invalidateGraph () |
Destroy the existing graph structure if any (de-initialize) More... | |
Protected Member Functions | |
virtual void | configure () |
Allows derived classes to setup the settings just before the tracer is initialized. 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 |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
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) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Utility class that construct a planar graph from the input vector layers and provides shortest path search for tracing of existing features.
Definition at line 38 of file qgstracer.h.
enum QgsTracer::PathError |
Possible errors that may happen when calling findShortestPath()
Definition at line 85 of file qgstracer.h.
QgsTracer::QgsTracer | ( | ) |
Definition at line 455 of file qgstracer.cpp.
QgsTracer::~QgsTracer | ( | ) |
Definition at line 572 of file qgstracer.cpp.
|
inlineprotectedvirtual |
Allows derived classes to setup the settings just before the tracer is initialized.
This allows the configuration to be set in a lazy way only when it is really necessary. Default implementation does nothing.
Reimplemented in QgsMapCanvasTracer.
Definition at line 106 of file qgstracer.h.
|
inline |
Get CRS used for tracing.
Definition at line 56 of file qgstracer.h.
|
inline |
Get extent to which graph's features will be limited (empty extent means no limit)
Definition at line 61 of file qgstracer.h.
QVector< QgsPoint > QgsTracer::findShortestPath | ( | const QgsPoint & | p1, |
const QgsPoint & | p2, | ||
PathError * | error = nullptr |
||
) |
Given two points, find the shortest path and return points on the way.
The optional "error" argument may receive error code (PathError enum) if it is not null
Definition at line 674 of file qgstracer.cpp.
|
inline |
Return true if reprojection to destination CRS is enabled.
Definition at line 51 of file qgstracer.h.
|
inline |
Whether there was an error during graph creation due to noding exception, indicating some input data topology problems.
Definition at line 82 of file qgstracer.h.
bool QgsTracer::init | ( | ) |
Build the internal data structures.
This may take some time depending on how big the input layers are. It is not necessary to call this method explicitly - it will be called by findShortestPath() if necessary.
Definition at line 630 of file qgstracer.cpp.
|
protectedslot |
Destroy the existing graph structure if any (de-initialize)
Definition at line 642 of file qgstracer.cpp.
|
inline |
Whether the internal data structures have been initialized.
Definition at line 77 of file qgstracer.h.
bool QgsTracer::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)
Definition at line 717 of file qgstracer.cpp.
|
inline |
Get layers used for tracing.
Definition at line 46 of file qgstracer.h.
|
inline |
Get maximum possible number of features in graph. If the number is exceeded, graph is not created.
Definition at line 66 of file qgstracer.h.
void QgsTracer::setCrsTransformEnabled | ( | bool | enabled | ) |
Set whether to do reprojection to destination CRS.
Definition at line 603 of file qgstracer.cpp.
void QgsTracer::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
Set CRS used for tracing.
Definition at line 612 of file qgstracer.cpp.
void QgsTracer::setExtent | ( | const QgsRectangle & | extent | ) |
Set extent to which graph's features will be limited (empty extent means no limit)
Definition at line 621 of file qgstracer.cpp.
void QgsTracer::setLayers | ( | const QList< QgsVectorLayer *> & | layers | ) |
Set layers used for tracing.
Definition at line 577 of file qgstracer.cpp.
|
inline |
Get maximum possible number of features in graph. If the number is exceeded, graph is not created.
Definition at line 68 of file qgstracer.h.