Class EdgeRoutingManager
Manages edge routing for the FlowCanvas, integrating the Core routing service with the UI layer.
public class EdgeRoutingManager
- Inheritance
-
EdgeRoutingManager
- Inherited Members
Constructors
EdgeRoutingManager(IFlowCanvasContext, Action)
Creates a new edge routing manager.
public EdgeRoutingManager(IFlowCanvasContext context, Action refreshEdges)
Parameters
contextIFlowCanvasContextThe context providing access to the graph and settings.
refreshEdgesActionAction to call when edges need re-rendering.
EdgeRoutingManager(Func<Graph?>, Func<FlowCanvasSettings>, Action)
[Obsolete("Use the constructor that accepts IFlowCanvasContext instead.")]
public EdgeRoutingManager(Func<Graph?> getGraph, Func<FlowCanvasSettings> getSettings, Action refreshEdges)
Parameters
getGraphFunc<Graph>getSettingsFunc<FlowCanvasSettings>refreshEdgesAction
Properties
IsEnabled
Gets whether automatic edge routing is currently enabled.
public bool IsEnabled { get; }
Property Value
RouteNewEdges
Gets whether newly created edges should be routed.
public bool RouteNewEdges { get; }
Property Value
RouteOnDrag
Gets whether routing during drag is enabled.
public bool RouteOnDrag { get; }
Property Value
RoutingService
Gets the underlying routing service for advanced configuration.
public EdgeRoutingService RoutingService { get; }
Property Value
Methods
ClearAllRoutes(bool)
Clears all waypoints from edges, returning them to default paths.
public void ClearAllRoutes(bool forceRefresh = true)
Parameters
forceRefreshboolIf true, refreshes edge rendering after clearing.
ClearRoutesForNodes(IEnumerable<string>, bool)
Clears waypoints from edges connected to specific nodes. OPTIMIZED: Uses GetEdgesForNodes index for O(k) lookup instead of O(n) iteration.
public void ClearRoutesForNodes(IEnumerable<string> nodeIds, bool forceRefresh = true)
Parameters
nodeIdsIEnumerable<string>IDs of nodes whose connected edges should be cleared.
forceRefreshboolIf true, refreshes edge rendering after clearing.
OnNodesDragCompleted(IEnumerable<string>)
Called when node dragging completes. Re-routes edges if configured.
public void OnNodesDragCompleted(IEnumerable<string> draggedNodeIds)
Parameters
draggedNodeIdsIEnumerable<string>IDs of nodes that were dragged.
OnNodesDragging(IEnumerable<string>)
Called when nodes are being dragged. Re-routes edges if configured to do so. OPTIMIZED: Uses throttling and edge caching to avoid O(n) iteration on every mouse move.
public void OnNodesDragging(IEnumerable<string> draggedNodeIds)
Parameters
draggedNodeIdsIEnumerable<string>IDs of nodes being dragged.
RouteAllEdges(bool)
Routes all edges in the graph.
public void RouteAllEdges(bool forceRefresh = true)
Parameters
forceRefreshboolIf true, refreshes edge rendering after routing.
RouteEdge(Edge, bool)
Routes a single edge.
public void RouteEdge(Edge edge, bool forceRefresh = true)
Parameters
RouteEdgeWithAlgorithm(Edge, RouterAlgorithm, bool)
Routes a single edge using a specific router algorithm.
public void RouteEdgeWithAlgorithm(Edge edge, RouterAlgorithm algorithm, bool forceRefresh = true)
Parameters
edgeEdgeThe edge to route.
algorithmRouterAlgorithmThe routing algorithm to use.
forceRefreshboolIf true, refreshes edge rendering after routing.
RouteEdgesForNode(string, bool)
Routes edges connected to a single node.
public void RouteEdgesForNode(string nodeId, bool forceRefresh = true)
Parameters
nodeIdstringID of the node whose connected edges should be routed.
forceRefreshboolIf true, refreshes edge rendering after routing.
RouteEdgesForNodes(IEnumerable<string>, bool)
Routes edges connected to specific nodes. OPTIMIZED: Uses GetEdgesForNodes index for O(k) lookup instead of O(n) iteration.
public void RouteEdgesForNodes(IEnumerable<string> nodeIds, bool forceRefresh = true)
Parameters
nodeIdsIEnumerable<string>IDs of nodes whose connected edges should be routed.
forceRefreshboolIf true, refreshes edge rendering after routing.
RouteNewEdge(Edge, bool)
Routes a newly created edge if routing is enabled.
public bool RouteNewEdge(Edge edge, bool forceRefresh = true)
Parameters
edgeEdgeThe newly created edge.
forceRefreshboolIf true, refreshes edge rendering after routing.
Returns
- bool
True if the edge was routed, false otherwise.
Events
EdgesRouted
Event raised when edges have been routed and need to be re-rendered.
public event EventHandler? EdgesRouted