本文整理汇总了Java中org.osmdroid.tileprovider.ExpirableBitmapDrawable类的典型用法代码示例。如果您正苦于以下问题:Java ExpirableBitmapDrawable类的具体用法?Java ExpirableBitmapDrawable怎么用?Java ExpirableBitmapDrawable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpirableBitmapDrawable类属于org.osmdroid.tileprovider包,在下文中一共展示了ExpirableBitmapDrawable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadTile
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
@Override
public Drawable loadTile(final ITileSource pTileSource, final MapTile pTile) throws Exception{
// 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 = getFile(pTileSource, pTile);
if (!file.exists()) {
return null;
}
final Drawable drawable = pTileSource.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 (Configuration.getInstance().isDebugMode()) {
Log.d(IMapView.LOGTAG,"Tile expired: " + pTile);
}
ExpirableBitmapDrawable.setState(drawable, ExpirableBitmapDrawable.EXPIRED);
}
return drawable;
}
开发者ID:osmdroid,项目名称:osmdroid,代码行数:26,代码来源:TileWriter.java
示例2: loadTile
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
@Override
protected Drawable loadTile(MapTileRequestState req) throws CantContinueException {
InputStream inputStream;
try {
final String filePath = tileSource.getTileRelativeFilenameString(req.getMapTile());
inputStream = assetManager.open(filePath);
return new ExpirableBitmapDrawable(BitmapFactory.decodeStream(inputStream));
} catch (final IOException e) {
return null;
}
}
开发者ID:tarent,项目名称:invio,代码行数:13,代码来源:AssetTileProvider.java
示例3: getDrawable
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
public synchronized Drawable getDrawable(int tileX, int tileY, int zoom) throws LowMemoryException
{
if(tileOutOfBounds(tileX, tileY, zoom))
return null;
final Tile tile = new Tile(tileX, tileY, (byte)zoom);
MapGeneratorJob mapGeneratorJob = new MapGeneratorJob(tile,
"ooot",
jobParameters_,
debugSettings_);
final Bitmap tileBitmap = Bitmap.createBitmap(Tile.TILE_SIZE, Tile.TILE_SIZE, Bitmap.Config.RGB_565);
boolean success = mapGenerator_.executeJob(mapGeneratorJob, tileBitmap);
return success ? new ExpirableBitmapDrawable(tileBitmap) : null;
}
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:16,代码来源:MapsforgeOSMTileSource.java
示例4: loadTile
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
@Override
public Drawable loadTile(final MapTile pMapTile) {
final Bitmap bitmap = approximateTileFromLowerZoom(pMapTile);
if (bitmap != null) {
final BitmapDrawable drawable = new BitmapDrawable(bitmap);
ExpirableBitmapDrawable.setState(drawable, ExpirableBitmapDrawable.SCALED);
return drawable;
}
return null;
}
开发者ID:osmdroid,项目名称:osmdroid,代码行数:11,代码来源:MapTileApproximater.java
示例5: tileLoaded
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
/**
* A tile has loaded.
*/
protected void tileLoaded(final MapTileRequestState pState, final Drawable pDrawable) {
if (Configuration.getInstance().isDebugTileProviders()) {
Log.d(IMapView.LOGTAG,"TileLoader.tileLoaded() on provider: " + getName() + " with tile: "
+ pState.getMapTile());
}
removeTileFromQueues(pState.getMapTile());
ExpirableBitmapDrawable.setState(pDrawable, ExpirableBitmapDrawable.UP_TO_DATE);
pState.getCallback().mapTileRequestCompleted(pState, pDrawable);
}
开发者ID:osmdroid,项目名称:osmdroid,代码行数:13,代码来源:MapTileModuleProviderBase.java
示例6: tileLoadedExpired
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
/**
* A tile has loaded but it's expired.
* Return it <b>and</b> send request to next provider.
*/
protected void tileLoadedExpired(final MapTileRequestState pState, final Drawable pDrawable) {
if (Configuration.getInstance().isDebugTileProviders()) {
Log.d(IMapView.LOGTAG,"TileLoader.tileLoadedExpired() on provider: " + getName()
+ " with tile: " + pState.getMapTile());
}
removeTileFromQueues(pState.getMapTile());
ExpirableBitmapDrawable.setState(pDrawable, ExpirableBitmapDrawable.EXPIRED);
pState.getCallback().mapTileRequestExpiredTile(pState, pDrawable);
}
开发者ID:osmdroid,项目名称:osmdroid,代码行数:14,代码来源:MapTileModuleProviderBase.java
示例7: tileLoadedScaled
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
protected void tileLoadedScaled(final MapTileRequestState pState, final Drawable pDrawable) {
if (Configuration.getInstance().isDebugTileProviders()) {
Log.d(IMapView.LOGTAG,"TileLoader.tileLoadedScaled() on provider: " + getName()
+ " with tile: " + pState.getMapTile());
}
removeTileFromQueues(pState.getMapTile());
ExpirableBitmapDrawable.setState(pDrawable, ExpirableBitmapDrawable.SCALED);
pState.getCallback().mapTileRequestExpiredTile(pState, pDrawable);
}
开发者ID:osmdroid,项目名称:osmdroid,代码行数:10,代码来源:MapTileModuleProviderBase.java
示例8: loadTile
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
@Override
public Drawable loadTile(final ITileSource pTileSource, final MapTile pTile) throws Exception{
InputStream inputStream = null;
try {
final long index = getIndex(pTile);
final Cursor cur = getTileCursor(getPrimaryKeyParameters(index, pTileSource), queryColumns);
byte[] bits=null;
long expirationTimestamp=0;
if(cur.getCount() != 0) {
cur.moveToFirst();
bits = cur.getBlob(cur.getColumnIndex(DatabaseFileArchive.COLUMN_TILE));
expirationTimestamp = cur.getLong(cur.getColumnIndex(SqlTileWriter.COLUMN_EXPIRES));
}
cur.close();
if (bits==null) {
if (Configuration.getInstance().isDebugMode()) {
Log.d(IMapView.LOGTAG,"SqlCache - Tile doesn't exist: " +pTileSource.name() + pTile);
}
return null;
}
inputStream = new ByteArrayInputStream(bits);
final Drawable drawable = pTileSource.getDrawable(inputStream);
// Check to see if file has expired
final long now = System.currentTimeMillis();
final boolean fileExpired = expirationTimestamp < now;
if (fileExpired && drawable != null) {
if (Configuration.getInstance().isDebugMode()) {
Log.d(IMapView.LOGTAG,"Tile expired: " + pTileSource.name() +pTile);
}
ExpirableBitmapDrawable.setState(drawable, ExpirableBitmapDrawable.EXPIRED);
}
return drawable;
} finally {
if (inputStream != null) {
StreamUtils.closeStream(inputStream);
}
}
}
开发者ID:osmdroid,项目名称:osmdroid,代码行数:41,代码来源:SqlTileWriter.java
示例9: loadTile
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
@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,代码行数:51,代码来源:SafeMapTileFilesystemProvider.java
示例10: loadTile
import org.osmdroid.tileprovider.ExpirableBitmapDrawable; //导入依赖的package包/类
@Override
public Drawable loadTile(final MapTileRequestState pState) throws CantContinueException {
if (mTileSource == null) {
return null;
}
final MapTile tile = pState.getMapTile();
// if there's no sdcard then don't do anything
if (!getSdCardAvailable()) {
if (DEBUGMODE) {
logger.debug("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(TILE_PATH_BASE, mTileSource.getTileRelativeFilenameString(tile) + TILE_PATH_EXTENSION);
if (file.exists()) {
try {
final Drawable drawable = mTileSource.getDrawable(file.getPath());
// Check to see if file has expired
final long now = System.currentTimeMillis();
final long lastModified = file.lastModified();
boolean fileExpired = lastModified < now - mMaximumCachedFileAge;
if (fileExpired) {
boolean isConTypeMobile = networkAvailablityCheck.getCellularDataNetworkAvailable();
if (isConTypeMobile) {
fileExpired = !isConTypeMobile;
Log.d(TAG, "File Expired with Cellular " + networkAvailablityCheck.getCellularDataNetworkAvailable() + " ==> Expired " + fileExpired);
}
}
if (fileExpired) {
if (DEBUGMODE) {
logger.debug("Tile expired: " + tile);
}
drawable.setState(new int[] { ExpirableBitmapDrawable.EXPIRED });
}
return drawable;
} catch (final LowMemoryException e) {
// low memory so empty the queue
logger.warn("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:gabuzomeu,项目名称:osmLib,代码行数:57,代码来源:MapTileFilesystemProviderTTbox.java
注:本文中的org.osmdroid.tileprovider.ExpirableBitmapDrawable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论