在运行Osmdroid交换和装载瓷砖 [英] Swapping and Loading Tiles while running Osmdroid

查看:163
本文介绍了在运行Osmdroid交换和装载瓷砖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用osmdroid与ZIP格式离线地图,我想换我的应用程序运行时已加载新的瓷砖瓷砖。但是,我不知道如何获得新的瓷砖,而无需退出应用程序加载。

I currently am using osmdroid with offline maps in the zip format and I would like to swap tiles that have been loaded for new tiles while my app is running. However, I don't know how to get the new tiles to load without exiting the app.

如何强制osmdroid检索和磁盘负载切片时我已经加载该区域的瓷砖?

How do I force osmdroid to retrieve and load tiles from disk when I already have tiles loaded for that area?

如果它帮助这里是code我最初用来装载砖:

If it helps here is the code I use to load the tiles initially:

File osmDir = new File("/mnt/sdcard/osmdroid");
File[] mapZips = osmDir.listFiles(new ZipFileFilter());

List<MapTileModuleProviderBase> overlayFileProvider = new ArrayList<MapTileModuleProviderBase>(mapZips.length);
myTileSource overlayFileTileSource = null;
IArchiveFile[] overlayFileArchive = new IArchiveFile[1];
for (File zip : mapZips)
{
overlayFileArchive[0] = ArchiveFileFactory.getArchiveFile(zip);
overlayFileTileSource = new myTileSource("MapquestOSM", null, 18, 18, 256, ".png");
overlayFileProvider.add(new MapTileFileArchiveProvider(new SimpleRegisterReceiver(getApplicationContext()), overlayFileTileSource, overlayFileArchive));
}

MapTileModuleProviderBase[] overlayFileProvider2 = new MapTileModuleProviderBase[overlayFileProvider.size()];
MapTileProviderArray overlayFileProviderArray1 = new MapTileProviderArray(overlayFileTileSource, null, overlayFileProvider.toArray(overlayFileProvider2));
        overlayFileProviderArray1.setTileRequestCompleteHandler(mapView.getTileRequestCompleteHandler());
    myTilesOverlay = new TilesOverlay(overlayFileProviderArray1, getApplicationContext());

说实话,我不完全理解这是怎么回事这个code然而,如果有谁知道哪里的解释是,这也将是AP preciated。

To be honest I don't completely understand what's going on with this code yet, if anyone knows where an explanation is that would also be appreciated.

推荐答案

在我的应用程序改变地图图块,它只是重新启动活动显示地图。这是低效的,但至少它的工作原理。

When my app changes map tiles, it just restarts the Activity displaying the Map. It's inefficient, but at least it works.

另外这是一部关于下载地图后,也许是有帮助的。
https://groups.google.com/d/msg/osmdroid/-0wc7xfJfvA / nK9NZPtS7IIJ

Also this is a post about downloading maps, maybe it is helpful. https://groups.google.com/d/msg/osmdroid/-0wc7xfJfvA/nK9NZPtS7IIJ

这篇关于在运行Osmdroid交换和装载瓷砖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆