KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
TreePathVertice Class Reference

Represents a single vertex in the spanning-tree graph used by PathRouter. More...

#include <treepathvertice.h>

Classes

class  List
 A list of TreePathVertice pointers. More...
 
class  Map
 A map from hash-name string to TreePathVertice pointer. More...
 

Public Types

enum  VerticeType {
  Standard , AdHocOrigin , AdHocDestination , AdHocOriginProximal ,
  AdHocDestinationProximal
}
 Classifies a vertice's role in the path graph. More...
 
enum  VerticeState { Unvisited , Visited }
 Tracks whether this vertex has been visited during traversal. More...
 

Public Member Functions

 TreePathVertice (const QPointF &position, VerticeType type, SpanningTree *parent)
 Construct a vertice at the given position with a type and parent tree.
 
void tryAddNeighbor (TreePathVertice *neighbor)
 Add a neighbour if not already present.
 
void tryReplaceNeighbor (TreePathVertice *neighbor, TreePathVertice *newNeighbor)
 Replace an existing neighbour with a different vertice.
 
VerticeType type () const
 Return the role of this vertex.
 
QPointF position () const
 Return the 2D position of this vertex.
 
double distance () const
 Return the accumulated path distance to this vertex.
 
void setDistance (double value)
 Set the accumulated path distance.
 
VerticeState state () const
 Return the visitation state.
 
void setState (VerticeState value)
 Set the visitation state.
 
QString name () const
 Return the human-readable name of this vertex.
 
void setName (const QString &value)
 Set the human-readable name of this vertex.
 
TreePathVerticesource () const
 Return the predecessor vertex in the shortest path.
 
void setSource (TreePathVertice *value)
 Set the predecessor vertex in the shortest path.
 
Map neighbors () const
 Return the map of neighbouring vertices.
 
QString hashName () const
 Return the hash key used to identify this vertex in the graph map.
 
QString toString () const
 Return the human-readable name (alias for name()).
 

Static Public Member Functions

static QString makeHashName (const QPointF &point)
 Create a canonical hash name for a point.
 

Detailed Description

Represents a single vertex in the spanning-tree graph used by PathRouter.

Each vertice holds a 2D position, a type (standard, ad-hoc origin/destination, or proximal), a visitation state for graph traversal, and a map of neighbouring vertices.

Definition at line 20 of file treepathvertice.h.

Member Enumeration Documentation

◆ VerticeState

Tracks whether this vertex has been visited during traversal.

Enumerator
Unvisited 

Not yet visited.

Visited 

Already processed by the traversal algorithm.

Definition at line 38 of file treepathvertice.h.

◆ VerticeType

Classifies a vertice's role in the path graph.

Enumerator
Standard 

Ordinary obstacle-corner vertex.

AdHocOrigin 

Synthetic origin vertex.

AdHocDestination 

Synthetic destination vertex.

AdHocOriginProximal 

Vertex proximal to the origin.

AdHocDestinationProximal 

Vertex proximal to the destination.

Definition at line 26 of file treepathvertice.h.

Constructor & Destructor Documentation

◆ TreePathVertice()

TreePathVertice::TreePathVertice ( const QPointF &  position,
VerticeType  type,
SpanningTree parent 
)

Construct a vertice at the given position with a type and parent tree.

Parameters
position2D position of this vertex
typeRole of this vertex in the path graph
parentOwning SpanningTree

Member Function Documentation

◆ distance()

double TreePathVertice::distance ( ) const
inline

Return the accumulated path distance to this vertex.

Returns
Distance value used by shortest-path traversal

Definition at line 100 of file treepathvertice.h.

◆ hashName()

QString TreePathVertice::hashName ( ) const
inline

Return the hash key used to identify this vertex in the graph map.

Returns
Hash name string

Definition at line 154 of file treepathvertice.h.

◆ makeHashName()

static QString TreePathVertice::makeHashName ( const QPointF &  point)
static

Create a canonical hash name for a point.

Parameters
pointPoint to hash
Returns
String uniquely identifying the point's position

◆ name()

QString TreePathVertice::name ( ) const
inline

Return the human-readable name of this vertex.

Returns
Name string

Definition at line 124 of file treepathvertice.h.

◆ neighbors()

Map TreePathVertice::neighbors ( ) const
inline

Return the map of neighbouring vertices.

Returns
Map of neighbours keyed by hash name

Definition at line 148 of file treepathvertice.h.

◆ position()

QPointF TreePathVertice::position ( ) const
inline

Return the 2D position of this vertex.

Returns
Position as a QPointF

Definition at line 94 of file treepathvertice.h.

◆ setDistance()

void TreePathVertice::setDistance ( double  value)
inline

Set the accumulated path distance.

Parameters
valueNew distance value

Definition at line 106 of file treepathvertice.h.

◆ setName()

void TreePathVertice::setName ( const QString &  value)
inline

Set the human-readable name of this vertex.

Parameters
valueNew name string

Definition at line 130 of file treepathvertice.h.

◆ setSource()

void TreePathVertice::setSource ( TreePathVertice value)
inline

Set the predecessor vertex in the shortest path.

Parameters
valuePointer to the new source vertex

Definition at line 142 of file treepathvertice.h.

◆ setState()

void TreePathVertice::setState ( VerticeState  value)
inline

Set the visitation state.

Parameters
valueNew VerticeState

Definition at line 118 of file treepathvertice.h.

◆ source()

TreePathVertice * TreePathVertice::source ( ) const
inline

Return the predecessor vertex in the shortest path.

Returns
Pointer to the source vertex, or nullptr if this is the origin

Definition at line 136 of file treepathvertice.h.

◆ state()

VerticeState TreePathVertice::state ( ) const
inline

Return the visitation state.

Returns
VerticeState value

Definition at line 112 of file treepathvertice.h.

◆ toString()

QString TreePathVertice::toString ( ) const
inline

Return the human-readable name (alias for name()).

Returns
Name string

Definition at line 158 of file treepathvertice.h.

◆ tryAddNeighbor()

void TreePathVertice::tryAddNeighbor ( TreePathVertice neighbor)

Add a neighbour if not already present.

Parameters
neighborVertice to add as a neighbour

◆ tryReplaceNeighbor()

void TreePathVertice::tryReplaceNeighbor ( TreePathVertice neighbor,
TreePathVertice newNeighbor 
)

Replace an existing neighbour with a different vertice.

Parameters
neighborNeighbour to replace
newNeighborReplacement vertice

◆ type()

VerticeType TreePathVertice::type ( ) const
inline

Return the role of this vertex.

Returns
VerticeType value

Definition at line 88 of file treepathvertice.h.


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