本文整理汇总了Java中org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION属性的典型用法代码示例。如果您正苦于以下问题:Java OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION属性的具体用法?Java OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION怎么用?Java OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants
的用法示例。
在下文中一共展示了OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveFile
@Override
public boolean saveFile(final ITileSource pTileSource, final MapTile pTile,
final InputStream pStream) {
final File file = new File(safeTilePathBase, pTileSource.getTileRelativeFilenameString(pTile)
+ OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION);
final File parent = file.getParentFile();
if (!parent.exists() && !createFolderAndCheckIfExists(parent)) {
return false;
}
BufferedOutputStream outputStream = null;
try {
outputStream = new BufferedOutputStream(new FileOutputStream(file.getPath()),
StreamUtils.IO_BUFFER_SIZE);
final long length = StreamUtils.copy(pStream, outputStream);
mUsedCacheSpace += length;
if (mUsedCacheSpace > OpenStreetMapTileProviderConstants.TILE_MAX_CACHE_SIZE_BYTES) {
cutCurrentCache(); // TODO perhaps we should do this in the background
}
} catch (final IOException e) {
return false;
} finally {
if (outputStream != null) {
StreamUtils.closeStream(outputStream);
}
}
return true;
}
示例2: getFileName
public File getFileName(ITileSource tileSource, MapTile tile){
final File file = new File(OpenStreetMapTileProviderConstants.TILE_PATH_BASE,
tileSource.getTileRelativeFilenameString(tile) + OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION);
return file;
}
示例3: loadTile
@Override
public Drawable loadTile(final MapTileRequestState pState) throws CantContinueException {
ITileSource tileSource = mTileSource.get();
if (tileSource == null) {
return null;
}
final MapTile tile = pState.getMapTile();
// if there's no sdcard then don't do anything
if (!getSdCardAvailable()) {
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"No sdcard - do nothing for tile: " + tile);
}
return null;
}
// Check the tile source to see if its file is available and if so, then render the
// drawable and return the tile
final File file = new File(safeTilePathBase,
tileSource.getTileRelativeFilenameString(tile) + OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION);
if (file.exists()) {
try {
final Drawable drawable = tileSource.getDrawable(file.getPath());
// Check to see if file has expired
final long now = System.currentTimeMillis();
final long lastModified = file.lastModified();
final boolean fileExpired = lastModified < now - mMaximumCachedFileAge;
if (fileExpired && drawable != null) {
if (OpenStreetMapTileProviderConstants.DEBUGMODE) {
Log.d(IMapView.LOGTAG,"Tile expired: " + tile);
}
ExpirableBitmapDrawable.setDrawableExpired(drawable);
}
return drawable;
} catch (final LowMemoryException e) {
// low memory so empty the queue
Log.w(IMapView.LOGTAG,"LowMemoryException downloading MapTile: " + tile + " : " + e);
throw new CantContinueException(e);
}
}
// If we get here then there is no file in the file cache
return null;
}
示例4: getFileName
public static File getFileName(ITileSource tileSource, MapTile tile) {
final File file = new File(Configuration.getInstance().getOsmdroidTileCache(),
tileSource.getTileRelativeFilenameString(tile) + OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION);
return file;
}
示例5: getFile
/**
*
* @since 5.6.5
* @param pTileSource
* @param pTile
* @return
*/
public File getFile(final ITileSource pTileSource, final MapTile pTile) {
return new File(Configuration.getInstance().getOsmdroidTileCache(), pTileSource.getTileRelativeFilenameString(pTile)
+ OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION);
}