In some cases, there may be a map display that only needs to be accessed (loaded), or you may need to limit the zoom level of the map, or you can only make the map zoom in depth between the 5--10 level. To implement these functions, you need to implement them by customizing the Mapmode. This article will introduce you to the common methods and techniques for implementing map access restrictions through custom mapmode.
First you need to understand the architecture model for the map projection mode (mapmode) of the Bing Maps Silverlight control, where all map projection patterns are extended based on the projection abstract base class (Mapmode). For example, two-dimensional plane map projection mode (Flatmapmode), three-dimensional map projection mode (mapmode3d: This projection mode is not currently used, for future expansion and retention), as well as the empty map projection mode (Nullmode) and so on. The following figure:
As shown in the above illustration, the Mercator projection mode (Mercatormode) provides a map spatial mapping model based on Mercator projection by inheriting from the planar map projection mode (flatmapmode). Under the scheme, the satellite projection mode (Aerialmode) and the street map Model (ROADMODE) for loading satellite maps are implemented respectively, which are used to load Microsoft satellite maps and street maps respectively.
As mentioned earlier in this article to achieve the map's access scope and depth scaling level limitations, from the above on the Bing Maps Silverlight control map projection mode architecture design of the overall analysis, you can implement access restrictions from the Mercatormode base class start, Mercatormode provides a complete map projection pattern based on the Mercator projection, which can be realized directly by extending the mercatormode of the planar map projection mode to be customized. For example, the following custom mode is used to load the map tiles of China Area:
/// <summary>
/// 自定义地图投影模式
/// </summary>
public class ChinaMode : MercatorMode
{
}