Maps for WinForms
仮想化

Sometimes, large number of items need to be visualized on a map surface. Virtualization can increase the overall performance of the map control, such as the loading, zooming and panning performance. The Map control provides the VirtualLayer to display elements over the map with virtualization and asynchronous data loading. It can be used to display an unlimited number of elements, as long as not many of them are visible at the same time. The VirtualLayer requires a division of the map space in regions, and the items' source must implement the IMapVirtualSource interface.

The division of map space is defined using the VirtualLayer.Slices property, which specifies how the layer is partitioned for virtualization. Each map slice defines a minimum zoom level for its division, and the maximum zoom level for a slice is the minimum zoom layer of the next slice (or, if it is the last slice, its maximum zoom level is the maximum zoom of the map). In turn, each slice is divided into a grid of latitude/longitude divisions.

For adding a virtual layer on a map, you need to create your own class that implements IMapVirtualSource interface. We have created a class named VirtualSource which consists of the geometries of placemarks and markers required to add a virtual layer on a map. On creating your class, you would be required to add C1.Win dll to it. The following code is used to add the virtual layer on a map:

C#
コードのコピー
c1Map1.TileLayer.TileSource = new VirtualEarthAerialSource();
var vlayer = new C1.Win.Map.VirtualLayer();
c1Map1.Layers.Add(vlayer);
vlayer.LabelVisibility = LabelVisibility.Visible;
// スライスコレクションは、仮想レイヤが必要なときにアイテムを取得する領域を定義します。
vlayer.Slices.Add(new MapSlice(0, 1, 1));
vlayer.Slices.Add(new MapSlice(1, 4, 4));
// C1.Win.Map.IMapVirtualSourceインタフェースを実装する仮想ソースを提供する必要があります。
vlayer.ItemsSource = new VirtualSource();
// デフォルトのスタイル。
vlayer.Style.Stroke.Width = 1;
vlayer.Style.Stroke.Color = Color.Blue;
vlayer.Style.BackColor = Color.Aqua;

As you zoom in the output, you will be able to see the marker split into multiple placemarks indicating virtualization.