We have released MindFusion.WinForms Pack 2021.R2. It adds following new features and improvements:
MindFusion.DiagrammingSpatial indexSet the EnableSpatialIndex property of Diagram to create an index of item positions for faster hit-testing and viewport clipping queries. This should greatly improve user interaction and rendering speed for diagrams containing tens of thousands or more items.
// it will take some time to populate the diagram with a million nodes,
// but subsequent redraws and hit-tests should be very fast
diagram.ValidityChecks = false;
diagram.SelectAfterCreate = false;
for (int c = 0; c < 1000; c++)
{
for (int r = 0; r < 1000; r++)
{
var node = diagram.Factory.CreateShapeNode(
20 + c * 40, 20 + r * 40, 25, 25);
node.Text = diagram.Nodes.Count.ToString();
}
}
diagram.ResizeToFitItems(20);
diagram.EnableSpatialIndex = true;
diagramView.Diagram = diagram;
Note that rendering speed improves only when showing a smaller part of the diagram inside DiagramView's viewport. Rendering a lot of items at small zoom levels or in Overview's fit-all mode will still need a lot of processing, so you might want to apply constraints on minimal zoom level of diagram view and overview controls for large diagrams.
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);
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 LinkRouter 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.
MiscellaneousFix for cosmetic / zero-width pens no longer working after KB5006670 Windows Update. Before KB5006670 GDI+ used to apply them as 1-pixel wide lines regardless of graphics unit and zoom level, which the diagram control now implements internally.
API changes- Suspend and Resume methods removed from ILinkRouter. Call diagram's SuspendLinkRouter and ResumeLinkRouter methods instead.
- Default LinkRouter of Diagram changed from QuickRouter to CompositeRouter instance.
- Boolean SmartPolylineEnds property of RoutingOptions replaced by PolylineRouting enum property, which also provides an option to prevent inclined link segments for Polyline routes.
- CreateGdiPen method of Pen class now requires the target Graphics object as argument.
MindFusion.Spreadsheet- Fixed missing parentheses when ExcelImporter imports shared formulas.
- Extends the set of expression types in which blank cells are promoted to zeros or empty strings when referenced from formulas.
- Fix for horizontal barcharts showing overlapped labels.
- Custom format strings can now contain color names in square brackets, compatible with Excel color specifiers.
- Names of named ranges can include backslash and question mark symbols.
MindFusion.ReportingFix for cosmetic / zero-width pens no longer working after KB5006670 Windows Update. Before KB5006670 GDI+ used to apply them as 1-pixel wide lines regardless of graphics unit and zoom level, which the diagram control now implements internally.
Installer for the latest version can be downloaded here, or from the
clients area on our site:
https://mindfusion.eu/WinFormsTrial.zipUpdated assemblies are also available as
https://www.nuget.org/packages/MindFusion.Pack/ NuGet package.
Enjoy!