Modifying graphics symbols in AcceleratedDisplayLayers slow compared to non accelerat

2791
0
03-05-2013 04:29 AM
Labels (1)
JeroenBroekhuijsen
New Contributor
Hi Everyone,

I've been trying to visualize a large scale network (20.000+ elements) in WPF and have some questions regarding the performance of the new Runtime.

Somehow there seems to be a trade-off in performance of a regular grahpicslayer, and an accelerated graphicslayer.

WPF: (20.000 lines on screen)
- This moves very slow, and zooming/panning etc is cumbersome.
- Updating the stroke of all the lines in view or getting the FindGraphicsInHostCoordinates lets say 10 times per second, it is very fast.

Accelerateddisplay: (20.000+ lines on screen)
- This moves very fluently and performs really well both when zooming and panning.
- Updating the stroke of all the lines or trying to call findgraphicsinhostcoordinates is very slow I can't even get once per second updates.

So the question is: what am I doing wrong, or is this a feature?

EDIT: I've been trying to figure some things out. Main conclusion for now is: just setting the brush of all elements (20.000) takes a second (without doing anything else) in both WPF and Accelerated mode. So the trick seems be somewhere else. It looks like graphicslayer.FindGraphicsInHostCoordinates does not work properly in Accelerateddisplay.


My code:

var graphics = glayer.FindGraphicsInHostCoordinates(new Rect(0, 0, Application.Current.MainWindow.Width, Application.Current.MainWindow.Height), 1000);
foreach (var g in graphics)
{
   var pidx = (int)g.Attributes["index"];
   var r = Simulation.TagValues["pressure"][pidx, timeindex];
   var brush = GetColor(r);
   var sym = g.Symbol as SimpleLineSymbol;
   if (sym != null)
      sym.Color = brush;
}
0 Kudos
0 Replies