MindFusion.Wpf Pack Programmer's Guide
Link Routing

Routed links avoid nodes marked as obstacles by finding the shortest path between their origin and destination that does not cross any other nodes.

Setting Up a Link Router

The control finds paths for links affected by modifications of nearby nodes by calling methods of an object that implements the ILinkRouter interface. This object can be get or set through the LinkRouter property of the Diagram class. Diagramming for WPF provides two classes that implement ILinkRouter - PatternRouter, GridRouter, QuickRouter and CompositeRouter. By default LinkRouter is set to a CompositeRouter instance.

Automatic or Explicit Routing

The RouteAllLinks method can be invoked to explicitly rearrange links in a way they do not cross nodes. In addition, links have an AutoRoute property that enables or disables automatic routing of a link; that property is initialized from the diagram's RouteLinks member. The TriggerRerouting member of the RoutingOptions class specifies when links must be rerouted automatically.

Tuning the Routing Algorithm

When a GridRouter is used, the RoutingOptions class allows customizing various aspects of the routing algorithm. That algorithm evaluates possible paths aiming to find one that has a minimal cost. The values of LengthCost, TurnCost, CrossingCost and NodeVicinityCost are added to the total cost of a route and have a great influence over the shape of the chosen path. The StartOrientation and EndOrientation properties specify the orientation of the first and last segments of routed links.