Class AStarLineRouter
Line Routing engine that use A* find path Algorithm to route orthogonal lines.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Diagram
Assembly: Syncfusion.Diagram.Base.dll
Syntax
public class AStarLineRouter : LineRouter, ISerializable
Constructors
AStarLineRouter()
Initializes a new instance of the AStarLineRouter class.
Declaration
public AStarLineRouter()
AStarLineRouter(Model)
Initializes a new instance of the AStarLineRouter class.
Declaration
public AStarLineRouter(Model model)
Parameters
Type | Name | Description |
---|---|---|
Model | model | The reference to diagram model. |
AStarLineRouter(SerializationInfo, StreamingContext)
Initializes a new instance of the AStarLineRouter class.
Declaration
protected AStarLineRouter(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | The serialization info. |
System.Runtime.Serialization.StreamingContext | context | The serialization context. |
Fields
m_lstSearchNodes
Store search node.
Declaration
protected SearchNodeArray m_lstSearchNodes
Field Value
Type |
---|
SearchNodeArray |
m_searchGrid
Store Search Grid.
Declaration
protected SearchGridNode[, ] m_searchGrid
Field Value
Type |
---|
SearchGridNode[,] |
Properties
RoutingConnectors
Gets the reference to collection of connectors that will be routed by engine.
Declaration
protected NodeCollection RoutingConnectors { get; }
Property Value
Type | Description |
---|---|
NodeCollection | The reference to routing connector collection. |
Methods
CanConnect(SearchNode, SearchNode)
Check if two search nodes can be connected.
Declaration
protected virtual bool CanConnect(SearchNode node1, SearchNode node2)
Parameters
Type | Name | Description |
---|---|---|
SearchNode | node1 | First node to check. |
SearchNode | node2 | Second node to check. |
Returns
Type | Description |
---|---|
System.Boolean | true, if can connect to the nodes. |
CheckPointOnLine(PointF, PointF)
Check are points on one horizontal or vertical line.
Declaration
protected bool CheckPointOnLine(PointF ptStart, PointF ptEnd)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptStart | Start point to check. |
System.Drawing.PointF | ptEnd | End point to check. |
Returns
Type | Description |
---|---|
System.Boolean | TRUE if points are on one horizontal or vertical line, otherwise false. |
ConnectNode(SearchNode, SearchNode)
Adds nodeToConnectWith to Neighbours collection of nodeToConnect.
Declaration
protected void ConnectNode(SearchNode nodeToConnect, SearchNode nodeToConnectWith)
Parameters
Type | Name | Description |
---|---|---|
SearchNode | nodeToConnect | Node to add neighbour to. |
SearchNode | nodeToConnectWith | Neighbour to add. |
CreateSearchNode(PointF)
Creates the search node in given location.
Declaration
protected virtual SearchNode CreateSearchNode(PointF ptLoc)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptLoc | The search node location. |
Returns
Type | Description |
---|---|
SearchNode | SearchNode instance in given location. |
DisconnectNode(SearchNode, SearchNode)
Removes neighbour node from nodeDisconnectFrom Neighbours.
Declaration
protected void DisconnectNode(SearchNode nodeDisconnectFrom, SearchNode nodeDisconnecting)
Parameters
Type | Name | Description |
---|---|---|
SearchNode | nodeDisconnectFrom | Node to remove neighbour from. |
SearchNode | nodeDisconnecting | Neighbour to remove. |
DisconnectNodes(SearchNodeArray)
Clear neighbours.
Declaration
protected void DisconnectNodes(SearchNodeArray lstDisconnecting)
Parameters
Type | Name | Description |
---|---|---|
SearchNodeArray | lstDisconnecting | Nodes to clear neighbours |
FindPath(EndPoint, EndPoint)
Searches for route from endPointHead to endPointTail.
Declaration
protected virtual PointF[] FindPath(EndPoint endPointHead, EndPoint endPointTail)
Parameters
Type | Name | Description |
---|---|---|
EndPoint | endPointHead | EndPoint to start search from. |
EndPoint | endPointTail | EndPoint to search to. |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | Array of points that represent path |
FindPath(SearchNode, SearchNode)
Searches for route from nodeStart to nodeEnd.
Declaration
protected bool FindPath(SearchNode nodeStart, SearchNode nodeEnd)
Parameters
Type | Name | Description |
---|---|---|
SearchNode | nodeStart | Node to start search from. |
SearchNode | nodeEnd | Node to search to. |
Returns
Type | Description |
---|---|
System.Boolean | True if route found, otherwise false. |
GetBoundaryIntersects(PointF, RectangleF, CompassHeading)
Gets the search node array that intersect with rcBounds rectangle.
Declaration
protected SearchNodeArray GetBoundaryIntersects(PointF ptEndPointLocation, RectangleF rcBounds, CompassHeading heading)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptEndPointLocation | The tested EndPoint location. |
System.Drawing.RectangleF | rcBounds | The bounds rectangle. |
CompassHeading | heading | The tested EndPoint heading. |
Returns
Type | Description |
---|---|
SearchNodeArray | The search node array. |
GetBoundingRect(NodeCollection)
Gets the bounding rectangle of node collection.
Declaration
public RectangleF GetBoundingRect(NodeCollection nodes)
Parameters
Type | Name | Description |
---|---|---|
NodeCollection | nodes | The node collection. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | System.Drawing.RectangleF instance. |
GetEndPointPortContainerBounds(EndPoint)
Gets the bounds of end point port container .
Declaration
protected RectangleF GetEndPointPortContainerBounds(EndPoint endPoint)
Parameters
Type | Name | Description |
---|---|---|
EndPoint | endPoint | The end point. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | Bounds of port container node. |
GetNearestSearchGridNodes(SearchNode, EndPoint)
Gets intersection points of given search node with search grid.
Declaration
protected SearchNodeArray GetNearestSearchGridNodes(SearchNode node, EndPoint endPoint)
Parameters
Type | Name | Description |
---|---|---|
SearchNode | node | The search node. |
EndPoint | endPoint | The end point to check. |
Returns
Type | Description |
---|---|
SearchNodeArray | The search node array. |
GetNodesIntersecting(NodeCollection, RectangleF)
Gets the collection of intersecting obstacles in collection with given rectangle.
Declaration
public NodeCollection GetNodesIntersecting(NodeCollection nodes, RectangleF recbBounding)
Parameters
Type | Name | Description |
---|---|---|
NodeCollection | nodes | The node collection. |
System.Drawing.RectangleF | recbBounding | The bounds rectangle to intersect with. |
Returns
Type | Description |
---|---|
NodeCollection | The intersecting nodes collection. |
GetObstacles()
Creates array of obstacles.
Declaration
protected ArrayList GetObstacles()
Returns
Type | Description |
---|---|
System.Collections.ArrayList | Array of obstacles. |
InitSearchGrid()
Initialize search grid using collected obstacles.
Declaration
protected void InitSearchGrid()
Remarks
Generate search grid from SearchGridNode
using m_lstObstacles member as obstacles collection.
IsValid(PointF)
Gets value indicates that model's bounds constrains given point.
Declaration
protected virtual bool IsValid(PointF ptTesting)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptTesting | Point to check. |
Returns
Type | Description |
---|---|
System.Boolean | TRUE in model's bounds constrains point, otherwise FALSE. |
Reroute()
Reroutes connectors from RoutingConnectors collection.
Declaration
protected void Reroute()
Remarks
Engine find short way and lay out connectors using SetPoints() method.
ResetSearchCache()
Recreate obstacles collections and generate search grid to find all possible ways.
Declaration
public void ResetSearchCache()
Remarks
Collect all obstacles ( node with enable Node.TreatAsObstacle property ) in model and save it to m_lstObstacles member. Then generate search grid by calling InitSerarchGrid() that used last obstacles collection.
UpdateNeighbours(Int32, Int32, Int32, Int32)
Update nodes neighbours.
Declaration
protected void UpdateNeighbours(int nXNode1, int nYNode1, int nXNode2, int nYNode2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nXNode1 | The X axis position of first node. |
System.Int32 | nYNode1 | The Y axis position of first node. |
System.Int32 | nXNode2 | The X axis position of second node. |
System.Int32 | nYNode2 | The Y axis position of second node. |