WPF Diagram version 3.9 contains the following new features and improvements -
Pattern routerNew PatternRouter class routes links by applying patterns of segment and turn sequences and accepting them when resulting paths do not cross nodes. A path is accepted if its final segment ends in target point and is orthogonal to respective side of target node. If there are several possible paths, the router selects the shortest one. The MinimumDistance property specifies minimum allowed distance of link segments from nodes. The PreferredDistance property specifies distance of first or last link bend from associated node. PatternRouter includes several predefined patterns designed to create consistent-looking paths, and allows creation of custom patterns. Custom patterns can be defined as sequence of RouteStep objects specifying whether the path advances by relative or absolute distance, or changes direction:
var rightZigzag = new RoutePattern();
rightZigzag.Steps.Add(
new RouteStep(RouteStepKind.AdvanceRelative, 0.5f));
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.5f));
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");
Composite routerThe CompositeRouter class lets you chain link routers (objects implementing ILinkRouter interface) so that a link passes through the sequence until it gets routed successfully. Diagram's default router is now set to a CompositeRouter instance containing a PatternRouter and GridRouter sequence. This applies the several standard pattern paths when possible, and otherwise routes links using the cost minimizing heuristics-based grid router.
SvgExporter improvements~ item's Opacity is set as SVG "opacity" attribute;
~ item's FontWeight is set as SVG "font-weight" attribute;
~ fixed text left padding in SvgExporter;
~ SvgExporter sets more precise font size;
Miscellaneous~ Disabling AvoidOverlaps property of RoutingOptions lets you create routes with overlapping segments.
API changes~ Suspend and Resume methods removed from ILinkRouter. Call Diagram's SuspendLinkRouter and ResumeLinkRouter methods instead.
~ Default Diagram.LinkRouter changed from QuickRouter to CompositeRouter instance.
~ bool SmartPolylineEnds property of RoutingOptions replaced by PolylineRouting enum property, which also provides an option to prevent inclined link segments for LinkShape.Polyline routes.
If anyone is interested in trying the beta version, please download this archive containing updated assembly files -
https://mindfusion.eu/_beta/wpfdiag39.zipAny comments, questions and general feedback are welcome.