当前位置: 首页>>代码示例>>Java>>正文


Java OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION属性代码示例

本文整理汇总了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;
}
 
开发者ID:microg,项目名称:android_frameworks_mapsv1,代码行数:31,代码来源:SafeTileWriter.java

示例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;
}
 
开发者ID:jeffallen,项目名称:MarshrutMe,代码行数:5,代码来源:CacheManager.java

示例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;
}
 
开发者ID:microg,项目名称:android_frameworks_mapsv1,代码行数:50,代码来源:SafeMapTileFilesystemProvider.java

示例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;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:5,代码来源:CacheManager.java

示例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);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:11,代码来源:TileWriter.java


注:本文中的org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants.TILE_PATH_EXTENSION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。