本文整理汇总了Java中org.mapsforge.map.layer.cache.FileSystemTileCache类的典型用法代码示例。如果您正苦于以下问题:Java FileSystemTileCache类的具体用法?Java FileSystemTileCache怎么用?Java FileSystemTileCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileSystemTileCache类属于org.mapsforge.map.layer.cache包,在下文中一共展示了FileSystemTileCache类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createExternalStorageTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
static TileCache createExternalStorageTileCache(Context c, String id, int firstLevelSize, int tileSize) {
Log.d(TAG, "createExternalStorageTileCache firstLevelSize=" + firstLevelSize);
TileCache firstLevelTileCache = new InMemoryTileCache(firstLevelSize);
if (storage != null) { // storage will be null if full
String cacheDirectoryName = storage.getAbsolutePath() + File.separator + id;
File cacheDirectory = new File(cacheDirectoryName);
if (cacheDirectory.exists() || cacheDirectory.mkdirs()) {
int tileCacheFiles = estimateSizeOfFileSystemCache(cacheDirectoryName, firstLevelSize, tileSize);
if (cacheDirectory.canWrite() && tileCacheFiles > 0) {
try {
Log.d(TAG, "createExternalStorageTileCache tileCacheFiles=" + tileCacheFiles);
TileCache secondLevelTileCache = new FileSystemTileCache(tileCacheFiles,
cacheDirectory, AndroidGraphicFactory.INSTANCE, true, 25, true);
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
} catch (IllegalArgumentException e) {
Log.w(TAG, "createExternalStorageTileCache e=" + e);
}
}
}
else {
Log.w(TAG, "createExternalStorageTileCache can't");
}
}
return firstLevelTileCache;
}
示例2: getTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
private synchronized TileCache getTileCache(String themeName) {
if (TILE_CACHE_TABLE.containsKey(themeName)) {
return TILE_CACHE_TABLE.get(themeName);
} else {
File cacheDir = new File(SAVE_PATH, themeName);
TileCache tileCache = new FileSystemTileCache(CACHE_CAPACITY, cacheDir, GRAPHIC_FACTORY, false);
TILE_CACHE_TABLE.put(themeName, tileCache);
return tileCache;
}
}
示例3: createExternalStorageTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
/**
* @param c
* the Android context
* @param id
* name for the directory
* @return a new cache created on the external storage
*/
@Deprecated
public static TileCache createExternalStorageTileCache(final Context c, final String id) {
final TileCache firstLevelTileCache = new InMemoryTileCache(32);
final String cacheDirectoryName = c.getExternalCacheDir().getAbsolutePath() + File.separator + id;
final File cacheDirectory = new File(cacheDirectoryName);
if (!cacheDirectory.exists()) {
cacheDirectory.mkdir();
}
final TileCache secondLevelTileCache = new FileSystemTileCache(1024, cacheDirectory, AndroidGraphicFactory.INSTANCE);
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
}
示例4: createTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
private TileCache createTileCache(int index) {
TileCache firstLevelTileCache = new InMemoryTileCache(128);
File cacheDirectory = new File(System.getProperty("java.io.tmpdir"),
"mapsforge" + index);
TileCache secondLevelTileCache = new FileSystemTileCache(1024,
cacheDirectory, GRAPHIC_FACTORY);
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
}
示例5: LayerBase
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
LayerBase(Tabulae activity, MapView mapView, boolean persistant) {
this.mapView = mapView;
if (persistant) {
int size = AndroidUtil.getMinimumCacheSize(activity, mapView.getModel().displayModel.getTileSize(), mapView.getModel().frameBufferModel.getOverdrawFactor(), 1f);
//if (DEBUG) Log.d(TAG, "LayerBase.LayerBase minmal cache size=" + size);
memCache = new InMemoryTileCache(size);
tileCache = new TwoLevelTileCache(
memCache,
new FileSystemTileCache(99999, new File(activity.getTilesDir(), getId()), AndroidGraphicFactory.INSTANCE, true)
);
} else {
tileCache = AndroidUtil.createTileCache(activity, getId(), mapView.getModel().displayModel.getTileSize(),
1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
}
示例6: createExternalStorageTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
/**
* @param c
* the Android context
* @param id
* name for the directory
* @return a new cache created on the external storage
*/
static TileCache createExternalStorageTileCache(Context c, String id) {
TileCache firstLevelTileCache = new InMemoryTileCache(32);
String cacheDirectoryName = c.getExternalCacheDir().getAbsolutePath() + File.separator + id;
File cacheDirectory = new File(cacheDirectoryName);
if (!cacheDirectory.exists()) {
cacheDirectory.mkdir();
}
TileCache secondLevelTileCache = new FileSystemTileCache(1024, cacheDirectory, AndroidGraphicFactory.INSTANCE);
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
}
示例7: createTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
/**
* @param c
* the Android context
* @return a new cache
*/
static TileCache createTileCache(Context c, String id) {
TileCache firstLevelTileCache = new InMemoryTileCache(32);
File cacheDirectory = c.getDir(id, Context.MODE_PRIVATE);
TileCache secondLevelTileCache = new FileSystemTileCache(1024, cacheDirectory, AndroidGraphicFactory.INSTANCE);
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
}
示例8: createTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
private TileCache createTileCache(Activity activity, String name) {
String cacheDirectoryName = activity.getExternalCacheDir().getAbsolutePath() + File.separator + name;
File cacheDirectory = new File(cacheDirectoryName);
if (!cacheDirectory.exists()) {
cacheDirectory.mkdir();
}
return new FileSystemTileCache(1024, cacheDirectory, mGraphicFactory);
}
示例9: createTileCache
import org.mapsforge.map.layer.cache.FileSystemTileCache; //导入依赖的package包/类
private static TileCache createTileCache() {
TileCache firstLevelTileCache = new InMemoryTileCache(64);
java.io.File cacheDirectory = new java.io.File(System.getProperty("java.io.tmpdir"), "mapsforge");
TileCache secondLevelTileCache = new FileSystemTileCache(1024, cacheDirectory, GRAPHIC_FACTORY);
return new TwoLevelTileCache(firstLevelTileCache, secondLevelTileCache);
}