This is a migrated thread and some comments may be shown as answers.

How to add many polylinedata elements using UI virtualization dynamically.

1 Answer 112 Views
Map
This is a migrated thread and some comments may be shown as answers.
Sanjay
Top achievements
Rank 1
Sanjay asked on 20 Jan 2015, 10:03 AM
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++)
               {
                   LoadZones();
               }

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;
           this.visualizationLayer.Items.Add(polyline);
       }

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.

this.mapShapeDataReader.SourceCollection.Add(
                      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



1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 22 Jan 2015, 09:47 AM
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

Regards,
Petar Mladenov
Telerik
 

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.

 
Tags
Map
Asked by
Sanjay
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or