Add a MapPath object to a layer of RadMap and zoom in to the last possible level.
An exception is thrown.
public partial class RadForm1 : RadForm
{
private BingRestMapProvider bingProvider;
public RadForm1()
{
this.InitializeComponent();
this.SetupBingProvider();
this.SetupLayers();
this.ImportTestItem();
this.radMapViewer.MapElement.MiniMapElement.EnableZooming = true;
}
private void SetupBingProvider()
{
string bingKey = "Your Bing Key";
this.bingProvider = new BingRestMapProvider();
this.bingProvider.UseSession = true;
this.bingProvider.BingKey = bingKey;
this.bingProvider.ImagerySet = Telerik.WinControls.UI.Map.Bing.ImagerySet.Aerial;
LocalFileCacheProvider cache = new LocalFileCacheProvider(@"..\..\cache");
this.bingProvider.CacheProvider = cache;
this.bingProvider.ProviderUpdated += this.BingProvider_ProviderUpdated;
this.radMapViewer.Providers.Add(this.bingProvider);
this.bingProvider.InitializationComplete += this.BingProvider_InitializationComplete;
}
private void BingProvider_ProviderUpdated(object sender, EventArgs e)
{
this.bingProvider.MaxZoomLevel = 20;
}
private void BingProvider_InitializationComplete(object sender, EventArgs e)
{
this.radMapViewer.BringIntoView(new PointG(42.698559196991135, 23.320803862212352), 20);
}
private void SetupLayers()
{
MapLayer modelLayer = new MapLayer("Models");
this.radMapViewer.Layers.Add(modelLayer);
}
public void ImportTestItem()
{
Collection<Collection<PointG>> paths = new Collection<Collection<PointG>>();
var points = new Collection<PointG>();
paths.Add(points);
points.Add(new PointG(42.698559196991135, 23.320803862212352));
points.Add(new PointG(42.698927962901238, 23.319237221916447));
points.Add(new PointG(42.698928093965123, 23.319236667248555));
points.Add(new PointG(42.698928095639218, 23.319236660952237));
points.Add(new PointG(42.698661960692946, 23.319152714625682));
points.Add(new PointG(42.698661958997257, 23.319152719880927));
points.Add(new PointG(42.698661126454983, 23.319156258531189));
points.Add(new PointG(42.698366706433447, 23.320407248233786));
points.Add(new PointG(42.698559196991135, 23.320803862212352));
MapPath mapVisual = new MapPath(paths);
mapVisual.BorderColor = Color.Blue;
mapVisual.BackColor = Color.Empty;
mapVisual.BorderWidth = 3;
this.radMapViewer.Layers["Models"].Add(mapVisual);
}
}