下载后 在我们的layer类中优先读取沙盒文件中下载的底图资源
读取资源工具类
public class TileFactory {
/**
* 读取本地瓦片
* @param cachePath
* @param level
* @param col
* @param row
* @return
*/
public static byte[] readTiles(String cachePath, int level, int col, int row){
byte[] tile = null;
if(RegexUtils.isNotNull(cachePath)){
InputStream inputStream = null;
File file = new File(cachePath + "/" + level + "/" + col + "/"
+ row + ".tile");
if(!file.exists()){
return null;
}else{
try {
tile = FileUtils.readFileToByteArray(file);
} catch (IOException e) {
tile = null;
}
}
}
return tile;
}
/**
* 读取离线地图瓦片
* @param offLineMapPath
* @param level
* @param col
* @param row
* @return
*/
public static byte[] readOffLineMapTiles(String offLineMapP