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


Java MapTileRequestState.getMapTile方法代码示例

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

示例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;
  }
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:14,代码来源:MapsforgeOSMDroidTileProvider.java

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

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

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


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