Hello,
I want to use custom provider in my project,
the map can be shown right,but the minimap is nothing in the map.
what should I do?
here is the code in my project:
XAML:
<telerik:RadMap x:Name="map" Center="73.8737, -31.9043" ZoomLevel="7" MinZoomLevel="3" MiniMapExpanderVisibility="Collapsed">
<telerik:RadMap.Providers>
<provider:MapProvider></provider:MapProvider>
</telerik:RadMap.Providers>
</telerik:RadMap>
MapProvider :
public class MapProvider : TiledProvider
{
public MapProvider() : base()
{
MapSource mapSource = new MapSource();
this.MapSources.Add(mapSource.UniqueId, mapSource);
}
public override ISpatialReference SpatialReference
{
get
{
return new MercatorProjection();
}
}
}
MapSource:
public class MapSource : TiledMapSource
{
public override void Initialize()
{
RaiseIntializeCompleted();
}
public MapSource() : base(3, 18, 256, 256)
{
}
protected override Uri GetTile(int tileLevel, int tilePositionX, int tilePositionY)
{
int zoomLevel = this.ConvertTileToZoomLevel(tileLevel);
if (tilePositionY > Math.Pow(2, zoomLevel - 1) - 1)
{
return null;
}
string url = "http://www.arcgisonline.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer";
StringBuilder builder = new StringBuilder();
builder.AppendFormat("{0}/tile/{1}/{2}/{3}", new object[] { url, zoomLevel - 1, tilePositionY, tilePositionX });
return new Uri(builder.ToString());
}
}
and here is the result: