當前位置: 首頁>>代碼示例>>Java>>正文


Java TileOverlayOptions類代碼示例

本文整理匯總了Java中com.google.android.gms.maps.model.TileOverlayOptions的典型用法代碼示例。如果您正苦於以下問題:Java TileOverlayOptions類的具體用法?Java TileOverlayOptions怎麽用?Java TileOverlayOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TileOverlayOptions類屬於com.google.android.gms.maps.model包,在下文中一共展示了TileOverlayOptions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addTileProvider

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的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.TileOverlayOptions; //導入依賴的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: setMapFile

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的package包/類
public static void setMapFile(MapsActivity context) {
    MapsForgeTilesProvider provider;
    try {
         provider = new MapsForgeTilesProvider(
                 context.getApplication(), new File(mapFile), new File(themeFile));
    } catch (Exception e) {
        mapFile = null;
        e.printStackTrace();
        Toast.makeText(context, "無法開啟檔案", Toast.LENGTH_SHORT).show();
        return;
    }

    TileOverlay lastTile = context.getMapsManager().getCurrentMapTile();
    if (lastTile != null)
        lastTile.remove();

    MapsManager manager = context.getMapsManager();
    manager.setCurrentMapTile(manager.getCurrentMap().addTileOverlay(
            new TileOverlayOptions().tileProvider(provider)));
    manager.getCurrentMapTile().setZIndex(ZINDEX_BASEMAP);
    manager.getCurrentMap().setMapType(GoogleMap.MAP_TYPE_NONE);
}
 
開發者ID:typebrook,項目名稱:FiveMinsMore,代碼行數:23,代碼來源:TileUtils.java

示例4: onTilesLoaded

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的package包/類
private void onTilesLoaded(List<TileLoadingTask.TileEntry> list) {
    if (list != null) {
        // Display tiles if they have been loaded, skip them otherwise but display the rest of
        // the map.
        for (TileLoadingTask.TileEntry entry : list) {
            TileOverlayOptions tileOverlay = new TileOverlayOptions()
                    .tileProvider(entry.provider).visible(false);

            // Store the tile overlay and provider
            mTileProviders.put(entry.floor, entry.provider);
            mTileOverlays.put(entry.floor, mMap.addTileOverlay(tileOverlay));
        }
    }

    enableMapElements();
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:17,代碼來源:MapFragment.java

示例5: addXYZDirectoryCacheOverlay

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的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

示例6: addTileProvider

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的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

示例7: addTileOverlay

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的package包/類
public final TileOverlay addTileOverlay(TileOverlayOptions paramTileOverlayOptions)
{
  try
  {
    f localf = this.Br.addTileOverlay(paramTileOverlayOptions);
    if (localf != null)
    {
      TileOverlay localTileOverlay = new TileOverlay(localf);
      return localTileOverlay;
    }
    return null;
  }
  catch (RemoteException localRemoteException)
  {
    throw new RuntimeRemoteException(localRemoteException);
  }
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:18,代碼來源:GoogleMap.java

示例8: setUpMap

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的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

示例9: setUpMap

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的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

示例10: addTileOverlay

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的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

示例11: setMapTile

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的package包/類
/**
 * Sets which map tile to use
 * 
 * @param context
 *            The calling Activity
 * @param map
 *            The GoogleMap
 */
public static void setMapTile(Context context, GoogleMap map) {
	// load preferences
	Preferences.loadSettings(context);
	TileOverlayOptions osm = new TileOverlayOptions()
			.tileProvider(new OpenStreetMapTileProvider());

	TileOverlayOptions mapbox = new TileOverlayOptions()
			.tileProvider(new MapBoxTileProvider());

	final String mapTile = Preferences.mapTiles;
	if (map != null) {
		map.setMapType(GoogleMap.MAP_TYPE_NONE);
		map.addTileOverlay(osm).remove();
		map.addTileOverlay(mapbox).remove();
		map.clear();
		if (mapTile.equals("google")) {
			map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
		} else if (mapTile.equals("osm")) {
			map.addTileOverlay(osm);
		} else {
			map.addTileOverlay(mapbox);
		}
	}
}
 
開發者ID:ais-albania,項目名稱:ZalartAndroid,代碼行數:33,代碼來源:Util.java

示例12: addTileProvider

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的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

示例13: setUpMap

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的package包/類
/**
 * Will overlay the current {@link GoogleMap} with tiles for PUBG.
 */
private void setUpMap() {
    final TileOverlayOptions overlayOptions = new TileOverlayOptions();
    overlayOptions.tileProvider(new PUBGTileProvider());
    this.googleMap.setMaxZoomPreference(5);
    this.googleMap.setMapType(GoogleMap.MAP_TYPE_NONE);
    this.googleMap.addTileOverlay(overlayOptions);
    this.googleMap.getUiSettings().setMapToolbarEnabled(false);
}
 
開發者ID:ZafraniTechLLC,項目名稱:Companion-For-PUBG-Android,代碼行數:12,代碼來源:GoogleMapControllerImpl.java

示例14: pickAdditionalTile

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的package包/類
public static void pickAdditionalTile(final Context context) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("選擇疊加圖層")
            .setItems(ADDITION_TILES, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    MapsManager manager = ((MapsActivity) context).getMapsManager();
                    GoogleMap map = manager.getCurrentMap();
                    switch (which) {
                        case 1:
                            manager.addMapAddTiles(map.addTileOverlay(
                                    new TileOverlayOptions().tileProvider(
                                            new CoorTileProvider(context, Color.BLACK))));
                            break;

                        case 2:
                            manager.addMapAddTiles(map.addTileOverlay(
                                    new TileOverlayOptions().tileProvider(
                                            new CoorTileProvider(context, Color.WHITE))));
                            break;

                        case 4:
                            manager.clearCurrentMapAddTiles();
                            break;

                        default:
                            TileOverlay tileOverlay = map.addTileOverlay(
                                    getTileSetting(URL_ADDITIONAL_TILES[which].toString()));
                            tileOverlay.setZIndex(ZINDEX_ADDTILE);
                            manager.addMapAddTiles(tileOverlay);
                    }
                }
            });
    builder.show();
}
 
開發者ID:typebrook,項目名稱:FiveMinsMore,代碼行數:36,代碼來源:TileUtils.java

示例15: createTileOverlayOptions

import com.google.android.gms.maps.model.TileOverlayOptions; //導入依賴的package包/類
/**
 * Creates a new TileOverlayOptions object to be used with {@link com.google.android.gms.maps.GoogleMap#addTileOverlay(TileOverlayOptions) map.addTileOverlay()}
 * @return a TileOverlayOptions with this object set as a tile provider plus fadeIn set to false
 */
public TileOverlayOptions createTileOverlayOptions() {
    TileOverlayOptions tileOverlayOptions = new TileOverlayOptions().tileProvider(this);

    // set fadeIn to false for all GMS versions that support it
    try {
        Class.forName("com.google.android.gms.maps.model.TileOverlayOptions")
                .getMethod("fadeIn", boolean.class)
                .invoke(tileOverlayOptions, false);
    } catch (Exception e) {
    }

    return tileOverlayOptions;
}
 
開發者ID:Ubudu,項目名稱:GoogleMapsLayout-Android,代碼行數:18,代碼來源:CachingUrlTileProvider.java


注:本文中的com.google.android.gms.maps.model.TileOverlayOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。