AvoidsNodes link routing when virtualized

Hi,

I’ve customised a fair bit of my diagram to have its own layout algorithm, and to virtualize similar to how the sample suggests. However I am still using the default routing algorithm, with the behaviour set to AvoidsNodes. This algorithm is clearly routing based on the visible parts, meaning that as I scroll other nodes into view, they appear on top of links. Is it possible for me to customise this algorithm to take my virtualized information about the node bounds rather than from the physical model?

Thanks,
Will

OK, so I’m glad you understand that when you implement virtualization, some Nodes do not exist, and the AvoidsNodes routing of Links cannot avoid Nodes about which it cannot know.

Unfortunately the AvoidsNodes routing algorithm is not very customizable. You can easily pretend that a Node has a different size than it actual does by setting/binding Node.AvoidableMargin, or you can control whether the Node should be avoided at all by setting/binding Node.Avoidable, but that doesn’t help when the Node does not exist.

The best that I can think of, off hand, is that you could ask Links that are in the area where new Nodes “appear” to recompute their routes. One way of doing that would be to find Links that intersect the area, and if their Link.Route.Routing is AvoidsNodes, call Link.Route.InvalidateRoute() on them. So, given a Rect region in model coordinates:

  foreach (Link l in myDiagram.Panel.FindPartsIn<Link>(region, SearchFlags.Links, SearchInclusion.Intersects, SearchLayers.Links)) {
    if (l.Route.Routing == LinkRouting.AvoidsNodes) l.Route.InvalidateRoute();
  }

Thanks Walter,

That solution suffices for now, though it does add yet another hit to scroll performance, which is already a concern when the diagram becomes large.

It is likely that I will eventually need to write my own routing, as the requirements are very specific about how the links appear. Is there a particular area of the documentation you can point me to that covers this? Alternatively a particular class / member I’d need to override or replace?

Thanks for your help,
Will

Most of the functionality is in the Route class – look at overriding methods there.