MindFusion.Java Package Programmer's Guide
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: com.mindfusion.diagramming
Package: com.mindfusion.diagramming

 Syntax

Java  Copy Code

public class PatternRouter implements LinkRouter

 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.

Java  Copy Code

RoutePattern rightZigzag = new RoutePattern();
rightZigzag.getSteps().add(
    new RouteStep(RouteStepKind.AdvanceRelative, 0.5f));
rightZigzag.getSteps().add(
    new RouteStep(RouteStepKind.TurnRight));
rightZigzag.getSteps().add(
    new RouteStep(RouteStepKind.AdvanceRelative, 1));
rightZigzag.getSteps().add(
    new RouteStep(RouteStepKind.TurnLeft));
rightZigzag.getSteps().add(
    new RouteStep(RouteStepKind.AdvanceRelative, 0.5f));
router.getPatterns().add(rightZigzag);

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

 Inheritance Hierarchy

java.lang.Object
    com.mindfusion.diagramming.PatternRouter

 See Also

PatternRouter Members
com.mindfusion.diagramming Namespace