本文整理汇总了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));
}
示例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);
}
示例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();
}
示例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);
}
示例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));
}
示例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);
}
}
示例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));
}
示例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));
}
示例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);
}
}
}));
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}