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


Java IRegisterReceiver类代码示例

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


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

示例1: testSetNullTileSource

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
@Test
public void testSetNullTileSource() {
    NicTileSource tileSource = mock(NicTileSource.class);

    // Only required by the super-constructor:
    IRegisterReceiver registerReceiver = mock(IRegisterReceiver.class);

    AssetTileProvider atp = new AssetTileProvider(registerReceiver, tileSource, null);

    try {
        atp.setTileSource(null);
        fail("tileSource == null should throw an exception. We don't want NPE later on.");
    } catch (IllegalArgumentException ex) {
        // Fine!
    }
}
 
开发者ID:tarent,项目名称:invio,代码行数:17,代码来源:AssetTileProviderTest.java

示例2: testSetTileSource

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
@Test
public void testSetTileSource() {
    NicTileSource oldTileSource = mock(NicTileSource.class);
    when(oldTileSource.getMaximumZoomLevel()).thenReturn(7);

    NicTileSource newTileSource = mock(NicTileSource.class);
    when(newTileSource.getMaximumZoomLevel()).thenReturn(42);

    // Only required by the super-constructor:
    IRegisterReceiver registerReceiver = mock(IRegisterReceiver.class);

    AssetTileProvider atp = new AssetTileProvider(registerReceiver, oldTileSource, null);
    assertEquals(atp.getMaximumZoomLevel(), 7);

    atp.setTileSource(newTileSource);
    assertEquals(atp.getMaximumZoomLevel(), 42);
}
 
开发者ID:tarent,项目名称:invio,代码行数:18,代码来源:AssetTileProviderTest.java

示例3: CycleMapTileProvider

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
private CycleMapTileProvider(final Context context,
                             final ITileSource tileSource,
                             final IRegisterReceiver registerReceiver) {
  super(tileSource, registerReceiver);

  final MapTileFilesystemProvider fileSystemProvider =
      new MapTileFilesystemProvider(registerReceiver, tileSource);
  mTileProviderList.add(fileSystemProvider);

  final NetworkAvailabliltyCheck networkCheck = new NetworkAvailabliltyCheck(context);

  final MapTileDownloader downloaderProvider =
      new MapTileDownloader(tileSource,
          new TileWriter(),
          networkCheck);
  mTileProviderList.add(downloaderProvider);

  final MapsforgeOSMDroidTileProvider mapsforgeProvider =
      new MapsforgeOSMDroidTileProvider(tileSource, networkCheck);
  mTileProviderList.add(mapsforgeProvider);
}
 
开发者ID:MobileAppCodes,项目名称:CycleStreets-Android-app-,代码行数:22,代码来源:TileSource.java

示例4: MapTileFileArchiveProvider

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
/**
 *
 * @since 6.0.0
 * @param pRegisterReceiver
 * @param pTileSource
 * @param pArchives
 * @param ignoreTileSource if true, tile source is ignored
 */
public MapTileFileArchiveProvider(final IRegisterReceiver pRegisterReceiver,
								  final ITileSource pTileSource, final IArchiveFile[] pArchives, final boolean ignoreTileSource) {
	super(pRegisterReceiver,
		Configuration.getInstance().getTileFileSystemThreads(),
		Configuration.getInstance().getTileFileSystemMaxQueueSize());

	this.ignoreTileSource=ignoreTileSource;
	setTileSource(pTileSource);

	if (pArchives == null) {
		mSpecificArchivesProvided = false;
		findArchiveFiles();
	} else {
		mSpecificArchivesProvided = true;
		for (int i = pArchives.length - 1; i >= 0; i--) {
			mArchiveFiles.add(pArchives[i]);
		}
	}

}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:29,代码来源:MapTileFileArchiveProvider.java

示例5: OfflineTileProvider

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
/**
 * Creates a {@link MapTileProviderBasic}.
 * throws with the source[] is null or empty
 */
public OfflineTileProvider(final IRegisterReceiver pRegisterReceiver, File[] source
)
	throws Exception {
	super(FileBasedTileSource.getSource(source[0].getName()), pRegisterReceiver);
	List<IArchiveFile> files = new ArrayList<IArchiveFile>();

	for (int i=0; i < source.length; i++){
		IArchiveFile temp=ArchiveFileFactory.getArchiveFile(source[i]);
		if (temp!=null)
			files.add(temp);
		else{
			Log.w(IMapView.LOGTAG, "Skipping " + source[i] + ", no tile provider is registered to handle the file extension");
		}
	}
	archives = new IArchiveFile[files.size()];
	archives=files.toArray(archives);
	final MapTileFileArchiveProvider mapTileFileArchiveProvider = new MapTileFileArchiveProvider(pRegisterReceiver, getTileSource(), archives);
	mTileProviderList.add(mapTileFileArchiveProvider);

	final MapTileApproximater approximationProvider = new MapTileApproximater();
	mTileProviderList.add(approximationProvider);
	approximationProvider.addProvider(mapTileFileArchiveProvider);

}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:29,代码来源:OfflineTileProvider.java

示例6: buildAssetTileProvider

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

示例7: buildWebTileProvider

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

示例8: AssetTileProvider

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
/**
 * Custom constructor
 *
 * @param registerReceiver the {@link IRegisterReceiver}
 * @param tileSource       the {@link NicTileSource}
 * @param assetManager     the {@link AssetManager}
 */
public AssetTileProvider(final IRegisterReceiver registerReceiver, final NicTileSource tileSource,
                         AssetManager assetManager) {
    super(registerReceiver, NUMBER_OF_TILE_FILESYSTEM_THREADS, TILE_FILESYSTEM_MAXIMUM_QUEUE_SIZE);

    setTileSource(tileSource);
    this.assetManager = assetManager;
}
 
开发者ID:tarent,项目名称:invio,代码行数:15,代码来源:AssetTileProvider.java

示例9: testZoomLevels

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
@Test
public void testZoomLevels() {
    NicTileSource tileSource = mock(NicTileSource.class);
    when(tileSource.getMaximumZoomLevel()).thenReturn(10);
    when(tileSource.getMinimumZoomLevel()).thenReturn(0);

    // Only required by the super-constructor:
    IRegisterReceiver registerReceiver = mock(IRegisterReceiver.class);

    AssetTileProvider atp = new AssetTileProvider(registerReceiver, tileSource, null);

    assertEquals(atp.getMaximumZoomLevel(), 10);
    assertEquals(atp.getMinimumZoomLevel(), 0);
}
 
开发者ID:tarent,项目名称:invio,代码行数:15,代码来源:AssetTileProviderTest.java

示例10: testSetNullTileSourceInConstructor

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testSetNullTileSourceInConstructor() {
    // Only required by the super-constructor:
    IRegisterReceiver registerReceiver = mock(IRegisterReceiver.class);

    AssetTileProvider atp = new AssetTileProvider(registerReceiver, null, null);
}
 
开发者ID:tarent,项目名称:invio,代码行数:8,代码来源:AssetTileProviderTest.java

示例11: testSetWrongTileSource

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testSetWrongTileSource() {
    // Only required by the super-constructor:
    IRegisterReceiver registerReceiver = mock(IRegisterReceiver.class);

    NicTileSource goodTileSource = mock(NicTileSource.class);
    ITileSource badTileSource = mock(ITileSource.class);

    AssetTileProvider atp = new AssetTileProvider(registerReceiver, goodTileSource, null);
    atp.setTileSource(badTileSource);
}
 
开发者ID:tarent,项目名称:invio,代码行数:12,代码来源:AssetTileProviderTest.java

示例12: SafeMapTileFilesystemProvider

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
/**
 * Provides a file system based cache tile provider. Other providers can register and store data
 * in the cache.
 *
 * @param pRegisterReceiver
 */
public SafeMapTileFilesystemProvider(Context context, final IRegisterReceiver pRegisterReceiver,
									 final ITileSource pTileSource, final long pMaximumCachedFileAge, int pThreadPoolSize,
									 int pPendingQueueSize) {
	super(pRegisterReceiver, pThreadPoolSize, pPendingQueueSize);
	if (context.checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
		safeTilePathBase = OpenStreetMapTileProviderConstants.TILE_PATH_BASE;
	} else {
		safeTilePathBase = new File(context.getExternalCacheDir(), "tiles");
	}
	setTileSource(pTileSource);

	mMaximumCachedFileAge = pMaximumCachedFileAge;
}
 
开发者ID:microg,项目名称:android_frameworks_mapsv1,代码行数:20,代码来源:SafeMapTileFilesystemProvider.java

示例13: SafeMapTileProviderBasic

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
/**
 * Creates a {@link SafeMapTileProviderBasic}.
 */
public SafeMapTileProviderBasic(Context context, final IRegisterReceiver pRegisterReceiver,
                                final INetworkAvailablityCheck aNetworkAvailablityCheck, final ITileSource pTileSource) {
	super(pTileSource, pRegisterReceiver);

	final SafeTileWriter tileWriter = new SafeTileWriter(context);

	final SafeMapTileFilesystemProvider fileSystemProvider = new SafeMapTileFilesystemProvider(context,
			pRegisterReceiver, pTileSource);
	mTileProviderList.add(fileSystemProvider);

	final MapTileDownloader downloaderProvider = new MapTileDownloader(pTileSource, tileWriter,
			aNetworkAvailablityCheck);
	mTileProviderList.add(downloaderProvider);
}
 
开发者ID:microg,项目名称:android_frameworks_mapsv1,代码行数:18,代码来源:SafeMapTileProviderBasic.java

示例14: MapTileFileStorageProviderBase

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
public MapTileFileStorageProviderBase(final IRegisterReceiver pRegisterReceiver,
		final int pThreadPoolSize, final int pPendingQueueSize) {
	super(pThreadPoolSize, pPendingQueueSize);

	checkSdCard();

	mRegisterReceiver = pRegisterReceiver;
	mBroadcastReceiver = new MyBroadcastReceiver();

	final IntentFilter mediaFilter = new IntentFilter();
	mediaFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
	mediaFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
	mediaFilter.addDataScheme("file");
	pRegisterReceiver.registerReceiver(mBroadcastReceiver, mediaFilter);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:16,代码来源:MapTileFileStorageProviderBase.java

示例15: MapTileAssetsProvider

import org.osmdroid.tileprovider.IRegisterReceiver; //导入依赖的package包/类
public MapTileAssetsProvider(final IRegisterReceiver pRegisterReceiver,
							 final AssetManager pAssets,
							 final ITileSource pTileSource) {
	this(pRegisterReceiver, pAssets, pTileSource,
		Configuration.getInstance().getTileDownloadThreads(),
		Configuration.getInstance().getTileDownloadMaxQueueSize()
			);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:9,代码来源:MapTileAssetsProvider.java


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