Development and application of "Silverlight" Bing maps four: Custom Mapmode to achieve map access restrictions

Source: Internet
Author: User
Tags silverlight

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
{
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.