|
KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
|
|
A Dijkstra-based spanning tree for finding shortest paths through a line network. More...
#include <spanningtree.h>
Public Member Functions | |
| SpanningTree () | |
| Default constructor — creates an empty, invalid spanning tree. | |
| SpanningTree (const Line::List &lines) | |
| Construct a SpanningTree from a network of line segments. | |
| virtual | ~SpanningTree () |
| Destructor — frees all dynamically allocated vertex objects. | |
| Line::List | computePath () |
| Compute the shortest path from origin to destination through the line network. | |
| void | setOrigin (const QPointF &origin, Geo::Direction preferredDirection=Geo::NoDirection) |
| Set the origin point from which to route. | |
| void | setDestination (const QPointF &destination) |
| Set the destination point to route towards. | |
| TreePathVertice::List | vertices () const |
| Return all vertices in the spanning tree. | |
| bool | isValid () const |
| Return true if the spanning tree contains at least one line segment. | |
A Dijkstra-based spanning tree for finding shortest paths through a line network.
Computes the shortest path through a network of Line segments using Dijkstra's algorithm.
Construct with a Line::List representing the navigable network, set the origin and destination points, then call computePath() to retrieve the ordered list of lines that form the shortest route.
Definition at line 16 of file spanningtree.h.
|
inline |
Default constructor — creates an empty, invalid spanning tree.
Definition at line 20 of file spanningtree.h.
| SpanningTree::SpanningTree | ( | const Line::List & | lines | ) |
Construct a SpanningTree from a network of line segments.
| lines | Line segments forming the navigable graph |
| Line::List SpanningTree::computePath | ( | ) |
Compute the shortest path from origin to destination through the line network.
|
inline |
Return true if the spanning tree contains at least one line segment.
Definition at line 64 of file spanningtree.h.
| void SpanningTree::setDestination | ( | const QPointF & | destination | ) |
Set the destination point to route towards.
| destination | Target point in the line network's coordinate space |
| void SpanningTree::setOrigin | ( | const QPointF & | origin, |
| Geo::Direction | preferredDirection = Geo::NoDirection |
||
| ) |
Set the origin point from which to route.
| origin | Starting point in the line network's coordinate space |
| preferredDirection | Initial preferred travel direction (default NoDirection) |
|
inline |
Return all vertices in the spanning tree.
Definition at line 55 of file spanningtree.h.