本文整理汇总了Java中org.osmdroid.tileprovider.MapTileRequestState.getMapTile方法的典型用法代码示例。如果您正苦于以下问题:Java MapTileRequestState.getMapTile方法的具体用法?Java MapTileRequestState.getMapTile怎么用?Java MapTileRequestState.getMapTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osmdroid.tileprovider.MapTileRequestState
的用法示例。
在下文中一共展示了MapTileRequestState.getMapTile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawMapsforgeTile
import org.osmdroid.tileprovider.MapTileRequestState; //导入方法依赖的package包/类
private Drawable drawMapsforgeTile(final MapTileRequestState aState) {
if (tileSource_ == null) return null;
try {
final MapTile tile = aState.getMapTile();
return tileSource_.getDrawable(tile.getX(), tile.getY(), tile.getZoomLevel());
} catch (Exception e) {
return null;
}
}
示例2: drawMapsforgeTile
import org.osmdroid.tileprovider.MapTileRequestState; //导入方法依赖的package包/类
private Drawable drawMapsforgeTile(final MapTileRequestState aState)
{
if(tileSource_ == null)
return null;
try {
final MapTile tile = aState.getMapTile();
return tileSource_.getDrawable(tile.getX(), tile.getY(), tile.getZoomLevel());
}
catch(Exception e) {
return null;
}
}
示例3: mapTileRequestFailed
import org.osmdroid.tileprovider.MapTileRequestState; //导入方法依赖的package包/类
@Override
public void mapTileRequestFailed(final MapTileRequestState pState) {
final MapTileModuleProviderBase nextProvider = findNextAppropriateProvider(pState);
if (nextProvider != null) {
nextProvider.loadMapTileAsync(pState);
} else {
final MapTile tile = pState.getMapTile();
// synchronized (mWorking) {
mWorking.remove(tile);
// }
super.mapTileRequestFailed(pState);
}
}
示例4: loadTile
import org.osmdroid.tileprovider.MapTileRequestState; //导入方法依赖的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;
}
示例5: loadTile
import org.osmdroid.tileprovider.MapTileRequestState; //导入方法依赖的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;
}