Search
PatternRouter Class
Remarks See Also
 





Routes links by applying patterns of segment and turn sequences and accepting them when resulting paths do not cross nodes.

Namespace: MindFusion.Diagramming.Wpf
Assembly: MindFusion.Diagramming.Wpf

 Syntax

C#  Copy Code

public class PatternRouter : ILinkRouter

Visual Basic  Copy Code

Public Class PatternRouter
    Implements ILinkRouter

 Remarks

You can add custom patterns to the Patterns list, or replace the standard patterns altogether. Patterns are defined using RoutePattern and RouteStep objects.

 Example

The following code defines a Z-like link route that will be accepted if it does not cross Obstacle nodes, nor passes by them within MinimumDistance.

C#  Copy Code

var rightZigzag = new RoutePattern();
rightZigzag.Steps.Add(
    new RouteStep(RouteStepKind.AdvanceRelative, 0.5));
rightZigzag.Steps.Add(
    new RouteStep(RouteStepKind.TurnRight));
rightZigzag.Steps.Add(
    new RouteStep(RouteStepKind.AdvanceRelative, 1));
rightZigzag.Steps.Add(
    new RouteStep(RouteStepKind.TurnLeft));
rightZigzag.Steps.Add(
    new RouteStep(RouteStepKind.AdvanceRelative, 0.5));
router.Patterns.Add(rightZigzag);

// this can be defined in shorter form using a pattern string
// var rightZigzag = new RoutePattern(
//     "ADR0.5 TRR ADR1 TRL ADR0.5");

 Inheritance Hierarchy

System.Object
    MindFusion.Diagramming.Wpf.PatternRouter

 See Also