本文介绍了离线模式下带有自定义图层的 Windows Phone 7 地图控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好 WP7 移动开发者!

Hi WP7 mobile passionate developers!

我正在尝试使用 Windows Phone 控件中默认提供的 Bing 地图控件.具体来说,我正在尝试使用自定义 TileSource 来提供自定义制作的平铺地图,该地图将作为文件夹(内容文件)或隔离存储存储在项目中.

I'm trying to use the default provided Bing Map control from Windows Phone controls.Specifically I'm trying to use a custom TileSource to provide a custom made tiled map that will be stored in the project as a folder (Content files) or in isolate storage.

下面我展示了我尝试使用的自定义类,以 ZXY 存储格式作为内容文件存储在地图"文件夹中的地图图块/图像.

Down I present the custom class I try to use with map tiles/images stored in "map" folder in ZXY storage format as content files.

public class CustomTileSource : Microsoft.Phone.Controls.Maps.TileSource
{

    private string uriFormat = @"map/{0}/{1}/{2}.png";
    public string UriFormat
    {
        get { return uriFormat; }
        set { uriFormat = value; }
    }

    public override Uri GetUri(int x, int y, int zoomLevel)
    {
        var url = string.Format(UriFormat, zoomLevel, x, y);
        return new Uri(url, UriKind.Relative);
    }
}

尝试使用它是行不通的,虽然没有抛出错误,但不会显示自定义图块.有没有人尝试过以这种方式使用 Windows 手机地图控件?如果这不是正确的方法,哪一个是?有什么解决方法吗?

Trying to use this is not working and custom tiles are not shown although no error is thrown.Does anyone tried to use windows phone map control this way?If that's not the right approach which one is? Any workaround?

先谢谢你!

克劳迪乌

推荐答案

您是否尝试使用此问题中描述的应用程序 ID 构建绝对文件 url?用于离线查看的地图图块缓存

Did you try constructing an absolute file url using the app id as described in this question? Map Tile Caching for Offline Viewing

这篇关于离线模式下带有自定义图层的 Windows Phone 7 地图控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 06:22