Map Shapes Virtualization
Purposes of Map Shapes Virtualization
Many applications operate with collections of the map shapes. The shapes can be retrieved from different sources like ESRI shape-file, KML file or Data Base which contains a geospatial data. Using large data source within the visualization layer can decrease the overall performance of the map control, especially the initial loading and the performance during zooming or panning.
The RadMap control uses standard WPF/Silverlight shapes to render all Map Shape objects. There are two things which affect the WPF/Silverlight rendering engine:
The number of the objects visible in the viewport at the same time.
Complexity of the shapes which should be rendered. For example this is a number of points for the polylines and polygons. The WPF/Silverlight rendering engine is very sensitive for the number of points it should render. The solution would be in simplifying the initial shape files (if it is applicable).
To improve the performance with large data sets, you can use the UI Virtualization feature.
Using Map Shapes Virtualization
In order to enable the UI Virtualization feature you should configure the ZoomLevelGridList and you should specify the VirtualizationSource property of the Visualization Layer. The ZoomLevelGridList property allows dividing the map to regions. And the VirtualizationSource property allows specifying your own custom class which handles the requests by configured regions and which returns the Map Shapes which will be displayed on the map. The custom class which can be used as the virtualization source must implement the IMapVirtualizationSource interface.
When using RadMap to display Map Shapes, you must disable the UseBitmapCache property for better performance.
More information about configuring the ZoomLevelGridList you can find in the Items Virtualization article.
The RadMap contains the MapShapeDataVirtualizationSource class which implements the IMapVirtualizationSource interface. This class can be used in most cases to enable the UI Virtualization feature for the data sources like ESRI shape-file, KML file or SQL geospatial data.
The MapShapeDataVirtualizationSource exposes the following properties:
BusyIndicator: A property of type RadBusyIndicator that gets or sets the busy indicator which changes its state to busy while loading data.
ClearCache: A property of type bool that gets or sets a value indicating whether internal cache should be cleaned before reading the new items.
Reader: A property of type AsyncReaderBase that gets or sets the reader for loading map shapes.
Resolution: a property of type double that gets or sets minimal pixel size of the object. If pixel size of the object is less than this value then object will not be passed to the visualization layer.
Also the MapShapeDataVirtualizationSource contains the following events:
PreviewReadShapeDataCompleted: Occurs when the reader completes to read shapes.
ProgressChanged: Occurs when part of data is read. It can be used for displaying the loading progress percentage.
ReadShapeDataCompleted: Occurs when the reader completes to read shapes and pass them to target visualization layer.