Question

I have a set of Coordinates that is drawn on my override method OnRender using DrawGeometry. One of the Polygons im trying to draw is 121000 points which is a lot. This slows down my map control.

Also when this OnRender happens the points are already in memory I'm just passing the points to DrawGeomerty

here is an example what happens OnRender

MapProjection pa = new MapProjection();

if (this.mapCommunication.MapLayers == null)
{
    return;
}

foreach (KeyValuePair<Guid, MapLayerHelper> coordinatePointsLayer in this.mapCommunication.MapLayers)
{
    if (!coordinatePointsLayer.Value.IsVisible)
    {
        continue;
    }

    if (coordinatePointsLayer.Value.State != LayerEnum.Visible)
    {
        continue;
    }

    foreach (CoordinateHelper coordinatePoints in coordinatePointsLayer.Value.Coordinates)
    {
        foreach (StreamGeometry item in coordinatePoints.GeomertyPoints)
        {
            drawingContext.DrawGeometry(null, penDrawing, item);
        }
    }
}

My Question is what direction should i take from here should i optimize, or should i try and incorporate DirectX would this help or what approach should i take?

Thanks for help i pretty new to render this much data.

Was it helpful?

Solution

What i eventually figured out was help me out if I'm wrong :) WPF is already build upon Direct X so would not help me much if i tried accessing through something like SharpDX, because i was going for dubble buffering and that is already implemented.

So what i implemented was instead of reading the point in the OnRender is used a Canvas with a fixed size and added System.Windows.Shapes.Path adding my Geometry that way.

This caused WPF to better manage dubble buffering and the Points rendered much faster.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top