Orthogonal path-routing algorithm that navigates around rectangular obstacles.
More...
#include <pathrouter.h>
Orthogonal path-routing algorithm that navigates around rectangular obstacles.
PathRouter computes a list of horizontal/vertical line segments connecting an origin point to a destination point while avoiding a set of rectangular obstacles on a canvas. Call calcluatePath() after configuration to obtain the routed Line::List.
Definition at line 21 of file pathrouter.h.
◆ PathRouter() [1/2]
| PathRouter::PathRouter |
( |
| ) |
|
|
inline |
Default constructor — creates an unconfigured router with default margin settings.
Definition at line 25 of file pathrouter.h.
◆ PathRouter() [2/2]
| PathRouter::PathRouter |
( |
const Point & |
origin, |
|
|
const Point & |
destination, |
|
|
const QRectF & |
canvas, |
|
|
const QList< Rectangle > & |
obstacles = QList< Rectangle >() |
|
) |
| |
Construct a PathRouter with full configuration.
- Parameters
-
| origin | Starting point for the path |
| destination | Ending point for the path |
| canvas | Bounding rectangle for the entire routing area |
| obstacles | List of rectangular obstacles to route around (default empty) |
◆ appendObstacle()
| void PathRouter::appendObstacle |
( |
const Rectangle & |
value | ) |
|
|
inline |
Append a single obstacle rectangle to the routing obstacle set.
- Parameters
-
| value | Obstacle rectangle to add |
Definition at line 56 of file pathrouter.h.
◆ calcluatePath()
Compute the routed path from origin to destination avoiding all obstacles.
- Returns
- Ordered list of line segments forming the routed path
◆ consolidateEmptyRectangles()
| bool PathRouter::consolidateEmptyRectangles |
( |
| ) |
const |
|
inline |
Return whether empty (non-obstacle) rectangles are consolidated before routing.
- Returns
- true if consolidation is enabled
Definition at line 104 of file pathrouter.h.
◆ debugLevel()
| int PathRouter::debugLevel |
( |
| ) |
const |
|
inline |
Return the debug verbosity level.
- Returns
- Debug level (0 = silent)
Definition at line 152 of file pathrouter.h.
◆ destinationPoint()
| Point PathRouter::destinationPoint |
( |
| ) |
const |
|
inline |
Return the destination point.
- Returns
- Current destination Point
Definition at line 80 of file pathrouter.h.
◆ mergeAdjacentLines()
| static void PathRouter::mergeAdjacentLines |
( |
Line::List & |
lines | ) |
|
|
static |
Merge adjacent collinear line segments in-place.
- Parameters
-
| lines | Line list to process; merged in place |
◆ originPoint()
| Point PathRouter::originPoint |
( |
| ) |
const |
|
inline |
Return the origin point.
- Returns
- Current origin Point
Definition at line 68 of file pathrouter.h.
◆ routeAroundMargins()
| bool PathRouter::routeAroundMargins |
( |
| ) |
const |
|
inline |
Return whether the router routes around obstacle margins.
- Returns
- true if margin-based routing is enabled
Definition at line 116 of file pathrouter.h.
◆ routingMargin()
| int PathRouter::routingMargin |
( |
| ) |
const |
|
inline |
Return the routing margin applied around each obstacle.
- Returns
- Margin in pixels/units
Definition at line 92 of file pathrouter.h.
◆ setConsolidateEmptyRectangles()
| void PathRouter::setConsolidateEmptyRectangles |
( |
bool |
value | ) |
|
|
inline |
Enable or disable consolidation of empty rectangles before routing.
- Parameters
-
| value | true to enable consolidation |
Definition at line 110 of file pathrouter.h.
◆ setDebugLevel()
| void PathRouter::setDebugLevel |
( |
int |
value | ) |
|
|
inline |
Set the debug verbosity level.
- Parameters
-
| value | Debug level (0 = silent, higher = more verbose) |
Definition at line 158 of file pathrouter.h.
◆ setDestinationPoint()
| void PathRouter::setDestinationPoint |
( |
const Point & |
value | ) |
|
|
inline |
Set the destination point.
- Parameters
-
| value | New destination Point |
Definition at line 86 of file pathrouter.h.
◆ setFirstSegmentLength()
| void PathRouter::setFirstSegmentLength |
( |
double |
value | ) |
|
|
inline |
Set the length of the first segment before obstacle avoidance begins.
- Parameters
-
| value | Length in pixels/units |
Definition at line 134 of file pathrouter.h.
◆ setInitialDirection()
Force the direction of the first routed segment.
- Parameters
-
| direction | Preferred initial travel direction |
Definition at line 128 of file pathrouter.h.
◆ setObstacles()
| void PathRouter::setObstacles |
( |
const QList< Rectangle > & |
value | ) |
|
|
inline |
Replace the entire obstacle set.
- Parameters
-
| value | New list of obstacle rectangles |
Definition at line 62 of file pathrouter.h.
◆ setOriginPoint()
| void PathRouter::setOriginPoint |
( |
const Point & |
value | ) |
|
|
inline |
Set the origin point.
- Parameters
-
Definition at line 74 of file pathrouter.h.
◆ setRouteAroundMargins()
| void PathRouter::setRouteAroundMargins |
( |
bool |
value | ) |
|
|
inline |
Enable or disable routing around obstacle margins.
- Parameters
-
| value | true to route around margins |
Definition at line 122 of file pathrouter.h.
◆ setRoutingMargin()
| void PathRouter::setRoutingMargin |
( |
int |
value | ) |
|
|
inline |
Set the routing margin applied around each obstacle.
- Parameters
-
| value | Margin in pixels/units |
Definition at line 98 of file pathrouter.h.
◆ setVerticalConstraint()
| void PathRouter::setVerticalConstraint |
( |
int |
value | ) |
|
|
inline |
Set the vertical constraint (maximum Y the path may reach).
- Parameters
-
| value | Y constraint value, or -1 to disable |
Definition at line 146 of file pathrouter.h.
◆ verticalConstraint()
| int PathRouter::verticalConstraint |
( |
| ) |
const |
|
inline |
Return the vertical constraint (maximum Y coordinate the path may reach).
- Returns
- Constraint Y value, or -1 if unconstrained
Definition at line 140 of file pathrouter.h.
The documentation for this class was generated from the following file: