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


Java TileProvider类代码示例

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


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

示例1: addTileProvider

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
void addTileProvider(int floor, File f) {
    if (!f.exists()) {
        return;
    }
    TileProvider provider;
    try {
        SVGTileProvider svgProvider = new SVGTileProvider(f, mDPI);
        if (mTileCache == null) {
            // Use the SVGTileProvider directly as the TileProvider without a cache
            provider = svgProvider;
        } else {
            // Wrap the SVGTileProvider ina a CachedTileProvider for caching on disk
            provider = new CachedTileProvider(Integer.toString(floor), svgProvider, mTileCache);
        }
    } catch (IOException e) {
        LogUtils.LOGD(TAG, "Could not create Tile Provider.");
        return;
    }

    TileOverlayOptions tileOverlay = new TileOverlayOptions()
            .tileProvider(provider).visible(false);

    mTileProviders.put(floor, provider);
    mTileOverlays.put(floor, mMap.addTileOverlay(tileOverlay));
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:26,代码来源:MapFragment.java

示例2: onMapReady

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap map) {
    map.setMapType(GoogleMap.MAP_TYPE_NONE);

    TileProvider tileProvider = new UrlTileProvider(256, 256) {
        @Override
        public synchronized URL getTileUrl(int x, int y, int zoom) {
            // The moon tile coordinate system is reversed.  This is not normal.
            int reversedY = (1 << zoom) - y - 1;
            String s = String.format(Locale.US, MOON_MAP_URL_FORMAT, zoom, y, x);
            URL url = null;
            try {
                url = new URL(s);
            } catch (MalformedURLException e) {
                throw new AssertionError(e);
            }
            return url;
        }
    };

    mMoonTiles = map.addTileOverlay(new TileOverlayOptions().tileProvider(tileProvider));
    mTransparencyBar.setOnSeekBarChangeListener(this);
}
 
开发者ID:ProposalProyekIT2,项目名称:SISTEM-INFORMASI-GEOGRAFIS-LOKASI-RESTORAN-DI-KOTA-BANDUNG-SUB-MODUL-ANDROID-BASE-APPLICATION-,代码行数:24,代码来源:TileOverlayDemoActivity.java

示例3: addXYZDirectoryCacheOverlay

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
/**
 * Add XYZ Directory tile cache overlay
 * @param enabledCacheOverlays
 * @param xyzDirectoryCacheOverlay
 */
private void addXYZDirectoryCacheOverlay(Map<String, CacheOverlay> enabledCacheOverlays, XYZDirectoryCacheOverlay xyzDirectoryCacheOverlay){
	// Retrieve the cache overlay if it already exists (and remove from cache overlays)
	CacheOverlay cacheOverlay = cacheOverlays.remove(xyzDirectoryCacheOverlay.getCacheName());
	if(cacheOverlay == null){
		// Create a new tile provider and add to the map
		TileProvider tileProvider = new FileSystemTileProvider(256, 256, xyzDirectoryCacheOverlay.getDirectory().getAbsolutePath());
		TileOverlayOptions overlayOptions = createTileOverlayOptions(tileProvider);
		// Set the tile overlay in the cache overlay
		TileOverlay tileOverlay = map.addTileOverlay(overlayOptions);
		xyzDirectoryCacheOverlay.setTileOverlay(tileOverlay);
		cacheOverlay = xyzDirectoryCacheOverlay;
	}
	// Add the cache overlay to the enabled cache overlays
	enabledCacheOverlays.put(cacheOverlay.getCacheName(), cacheOverlay);
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:21,代码来源:MapFragment.java

示例4: addTileProvider

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
void addTileProvider(int floor, File f) {
    if (!f.exists()) {
        return;
    }
    TileProvider provider;
    try {
        SVGTileProvider svgProvider = new SVGTileProvider(f, mDPI);
        if (mTileCache == null) {
            // Use the SVGTileProvider directly as the TileProvider without a cache
            provider = svgProvider;
        } else {
            // Wrap the SVGTileProvider ina a CachedTileProvider for caching on disk
            provider = new CachedTileProvider(Integer.toString(floor), svgProvider, mTileCache);
        }
    } catch (IOException e) {
        LOGD(TAG, "Could not create Tile Provider.");
        return;
    }

    TileOverlayOptions tileOverlay = new TileOverlayOptions()
            .tileProvider(provider).visible(false);

    mTileProviders.put(floor, provider);
    mTileOverlays.put(floor, mMap.addTileOverlay(tileOverlay));
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:26,代码来源:MapFragment.java

示例5: setUpMap

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
private void setUpMap() {
    mMap.setMapType(GoogleMap.MAP_TYPE_NONE);

    TileProvider tileProvider = new UrlTileProvider(256, 256) {
        @Override
        public synchronized URL getTileUrl(int x, int y, int zoom) {
            // The moon tile coordinate system is reversed.  This is not normal.
            int reversedY = (1 << zoom) - y - 1;
            String s = String.format(Locale.US, MOON_MAP_URL_FORMAT, zoom, x, reversedY);
            URL url = null;
            try {
                url = new URL(s);
            } catch (MalformedURLException e) {
                throw new AssertionError(e);
            }
            return url;
        }
    };

    mMoonTiles = mMap.addTileOverlay(new TileOverlayOptions().tileProvider(tileProvider));
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:22,代码来源:TileOverlayDemoActivity.java

示例6: getTile

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
@Override
public Tile getTile(int x, int y, int z) {
    // query the provider for a tile specified by x, y and z coordinates
    String[] projection = new String[]{TilesContract.COLUMN_TILE_DATA};
    String selection = TilesContract.COLUMN_ZOOM_LEVEL + " = ? AND "
            + TilesContract.COLUMN_TILE_COLUMN + "= ? AND "
            + TilesContract.COLUMN_TILE_ROW + "= ?";
    String[] selectionArgs = new String[]{String.valueOf(z), String.valueOf(x), String.valueOf((int) (Math.pow(2, z) - y - 1))};
    // .mbtiles database use TSM coordinates
    // we need to switch to Google compatible coordinates
    // https://gist.github.com/tmcw/4954720
    Cursor cursor = mContext.getContentResolver().query(Uri.parse(mContentProviderPath), projection, selection, selectionArgs, null);
    Tile tile = TileProvider.NO_TILE;
    if (cursor.moveToFirst())
        tile = cursorToMapItem(cursor);
    // make sure to close the cursor
    cursor.close();
    return tile;
}
 
开发者ID:tesera,项目名称:andbtiles,代码行数:20,代码来源:MBTilesProvider.java

示例7: setUpMap

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
private void setUpMap() {
    mMap.setMapType(GoogleMap.MAP_TYPE_NONE);

    TileProvider tileProvider = new UrlTileProvider(256, 256) {
        @Override
        public synchronized URL getTileUrl(int x, int y, int zoom) {
            // The moon tile coordinate system is reversed.  This is not normal.
            int reversedY = (1 << zoom) - y - 1;
            String s = String.format(Locale.US, MOON_MAP_URL_FORMAT, zoom, x, reversedY);
            URL url = null;
            try {
                url = new URL(s);
            } catch (MalformedURLException e) {
                throw new AssertionError(e);
            }
            return url;
        }
    };

    mMap.addTileOverlay(new TileOverlayOptions().tileProvider(tileProvider));
}
 
开发者ID:nicolasjafelle,项目名称:GoogleMapsV2Demo,代码行数:22,代码来源:TileOverlayDemoActivity.java

示例8: addTileOverlay

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
/**
 * Add an overlay to the map.
 * 
 * @param id
    *     Map place holder ID.
 * @param jsonTileOverlay
 *     JSON serialized TileOverlay.
 */
@JavascriptInterface
public void addTileOverlay(final String id, final String jsonTileOverlay) {
	final GoogleMap map = getGoogleMapSync(id);
	
	UIThreadExecutor.execute(postponeWhenMapIsInvisible(id, new Runnable() {
		@Override public void run() {
			try {
				TileOverlay tileOverlay = TileOverlay.fromJsonTileOverlay(new JSONObject(jsonTileOverlay));
				
				TileProvider tileProvider = new UrlPatternTileProvider(tileOverlay.tileUrlPattern, tileOverlay.enableGrayscaleFilter);
				com.google.android.gms.maps.model.TileOverlay gTileOverlay = map.addTileOverlay(new TileOverlayOptions()
					.tileProvider(tileProvider)
					.zIndex(tileOverlay.zIndex));
				tileOverlayById.put(tileOverlay.id, gTileOverlay);
			} catch (JSONException e) {
				exceptionListener.onException(false, e);
			}
		}
	}));
}
 
开发者ID:marcplouhinec,项目名称:opentravelmate,代码行数:29,代码来源:NativeMap.java

示例9: clearMap

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
/**
 * Clears the map and initialises all map variables that hold markers and overlays.
 */
private void clearMap() {
    if (mMap != null) {
        mMap.clear();
    }

    // setup tile provider arrays
    mTileProviders = new TileProvider[NUM_FLOORS];
    mTileOverlays = new TileOverlay[NUM_FLOORS];

    mMarkers = new HashMap<String, MarkerModel>();
    mMarkersFloor = new ArrayList<ArrayList<Marker>>();

    // initialise floor marker lists
    for (int i = 0; i < NUM_FLOORS; i++) {
        mMarkersFloor.add(i, new ArrayList<Marker>());
    }
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:21,代码来源:MapFragment.java

示例10: addTileProvider

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
void addTileProvider(int floor, File f) {
    if (!f.exists()) {
        return;
    }

    TileProvider provider;
    try {
        provider = new SVGTileProvider(f, mDPI);
    } catch (IOException e) {
        LOGD(TAG, "Could not create Tile Provider.");
        e.printStackTrace();
        return;
    }
    TileOverlayOptions tileOverlay = new TileOverlayOptions()
            .tileProvider(provider).visible(false);
    mTileProviders[floor] = provider;
    mTileOverlays[floor] = mMap.addTileOverlay(tileOverlay);
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:19,代码来源:MapFragment.java

示例11: getTile

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
@Override
public Tile getTile(int x, int y, int zoom) {
    if (zoom > maxZoomLevel) {
        return TileProvider.NO_TILE;
    }

    final String tileUri = MapboxUtils.getMapTileURL(mapboxId, mapboxAccessToken, zoom, x, y);
    byte[] data = DatabaseState.getOfflineDatabaseHandlerForMapId(context, mapboxId).dataForURL(tileUri);
    if (data == null || data.length == 0)
        return TileProvider.NO_TILE;

    return new Tile(MapboxUtils.TILE_WIDTH, MapboxUtils.TILE_HEIGHT, data);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:14,代码来源:OfflineTileProvider.java

示例12: createTileOverlayOptions

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
/**
 * Create Tile Overlay Options for the Tile Provider using the z index
 * @param tileProvider
 * @param zIndex
 * @return
 */
private TileOverlayOptions createTileOverlayOptions(TileProvider tileProvider, int zIndex){
	TileOverlayOptions overlayOptions = new TileOverlayOptions();
	overlayOptions.tileProvider(tileProvider);
	overlayOptions.zIndex(zIndex);
	return overlayOptions;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:13,代码来源:MapFragment.java

示例13: setUpMap

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
private void setUpMap() {
	TileProvider wmsTileProvider = TileProviderFactory.getOsgeoWmsTileProvider();
    mMap.addTileOverlay(new TileOverlayOptions().tileProvider(wmsTileProvider));

    // Because the demo WMS layer we are using is just a white background map, switch the base layer
    // to satellite so we can see the WMS overlay.
    mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
 
开发者ID:shalperin,项目名称:android-wms,代码行数:9,代码来源:MainActivity.java

示例14: getTileProvider

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
public TileProvider getTileProvider() {
    return real.getTileProvider();
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:4,代码来源:TileOverlayOptions.java

示例15: TileProviderManager

import com.google.android.gms.maps.model.TileProvider; //导入依赖的package包/类
protected TileProviderManager(TileProvider onlineTileProvider, TileProvider offlineTileProvider) {
    this.offlineTileProvider = offlineTileProvider;
    this.onlineTileProvider = onlineTileProvider;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:5,代码来源:TileProviderManager.java


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