This project has moved and is read-only. For the latest updates, please go here.

Weird rendering performance issue

Aug 4, 2015 at 4:02 PM
Edited Aug 5, 2015 at 7:50 PM

In the SampleApps project, I've changed the following:
<DataTemplate x:Key="PolylineItemTemplate">
    <map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3" StrokeDashArray="3,1.5"/>
    new Polyline
        Locations = LocationCollection.Parse("56.5978,12.1212 53.6018,8.1494 53.5859,8.1554 53.5852,8.1531 53.5841,8.1539 53.5802,8.1392 53.5826,8.1309 53.5867,8.1317 53.5978,8.1212")
Effectivly making the polyline (geographically) larger, and increasing the line "complexity" by defining a dash-array.

Now, when max zooming-in on one of the polyline lines, rendering performance decrease dramatically, the CPU works very hard when the map in manipulated/translated.

My theory is that when zooming-in, WPF is actually rendering a very very large polyline (100000s of pixels) even if most of it (99.99%) is invisible. Adding further effects like shadowing, makes things even worse.

Help would be much appreciated.
Aug 6, 2015 at 12:16 PM
A solution to this type of problem could be using a Quadtree for space-partitioning and splitting up polylines into smaller parts to better support the algorithm.
Aug 9, 2015 at 3:55 PM
mmaker21 - sounds relatively complex, let's try to optimize a bit first :)

ClemensF - could you reproduce?
Aug 9, 2015 at 4:20 PM
I can't reproduce the issue. No extra CPU load on my system.
Aug 9, 2015 at 4:33 PM
Very strange, I've also tested this on a relatively strong machine. Are you sure you've fully zoomed on the polyline, and then scrolled the map to see the issue?

You might need to make the polyline even larger. Can I please PM you?

Aug 9, 2015 at 10:28 PM
I didn't set the stroke dashes. If I do, I can see what you mean. However, I don't see anything that could be done in the MapControl code to avoid this behavior.
Aug 10, 2015 at 4:16 AM
Thank you for retrying :)
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3" StrokeDashArray="3,1.5">
Seems to make things render better but look blurry.

Is it possible WPF/other optimizations aren't being applied when stroke-dash or shadow are used, since the entire line must be rendered in order to accurately visualize all viewport intersections?