AStarRouter
Implements A* algorithm for finding the cheapest path between two points.
Definition
Namespace:Telerik.Windows.Diagrams.Core
Assembly:Telerik.WinControls.RadDiagram.dll
Syntax:
public class AStarRouter : IExtendedRouter, IRouter
Inheritance: objectAStarRouter
Implements:
Constructors
Initializes a new instance of the AStarRouter class.
Properties
Gets or sets a value which indicates whether the routing algorithm tries to minimize connection overlaps. Default value is False.
public bool AvoidConnectionOverlap { get; set; }
Gets or sets the avoid shapes property. This property determines if the routing will go around shapes or go through them.
public bool AvoidShapes { get; set; }
The avoid shapes.
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.
public double SegmentOverlapDistance { get; set; }
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.
public double SegmentOverlapPenalty { get; set; }
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.
public double ShapeCrossPenalty { get; set; }
Gets or sets the penalty value for a connection which crosses its start or end shape. Default value is 3.
public double StartOrEndShapeWallPenalty { get; set; }
Gets or sets the wall optimization.
public bool WallOptimization { get; set; }
The wall optimization.
Methods
Calculates the bend alteration.
protected virtual double CalculateBendAlteration(AStarNode node, AStarNode previousNode, Rect endWall, Point endPoint, Orientation currentOrientation, double penaltyBaseValue)
The node.
previousNodeAStarNodeThe previous node.
endWallRectThe end wall.
endPointPointThe end point.
currentOrientationOrientationThe current direction.
penaltyBaseValuedoubleThe penalty base value.
Returns:Gets the route points.
public IList<Point> GetRoutePoints(IConnection connection, bool showLastLine = true)
The connection.
showLastLineboolWhether the last line segment should be shown.
Returns:IList<Point>
Implements:
Gets the route points and the start and end connectors.
public ConnectionRoute GetRoutePoints(IConnection connection)
The connection.
Returns:Implements:
Calculates the sibling nodes.
protected virtual IEnumerable<AStarNode> GetSiblingNodes(AStarNode node, Rect endWall, Point endPosition, Orientation preferredOrientation, double gridSize)
The node.
endWallRectThe end wall.
endPositionPointThe end position.
preferredOrientationOrientationThe preferred direction.
gridSizedoubleSize of the grid.
Returns:IEnumerable<AStarNode>