Class
AStarRouter

Implements A* algorithm for finding the cheapest path between two points.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Syntax:

cs-api-definition
public class AStarRouter : IExtendedRouter, IRouter

Inheritance: objectAStarRouter

Implements: IExtendedRouterIRouter

Constructors

AStarRouter(IGraphInternal)

Initializes a new instance of the AStarRouter class.

Declaration

cs-api-definition
public AStarRouter(IGraphInternal diagram)

Parameters

diagram

IGraphInternal

The related diagram.

Properties

AvoidConnectionOverlap

Gets or sets a value which indicates whether the routing algorithm tries to minimize connection overlaps. Default value is False.

Declaration

cs-api-definition
public bool AvoidConnectionOverlap { get; set; }

Property Value

bool

AvoidShapes

Gets or sets the avoid shapes property. This property determines if the routing will go around shapes or go through them.

Declaration

cs-api-definition
public bool AvoidShapes { get; set; }

Property Value

bool

The avoid shapes.

SegmentOverlapDistance

Gets or sets the distance around a segment in which an overlap is detected. Note: This property has effect only when AvoidConnectionOverlap is True. Default value is 3.

Declaration

cs-api-definition
public double SegmentOverlapDistance { get; set; }

Property Value

double

SegmentOverlapPenalty

Gets or sets the penalty value for a connection which overlaps another connection. Note: This property has effect only when AvoidConnectionOverlap is True. Default value is 0.75.

Declaration

cs-api-definition
public double SegmentOverlapPenalty { get; set; }

Property Value

double

ShapeCrossPenalty

Gets or sets the penalty value for a connection which crosses a diagram shapes other than its start or end shape. Note: This property has effect only when AvoidShapes is True. Default value is 1.

Declaration

cs-api-definition
public double ShapeCrossPenalty { get; set; }

Property Value

double

StartOrEndShapeWallPenalty

Gets or sets the penalty value for a connection which crosses its start or end shape. Default value is 3.

Declaration

cs-api-definition
public double StartOrEndShapeWallPenalty { get; set; }

Property Value

double

WallOptimization

Gets or sets the wall optimization.

Declaration

cs-api-definition
public bool WallOptimization { get; set; }

Property Value

bool

The wall optimization.

Methods

CalculateBendAlteration(AStarNode, AStarNode, Rect, Point, Orientation, double)

Calculates the bend alteration.

Declaration

cs-api-definition
protected virtual double CalculateBendAlteration(AStarNode node, AStarNode previousNode, Rect endWall, Point endPoint, Orientation currentOrientation, double penaltyBaseValue)

Parameters

node

AStarNode

The node.

previousNode

AStarNode

The previous node.

endWall

Rect

The end wall.

endPoint

Point

The end point.

currentOrientation

Orientation

The current direction.

penaltyBaseValue

double

The penalty base value.

Returns

double

CalculateWallPenalty(AStarNode, double)

Calculates the wall penalty.

Declaration

cs-api-definition
protected virtual double CalculateWallPenalty(AStarNode node, double penaltyBaseValue)

Parameters

node

AStarNode

The node.

penaltyBaseValue

double

The penalty base value.

Returns

double

GetRoutePoints(IConnection)

Gets the route points and the start and end connectors.

Declaration

cs-api-definition
public ConnectionRoute GetRoutePoints(IConnection connection)

Parameters

connection

IConnection

The connection.

Returns

ConnectionRoute

Implements IExtendedRouter.GetRoutePoints(IConnection)

GetRoutePoints(IConnection, bool)

Gets the route points.

Declaration

cs-api-definition
public IList<Point> GetRoutePoints(IConnection connection, bool showLastLine = true)

Parameters

connection

IConnection

The connection.

showLastLine

bool

Whether the last line segment should be shown.

Returns

IList<Point>

Implements IRouter.GetRoutePoints(IConnection, bool)

GetSiblingNodes(AStarNode, Rect, Point, Orientation, double)

Calculates the sibling nodes.

Declaration

cs-api-definition
protected virtual IEnumerable<AStarNode> GetSiblingNodes(AStarNode node, Rect endWall, Point endPosition, Orientation preferredOrientation, double gridSize)

Parameters

node

AStarNode

The node.

endWall

Rect

The end wall.

endPosition

Point

The end position.

preferredOrientation

Orientation

The preferred direction.

gridSize

double

Size of the grid.

Returns

IEnumerable<AStarNode>