How to add many polylinedata elements using UI virtualization dynamically.

2 posts, 0 answers
  1. Sanjay
    Sanjay avatar
    21 posts
    Member since:
    Jun 2014

    Posted 20 Jan 2015 Link to this post

    Hi There

    I'm loading locations from memory and creating PolylineData and total such PolylineData being created are around 3K, and adding each PolylineData object to the VirtulizationLayer, in a loop.

    for (i = 0; i < 3000; i++)

    Ignore the fact that i am creating all PolylineData element on same location in example below,what I'm trying to highlight is need to create them in loop and add them.

    protected void LoadZones()
               PolylineData polyline = new PolylineData()
                   ShapeFill = new MapShapeFill()
                       Stroke = new SolidColorBrush(Colors.Red),
                       StrokeThickness = 2,
                       Fill = Brushes.Blue,
               LocationCollection points = new LocationCollection();
               points.Add(new Location(-20.0791497684858, 57.5683593750001));
               points.Add(new Location(-20.04819100048355, 57.6390838623048));
               points.Add(new Location(-20.082374288709, 57.6507568359376));
               points.Add(new Location(-20.0791497684858, 57.5683593750001));
               polyline.Points = points;

    The load is quick, but there is performance loss in Zoom and Panning.

    1. Just like we can add heavy shape files into VisualizationLayer.VirtualizationSource using MapShapeDataVirtualizationSource AychReader,can we add PolylineData framework elements similarly.

                          new AsyncReaderSource()
                              //Add PolygoneData Object 

    If not , what would be best approach to add large numbers of PolylineData framework elements to Virtualization Layer dynamically.without performance loss.

    Thanks In Anticipation

  2. Petar Mladenov
    Petar Mladenov avatar
    2986 posts

    Posted 22 Jan 2015 Link to this post

    Hello Sanjay,

    In order to speed up the RadMap, you can set up your own Virtualization Source class that implements IMapVirtualizationSource. The approach should be much similar to the one described in Map Shapes Virtualization help article.
    public class ShapeDataVirtualizer : IMapItemsVirtualizationSource

    Petar Mladenov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top