The current web GIS client implementation based on Silverlight technology, including Microsoft Bing Maps Silverlight Control, and the open source Web GIS client Component Deepearth Project, The core is implemented by Deepzoom technology in Silverlight. You may already know that the Deepzoom technology is centered on the MultiScaleImage control, which has a source property of the Multiscaletilesource type that is used primarily to set the data source that the MultiScaleImage control will render. You can learn deep Zoom composer quickly by learning.
The deep Zoom composer creates a photo-based Silverlight project that generates a picture-viewing application based on the MultiScaleImage control, fully implements the image's tiling, and features such as smoothing, scaling, and dragging. In fact, the Web GIS client implementation based on Silverlight is also implemented by the MultiScaleImage control, the core of which is to use the Multiscaletilesource attribute to map tile data for different Web GIS maps (Image Tiles) provider to implement a data source for the MultiScaleImage control.
For Microsoft's Bing Maps, it is necessary to write a data source implementation for the MultiScaleImage control by understanding the Bing Maps Tile system and then publishing the map service for its image mapping system. You also need to capture the tiles path of the Bing maps using the HTTP Sniffer tool before implementing the following path format:
Street Map: http://r{0}.ortho.tiles.virtualearth.net/tiles/r{1}.png?g=203
Satellite map: http://h{0}.ortho.tiles.virtualearth.net/tiles/h{1}.jpeg?g=203
With the tiles path to the above Bing maps, you can then write the implementation of the data source for the MultiScaleImage control (both Multiscaletilesource) based on these two paths, the following block of code:
public abstract class BingMapsTileSource : MultiScaleTileSource
{
protected BingMapsTileSource()
: base(int.MaxValue, int.MaxValue, 0x100, 0x100, 0)
{ }
}
Through the code block above the Tilesource programming template can be seen, Bingmapstilesource inheritance and Deepzoom core class Multiscaletilesource, its loading picture The algorithm of the data is completed by the Multiscaletilesource instance method Gettilelayers (). So if you want to achieve the tiles path of the Bing maps that you obtained in front of you to get the map data for Bing Maps, you should rewrite the method's implementation to change the way it loads the data.
/// <summary>
/// 图层Tile算法
/// </summary>
/// <param name="tileLevel">缩放级别</param>
/// <param name="tilePositionX">X坐标</param>
/// <param name="tilePositionY">Y坐标</param>
/// <param name="tileImageLayerSources">图层源集合</param>
protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, IList<object> tileImageLayerSources)
{
int zoom = tileLevel - 8;
if (zoom > 0)
{
string QuadKey = TileXYToQuadKey(tilePositionX, tilePositionY, zoom);
string veLink = string.Format(UriFormat,new object[] { QuadKey[QuadKey.Length - 1], QuadKey });
var veUri = new Uri(veLink);
tileImageLayerSources.Add(veUri);
}
}