答案 0 :(得分:0)
如果.zip中没有图块,则实际答案。在主题缩放级别上不会显示任何图块。
但是如果你已经有了从较低缩放级别显示的图块 - 是的,你可以试试!
有一种方法,您可以自己尝试
map.getTileProvider().rescaleCache({some parameters olso is here});
另一个,也许不是那么简单的决定,如下所述。
看起来你正在使用简单的方法:
XYTileSource tileSource = new XYTileSource("map",
MIN_ZOOM_LEVEL, MAX_ZOOM_LEVEL, 256, ".png", new String[]{});
map.setTileSource(tileSource);
但是,您可以转到更复杂的步骤:
XYTileSource tileSource = new XYTileSource("map",
MIN_ZOOM_LEVEL, MAX_ZOOM_LEVEL,256, ".png", new String[]{});
SimpleRegisterReceiver simpleRegisterReceiver =
new SimpleRegisterReceiver(getContext());
MapTileModuleProviderBase[] mapTileModuleProviderBases =
new MapTileModuleProviderBase[1];
mapTileModuleProviderBases[0] =
new MyMapTileFileArchiveProvider(simpleRegisterReceiver,
tileSource, mapArchiveFiles);
//mapArchiveFiles - your Array of IArchiveFile
//IArchiveFile iArchiveFile = ArchiveFileFactory.getArchiveFile(file);
//file - your .zip
MapTileProviderArray mapTileProviderArray =
new MapTileProviderArray(tileSource,
simpleRegisterReceiver, mapTileModuleProviderBases);
map.setTileProvider(mapTileProviderArray);
问题 - 什么是MyMapTileFileArchiveProvider类? 它不仅仅是MapTileFileArchiveProvider的子类,而且它们都有共同的父级:
public class MyMapTileFileArchiveProvider extends MapTileFileStorageProviderBase {}
此时,欢迎您将MapTileFileArchiveProvider类的默认实现复制粘贴到您自己的类中,并查找此方法:
private synchronized InputStream getInputStream(final MapTile pTile,
final ITileSource tileSource) {
for (final IArchiveFile archiveFile : mArchiveFiles) {
if (archiveFile!=null) {final InputStream in =
archiveFile.getInputStream(tileSource, pTile);
if (in != null) {
if (Configuration.getInstance().isDebugMode()) {
Log.d(IMapView.LOGTAG, "Found tile " + pTile + " in " + archiveFile);
}
return in;
}
}
}
//Good place for your logic (as we call it - crutch)
//to look for available tiles for subject area on lower zoom level
//Do not surrender before return null!
return null;
}
感谢您的关注:)