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
File: PatternRouter.js

 Syntax

JavaScript  Copy Code

// class
PatternRouter.prototype = {}

 Remarks

You can add custom patterns to the patterns property, 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.

JavaScript  Copy Code

var rightZigzag = new RoutePattern();
rightZigzag.steps.push(
    new RouteStep(RouteStepKind.AdvanceRelative, 0.5));
rightZigzag.steps.push(
    new RouteStep(RouteStepKind.TurnRight));
rightZigzag.steps.push(
    new RouteStep(RouteStepKind.AdvanceRelative, 1));
rightZigzag.steps.push(
    new RouteStep(RouteStepKind.TurnLeft));
rightZigzag.steps.push(
    new RouteStep(RouteStepKind.AdvanceRelative, 0.5));
router.patterns.push(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

MindFusion.Diagramming.Router
    MindFusion.Diagramming.PatternRouter

 See Also