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


Java MapTileModuleProviderBase类代码示例

本文整理汇总了Java中org.osmdroid.tileprovider.modules.MapTileModuleProviderBase的典型用法代码示例。如果您正苦于以下问题:Java MapTileModuleProviderBase类的具体用法?Java MapTileModuleProviderBase怎么用?Java MapTileModuleProviderBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapTileModuleProviderBase类属于org.osmdroid.tileprovider.modules包,在下文中一共展示了MapTileModuleProviderBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setOfflineMap

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
public void setOfflineMap(String mapname) throws FileNotFoundException {
	mFile = new File(Environment.getExternalStorageDirectory(), "/" + mapname);
	
	if (!mFile.exists()) {
		throw new FileNotFoundException();
	}
	
	MapTileModuleProviderBase treasureMapModuleProvider = new MapTileFileArchiveProvider(new SimpleRegisterReceiver(mContext), 
			mTreasureMapTileSource, new IArchiveFile[] { MBTilesFileArchive.getDatabaseFileArchive(mFile) });
	 
	MapTileProviderBase treasureMapProvider = new MapTileProviderArray(mTreasureMapTileSource, null,
			new MapTileModuleProviderBase[] { treasureMapModuleProvider });
	 
	TilesOverlay treasureMapTilesOverlay = new TilesOverlay(treasureMapProvider, mContext);
	treasureMapTilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
	 
	mMap.getOverlays().add(treasureMapTilesOverlay);	
}
 
开发者ID:SteveMcGregor,项目名称:AppQuest,代码行数:19,代码来源:MapManager.java

示例2: detach

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public void detach() {

	synchronized (mTileProviderList) {
		for (final MapTileModuleProviderBase tileProvider : mTileProviderList) {
			tileProvider.detach();

		}
	}

	mTileCache.clear();
	synchronized (mWorking) {
		mWorking.clear();
	}
	clearTileCache();
	if (mRegisterReceiver!=null) {
		mRegisterReceiver.destroy();
		mRegisterReceiver = null;
	}
	super.detach();
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:22,代码来源:MapTileProviderArray.java

示例3: mapTileRequestExpiredTile

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public void mapTileRequestExpiredTile(MapTileRequestState aState, Drawable aDrawable) {
	// Call through to the super first so aState.getCurrentProvider() still contains the proper
	// provider.
	super.mapTileRequestExpiredTile(aState, aDrawable);

	// Continue through the provider chain
	final MapTileModuleProviderBase nextProvider = findNextAppropriateProvider(aState);
	if (nextProvider != null) {
		nextProvider.loadMapTileAsync(aState);
	} else {
		synchronized (mWorking) {
			mWorking.remove(aState.getMapTile());
		}
	}
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:17,代码来源:MapTileProviderArray.java

示例4: findNextAppropriateProvider

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
/**
 * We want to not use a provider that doesn't exist anymore in the chain, and we want to not use
 * a provider that requires a data connection when one is not available.
 */
protected MapTileModuleProviderBase findNextAppropriateProvider(final MapTileRequestState aState) {
	MapTileModuleProviderBase provider = null;
	boolean providerDoesntExist = false, providerCantGetDataConnection = false, providerCantServiceZoomlevel = false;
	// The logic of the while statement is
	// "Keep looping until you get null, or a provider that still exists
	// and has a data connection if it needs one and can service the zoom level,"
	do {
		provider = aState.getNextProvider();
		// Perform some checks to see if we can use this provider
		// If any of these are true, then that disqualifies the provider for this tile request.
		if (provider != null) {
			providerDoesntExist = !this.getProviderExists(provider);
			providerCantGetDataConnection = !useDataConnection()
					&& provider.getUsesDataConnection();
			int zoomLevel = aState.getMapTile().getZoomLevel();
			providerCantServiceZoomlevel = zoomLevel > provider.getMaximumZoomLevel()
					|| zoomLevel < provider.getMinimumZoomLevel();
		}
	} while ((provider != null)
			&& (providerDoesntExist || providerCantGetDataConnection || providerCantServiceZoomlevel));
	return provider;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:27,代码来源:MapTileProviderArray.java

示例5: mapTileRequestExpiredTile

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public void mapTileRequestExpiredTile(MapTileRequestState aState, Drawable aDrawable) {
    // Call through to the super first so aState.getCurrentProvider() still contains the proper
    // provider.
    super.mapTileRequestExpiredTile(aState, aDrawable);

    // Continue through the provider chain
    final MapTileModuleProviderBase nextProvider = findNextAppropriateProvider(aState);
    if (nextProvider != null) {
        nextProvider.loadMapTileAsync(aState);
    } else {
        //synchronized (mWorking) {
            mWorking.remove(aState.getMapTile());
        //}
    }
}
 
开发者ID:gabuzomeu,项目名称:osmLib,代码行数:17,代码来源:MapTileProviderArrayTTbox.java

示例6: findNextAppropriateProvider

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
/**
 * We want to not use a provider that doesn't exist anymore in the chain, and we want to not use
 * a provider that requires a data connection when one is not available.
 */
protected MapTileModuleProviderBase findNextAppropriateProvider(final MapTileRequestState aState) {
    MapTileModuleProviderBase provider = null;
    boolean providerDoesntExist = false, providerCantGetDataConnection = false, providerCantServiceZoomlevel = false;
    // The logic of the while statement is
    // "Keep looping until you get null, or a provider that still exists
    // and has a data connection if it needs one and can service the zoom level,"
    do {
        provider = aState.getNextProvider();
        // Perform some checks to see if we can use this provider
        // If any of these are true, then that disqualifies the provider for this tile request.
        if (provider != null) {
            providerDoesntExist = !this.getProviderExists(provider);
            providerCantGetDataConnection = !useDataConnection()
                    && provider.getUsesDataConnection();
            int zoomLevel = aState.getMapTile().getZoomLevel();
            providerCantServiceZoomlevel = zoomLevel > provider.getMaximumZoomLevel()
                    || zoomLevel < provider.getMinimumZoomLevel();
        }
    } while ((provider != null)
            && (providerDoesntExist || providerCantGetDataConnection || providerCantServiceZoomlevel));
    return provider;
}
 
开发者ID:gabuzomeu,项目名称:osmLib,代码行数:27,代码来源:MapTileProviderArrayTTbox.java

示例7: buildAssetTileProvider

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
/**
 * Build a new TileProvider that looks into the local filesystem for tiles.
 *
 * @param mapName The name of the map which is stored in the assets/&lt;mapName&gt; directory
 * @return the tile provider
 */
public MapTileProviderBase buildAssetTileProvider(final String mapName) {
    final NicTileSource tileSource = getTileSource(mapName);
    final IRegisterReceiver registerReceiver = new SimpleRegisterReceiver(context);
    final AssetTileProvider assetProvider = new AssetTileProvider(
            registerReceiver, tileSource, context.getAssets()
    );

    final MapTileProviderArray mapTileProviderArray = new MapTileProviderArray(tileSource, registerReceiver,
            new MapTileModuleProviderBase[]{
                    //here you can configure more than one provider...
                    assetProvider
            });
    return mapTileProviderArray;
}
 
开发者ID:tarent,项目名称:invio,代码行数:21,代码来源:TileProviderFactory.java

示例8: buildWebTileProvider

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
/**
 * Build a new TileProvider that download the tiles from a server. These tiles
 * will be stored (cached) in the local file system.
 *
 * @param urlSchema the url schema for the map tiles
 * @param mapName   The name of the requested map.
 * @return the tile provider
 */
public MapTileProviderBase buildWebTileProvider(final String urlSchema, final String mapName) {
    final ITileSource tileSource = getNicTileSource(urlSchema, mapName);
    final MapTileDownloader downloaderProvider = getMapTileDownloader(tileSource);
    final IRegisterReceiver registerReceiver = new SimpleRegisterReceiver(context);
    final MapTileFilesystemProvider fileSystemProvider =
            new MapTileFilesystemProvider(registerReceiver, tileSource);
    final MapTileProviderArray mapTileProviderArray = new MapTileProviderArray(tileSource, registerReceiver,
            new MapTileModuleProviderBase[]{
                    fileSystemProvider,    //erst wird der cache verwendet
                    downloaderProvider    //...und wenn es nötig ist im netz
            });
    return mapTileProviderArray;
}
 
开发者ID:tarent,项目名称:invio,代码行数:22,代码来源:TileProviderFactory.java

示例9: MapTileProviderArray

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
/**
 * Creates an {@link MapTileProviderArray} with the specified tile providers.
 *
 * @param aRegisterReceiver
 *            a {@link IRegisterReceiver}
 * @param pTileProviderArray
 *            an array of {@link MapTileModuleProviderBase}
 */
public MapTileProviderArray(final ITileSource pTileSource,
		final IRegisterReceiver aRegisterReceiver,
		final MapTileModuleProviderBase[] pTileProviderArray) {
	super(pTileSource);

	mWorking = new HashMap<MapTile, MapTileRequestState>();
	mRegisterReceiver=aRegisterReceiver;
	mTileProviderList = new ArrayList<MapTileModuleProviderBase>();
	Collections.addAll(mTileProviderList, pTileProviderArray);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:19,代码来源:MapTileProviderArray.java

示例10: getMapTile

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public Drawable getMapTile(final MapTile pTile) {
	final Drawable tile = mTileCache.getMapTile(pTile);
	if (tile != null) {
		if (ExpirableBitmapDrawable.getState(tile) == ExpirableBitmapDrawable.UP_TO_DATE) {
			return tile; // best scenario ever
		}
		if (isDowngradedMode()) {
			return tile; // best we can, considering
		}
	}
	if (mWorking.containsKey(pTile)) { // already in progress
		return tile;
	}

	if (Configuration.getInstance().isDebugTileProviders()) {
		Log.d(IMapView.LOGTAG,"MapTileProviderArray.getMapTile() requested but not in cache, trying from async providers: "
				+ pTile);
	}

	final MapTileRequestState state = new MapTileRequestState(pTile, mTileProviderList, this);

	synchronized (mWorking) {
		// Check again
		if (mWorking.containsKey(pTile)) {
			return tile;
		}
		mWorking.put(pTile, state);
	}

	final MapTileModuleProviderBase provider = findNextAppropriateProvider(state);
	if (provider != null) {
		provider.loadMapTileAsync(state);
	} else {
		mapTileRequestFailed(state);
	}
	return tile;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:39,代码来源:MapTileProviderArray.java

示例11: mapTileRequestFailed

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public void mapTileRequestFailed(final MapTileRequestState aState) {
	final MapTileModuleProviderBase nextProvider = findNextAppropriateProvider(aState);
	if (nextProvider != null) {
		nextProvider.loadMapTileAsync(aState);
	} else {
		synchronized (mWorking) {
			mWorking.remove(aState.getMapTile());
		}
		super.mapTileRequestFailed(aState);
	}
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:13,代码来源:MapTileProviderArray.java

示例12: getMinimumZoomLevel

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public int getMinimumZoomLevel() {
	int result = microsoft.mappoint.TileSystem.getMaximumZoomLevel();
	synchronized (mTileProviderList) {
		for (final MapTileModuleProviderBase tileProvider : mTileProviderList) {
			if (tileProvider.getMinimumZoomLevel() < result) {
				result = tileProvider.getMinimumZoomLevel();
			}
		}
	}
	return result;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:13,代码来源:MapTileProviderArray.java

示例13: getMaximumZoomLevel

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public int getMaximumZoomLevel() {
	int result = OpenStreetMapTileProviderConstants.MINIMUM_ZOOMLEVEL;
	synchronized (mTileProviderList) {
		for (final MapTileModuleProviderBase tileProvider : mTileProviderList) {
			if (tileProvider.getMaximumZoomLevel() > result) {
				result = tileProvider.getMaximumZoomLevel();
			}
		}
	}
	return result;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:13,代码来源:MapTileProviderArray.java

示例14: setTileSource

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public void setTileSource(final ITileSource aTileSource) {
	super.setTileSource(aTileSource);

	synchronized (mTileProviderList) {
		for (final MapTileModuleProviderBase tileProvider : mTileProviderList) {
			tileProvider.setTileSource(aTileSource);
			clearTileCache();
		}
	}
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:12,代码来源:MapTileProviderArray.java

示例15: MapTileRequestState

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
/**
 * @deprecated use {@link MapTileRequestState#MapTileRequestState(MapTile, List, IMapTileProviderCallback)}  instead
 */
@Deprecated
public MapTileRequestState(final MapTile mapTile,
						   final MapTileModuleProviderBase[] providers,
						   final IMapTileProviderCallback callback) {
	mProviderQueue = new ArrayList<>();
	Collections.addAll(mProviderQueue, providers);
	mMapTile = mapTile;
	mCallback = callback;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:13,代码来源:MapTileRequestState.java


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