• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MapTileModuleProviderBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: addOverlays

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public void addOverlays() {
    this.mMapView.setUseDataConnection(false);
    MapTileAssetsProvider prov = new MapTileAssetsProvider(new SimpleRegisterReceiver(getContext()  ), getActivity().getAssets());

    this.mMapView.setTileProvider(new MapTileProviderArray(TileSourceFactory.MAPNIK, new SimpleRegisterReceiver(getContext()), new MapTileModuleProviderBase[]{ prov }));
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:8,代码来源:SampleAssetsOnly.java


示例17: addOverlays

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

    final ScaleBarOverlay scaleBarOverlay = new ScaleBarOverlay(mMapView);
    scaleBarOverlay.setCentred(true);
    scaleBarOverlay.setScaleBarOffset(200, 10);
    mMapView.getOverlays().add(scaleBarOverlay);

    final ITileSource tileSource = new XYTileSource(
            "Abstract", 0, 29, 256, ".png", new String[]{"http://localhost/"}, "abstract data");
    mMapView.setUseDataConnection(false);

    final MapTileAssetsProvider assetsProvider = new MapTileAssetsProvider(new SimpleRegisterReceiver(getContext()), getActivity().getAssets(), tileSource);

    final MapTileApproximater approximationProvider = new MapTileApproximater();
    approximationProvider.addProvider(assetsProvider);

    final MapTileProviderArray array = new MapTileProviderArray(
            tileSource, new SimpleRegisterReceiver(getContext()),
            new MapTileModuleProviderBase[]{assetsProvider, approximationProvider});

    mMapView.setTileProvider(array);

    mMapView.getController().setZoom(29.);
    // cf. https://fr.wikipedia.org/wiki/Point_z%C3%A9ro_des_routes_de_France
    // In English: starting point of all French roads
    mMapView.setExpectedCenter(new GeoPoint(48.85340215825712, 2.348784611094743));
    mMapView.invalidate();
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:31,代码来源:SampleVeryHighZoomLevel.java


示例18: detach

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的package包/类
@Override
public void detach() {
        for (final MapTileModuleProviderBase tileProvider : mTileProviderList) {
            tileProvider.detach();
        }
    mWorking.clear();
}
 
开发者ID:gabuzomeu,项目名称:osmLib,代码行数:8,代码来源:MapTileProviderArrayTTbox.java


示例19: mapTileRequestFailed

import org.osmdroid.tileprovider.modules.MapTileModuleProviderBase; //导入依赖的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


示例20: getMinimumZoomLevel

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DiskCache类代码示例发布时间:2022-05-21
下一篇:
Java ClosePath类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap