com.google.android.gms.maps.model.TileProvider Java Examples
The following examples show how to use
com.google.android.gms.maps.model.TileProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapFragment.java From mage-android with Apache License 2.0 | 6 votes |
/** * 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); }
Example #2
Source File: MapFragment.java From mage-android with Apache License 2.0 | 5 votes |
private void addURLCacheOverlay(Map<String, CacheOverlay> enabledCacheOverlays, URLCacheOverlay urlCacheOverlay){ // Retrieve the cache overlay if it already exists (and remove from cache overlays) CacheOverlay cacheOverlay = cacheOverlays.remove(urlCacheOverlay.getCacheName()); if(cacheOverlay == null){ // Create a new tile provider and add to the map TileProvider tileProvider = null; boolean isTransparent = false; if(urlCacheOverlay.getFormat().equalsIgnoreCase("xyz")) { tileProvider = new XYZTileProvider(256, 256, urlCacheOverlay); }else if(urlCacheOverlay.getFormat().equalsIgnoreCase("tms")){ tileProvider = new TMSTileProvider(256, 256, urlCacheOverlay); }else { tileProvider = new WMSTileProvider(256, 256, urlCacheOverlay); WMSCacheOverlay wms = (WMSCacheOverlay)urlCacheOverlay; isTransparent = Boolean.parseBoolean(wms.getWmsTransparent()); } TileOverlayOptions overlayOptions = createTileOverlayOptions(tileProvider); if(urlCacheOverlay.isBase()) { overlayOptions.zIndex(-4); } else if(!isTransparent) { overlayOptions.zIndex(-3); } else{ overlayOptions.zIndex(-2); } // Set the tile overlay in the cache overlay TileOverlay tileOverlay = map.addTileOverlay(overlayOptions); urlCacheOverlay.setTileOverlay(tileOverlay); cacheOverlay = urlCacheOverlay; } // Add the cache overlay to the enabled cache overlays enabledCacheOverlays.put(cacheOverlay.getCacheName(), cacheOverlay); }
Example #3
Source File: MapFragment.java From mage-android with Apache License 2.0 | 5 votes |
/** * 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; }
Example #4
Source File: TileCoordinateDemoActivity.java From android-samples with Apache License 2.0 | 4 votes |
@Override public void onMapReady(GoogleMap map) { TileProvider coordTileProvider = new CoordTileProvider(this.getApplicationContext()); map.addTileOverlay(new TileOverlayOptions().tileProvider(coordTileProvider)); }
Example #5
Source File: GeoPackageOverlayFactory.java From geopackage-android-map with MIT License | 2 votes |
/** * Get a Tile Provider for the Tile DAO * * @param tileDao tile dao * @return tile provider */ public static TileProvider getTileProvider(TileDao tileDao) { return getBoundedOverlay(tileDao); }
Example #6
Source File: GeoPackageOverlayFactory.java From geopackage-android-map with MIT License | 2 votes |
/** * Get a Tile Provider for the Tile DAO with the tile creator options * * @param tileDao tile dao * @param scaling tile scaling options * @return tile provider * @since 2.0.2 */ public static TileProvider getTileProvider(TileDao tileDao, TileScaling scaling) { return getBoundedOverlay(tileDao, scaling); }
Example #7
Source File: MapFragment.java From mage-android with Apache License 2.0 | 2 votes |
/** * Create Feature Tile Overlay Options with the default z index for tile layers drawn from features * @param tileProvider * @return */ private TileOverlayOptions createFeatureTileOverlayOptions(TileProvider tileProvider){ return createTileOverlayOptions(tileProvider, -1); }
Example #8
Source File: MapFragment.java From mage-android with Apache License 2.0 | 2 votes |
/** * Create Tile Overlay Options with the default z index for tile layers * @param tileProvider * @return */ private TileOverlayOptions createTileOverlayOptions(TileProvider tileProvider){ return createTileOverlayOptions(tileProvider, -2); }