Table of Contents

Class EdgeRoutingManager

Namespace
FlowGraph.Avalonia.Routing
Assembly
FlowGraph.Avalonia.dll

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

context IFlowCanvasContext

The context providing access to the graph and settings.

refreshEdges Action

Action 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

getGraph Func<Graph>
getSettings Func<FlowCanvasSettings>
refreshEdges Action

Properties

IsEnabled

Gets whether automatic edge routing is currently enabled.

public bool IsEnabled { get; }

Property Value

bool

RouteNewEdges

Gets whether newly created edges should be routed.

public bool RouteNewEdges { get; }

Property Value

bool

RouteOnDrag

Gets whether routing during drag is enabled.

public bool RouteOnDrag { get; }

Property Value

bool

RoutingService

Gets the underlying routing service for advanced configuration.

public EdgeRoutingService RoutingService { get; }

Property Value

EdgeRoutingService

Methods

ClearAllRoutes(bool)

Clears all waypoints from edges, returning them to default paths.

public void ClearAllRoutes(bool forceRefresh = true)

Parameters

forceRefresh bool

If 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

nodeIds IEnumerable<string>

IDs of nodes whose connected edges should be cleared.

forceRefresh bool

If 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

draggedNodeIds IEnumerable<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

draggedNodeIds IEnumerable<string>

IDs of nodes being dragged.

RouteAllEdges(bool)

Routes all edges in the graph.

public void RouteAllEdges(bool forceRefresh = true)

Parameters

forceRefresh bool

If true, refreshes edge rendering after routing.

RouteEdge(Edge, bool)

Routes a single edge.

public void RouteEdge(Edge edge, bool forceRefresh = true)

Parameters

edge Edge

The edge to route.

forceRefresh bool

If true, refreshes edge rendering after routing.

RouteEdgeWithAlgorithm(Edge, RouterAlgorithm, bool)

Routes a single edge using a specific router algorithm.

public void RouteEdgeWithAlgorithm(Edge edge, RouterAlgorithm algorithm, bool forceRefresh = true)

Parameters

edge Edge

The edge to route.

algorithm RouterAlgorithm

The routing algorithm to use.

forceRefresh bool

If 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

nodeId string

ID of the node whose connected edges should be routed.

forceRefresh bool

If 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

nodeIds IEnumerable<string>

IDs of nodes whose connected edges should be routed.

forceRefresh bool

If 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

edge Edge

The newly created edge.

forceRefresh bool

If 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

Event Type

EventHandler