Java Code Examples for com.google.android.gms.maps.model.TileOverlayOptions#zIndex()

The following examples show how to use com.google.android.gms.maps.model.TileOverlayOptions#zIndex() . 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 5 votes vote down vote up
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 2
Source File: MapFragment.java    From mage-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}