本文整理匯總了Java中com.google.android.gms.maps.model.TileOverlayOptions.tileProvider方法的典型用法代碼示例。如果您正苦於以下問題:Java TileOverlayOptions.tileProvider方法的具體用法?Java TileOverlayOptions.tileProvider怎麽用?Java TileOverlayOptions.tileProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.maps.model.TileOverlayOptions
的用法示例。
在下文中一共展示了TileOverlayOptions.tileProvider方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: onToggleCoverage
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
public void onToggleCoverage(View v) {
if (mMap == null) {
return;
}
com.github.clans.fab.FloatingActionButton floatingActionButton = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabItemCoverage);
SharedPreferences myPrefs = this.getSharedPreferences(SettingConstants.PREFERENCES, MODE_PRIVATE);
boolean previousState = myPrefs.getBoolean(SettingConstants.COVERAGE, SettingConstants.COVERAGE_DEFAULT);
SharedPreferences.Editor prefsEditor = myPrefs.edit();
prefsEditor.putBoolean(SettingConstants.COVERAGE, !previousState);
prefsEditor.apply();
if (previousState) {
floatingActionButton.setColorNormalResId(R.color.fab_disabled);
floatingActionButton.setColorPressedResId(R.color.fab_disabled_pressed);
clearAndReaddAllToMap();
} else {
floatingActionButton.setColorNormalResId(R.color.fab_green_dark);
floatingActionButton.setColorPressedResId(R.color.fab_green_light);
CoverageTileProvider mTileProvider = new CoverageTileProvider(256, 256, getString(R.string.ttnmapper_tms_url));
TileOverlayOptions options = new TileOverlayOptions();
options.tileProvider(mTileProvider);
options.transparency((float) 0.8);
mMap.addTileOverlay(options);
}
Answers.getInstance().logCustom(new CustomEvent(SettingConstants.COVERAGE)
.putCustomAttribute("on", "" + !previousState));
}
示例3: createTileOverlay
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
/**
* Create tile overlay
*
* @param args
* @param callbackContext
* @throws JSONException
*/
@SuppressWarnings("unused")
private void createTileOverlay(final JSONArray args,
final CallbackContext callbackContext) throws JSONException {
JSONObject opts = args.getJSONObject(1);
int tileSize = opts.getInt("tileSize");
final String tileUrlFormat = opts.getString("tileUrlFormat");
double opacity = 1.0;
if (opts.has("opacity")) {
opacity = opts.getDouble("opacity");
}
PluginTileProvider tileProvider = new PluginTileProvider(tileUrlFormat, opacity, tileSize);
TileOverlayOptions options = new TileOverlayOptions();
options.tileProvider(tileProvider);
if (opts.has("zIndex")) {
options.zIndex((float)opts.getDouble("zIndex"));
}
if (opts.has("visible")) {
options.visible(opts.getBoolean("visible"));
}
TileOverlay tileOverlay = this.map.addTileOverlay(options);
String id = "tile_" + tileOverlay.getId();
this.objects.put(id, tileOverlay);
this.objects.put(id.replace("tile_", "tileProvider_"), tileProvider);
JSONObject result = new JSONObject();
result.put("hashCode", tileOverlay.hashCode());
result.put("id", id);
callbackContext.success(result);
}
示例4: createTileOverlayOptions
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的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;
}
示例5: loadOfflineData
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
private void loadOfflineData(int pos) {
try {
String extPath = Environment.getExternalStorageDirectory().getAbsolutePath();
String filepath = extPath + "/" + CommonFunctions.parentFolderName + "/" + CommonFunctions.dataFolderName
+ "/" + offlineSpatialData.get(pos).getFile_Name();
OfflineTileProvider provider = offlineSpatialData.get(pos).getProvider();
File mbtileFile = new File(filepath);
TileOverlayOptions opts = new TileOverlayOptions();
if (provider == null) {
// Create an instance of OfflineTileProvider.
provider = new OfflineTileProvider(mbtileFile);
offlineSpatialData.get(pos).setProvider(provider);
}
// Set the tile provider on the TileOverlayOptions.
opts.tileProvider(provider);
// Add the tile overlay to the map.
TileOverlay overlay = googleMap.addTileOverlay(opts);
offlineSpatialData.get(pos).setOverlay(overlay);
// Sometime later when the map view is destroyed, close the provider.
// This is important to prevent a leak of the backing SQLiteDatabase.
provider.close();
} catch (Exception e) {
cf.appLog("", e);
//String msg = getResources().getString(R.string.unableToLoadOfflineData);
//Toast.makeText(context,msg+": "+offlineSpatialData.get(pos).getAlias(), Toast.LENGTH_SHORT).show();
}
}
示例6: loadOfflineData
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
private void loadOfflineData(int pos) {
try {
String extPath = Environment.getExternalStorageDirectory().getAbsolutePath();
String filepath = extPath + "/" + CommonFunctions.parentFolderName + "/" + CommonFunctions.dataFolderName
+ "/" + offlineSpatialData.get(pos).getFile_Name();
OfflineTileProvider provider = offlineSpatialData.get(pos).getProvider();
File mbtileFile = new File(filepath);
TileOverlayOptions opts = new TileOverlayOptions();
if (provider == null) {
// Create an instance of OfflineTileProvider.
provider = new OfflineTileProvider(mbtileFile);
offlineSpatialData.get(pos).setProvider(provider);
}
// Set the tile provider on the TileOverlayOptions.
opts.tileProvider(provider);
// Add the tile overlay to the map.
TileOverlay overlay = googleMap.addTileOverlay(opts);
offlineSpatialData.get(pos).setOverlay(overlay);
// Sometime later when the map view is destroyed, close the provider.
// This is important to prevent a leak of the backing SQLiteDatabase.
provider.close();
} catch (Exception e) {
cf.appLog("", e);
String msg = getResources().getString(R.string.unableToLoadOfflineData);
Toast.makeText(context, msg + ": " + offlineSpatialData.get(pos).getAlias(), Toast.LENGTH_SHORT).show();
}
}
示例7: MapController
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
public MapController(GoogleMap map, Activity parent) {
this.googleMap = map;
this.parentActivity = parent;
this.googleMap.setMapType(GoogleMap.MAP_TYPE_NONE);
TileOverlayOptions tileOverlayOptions = new TileOverlayOptions();
tileOverlayOptions.tileProvider(new FloorTileProvider("FloorPlan"));
this.floorPlanOverlay = map.addTileOverlay(tileOverlayOptions);
}
示例8: clearAndReaddAllToMap
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
public void clearAndReaddAllToMap() {
MyApplication mApplication = (MyApplication) getApplicationContext();
SharedPreferences myPrefs = this.getSharedPreferences(SettingConstants.PREFERENCES, MODE_PRIVATE);
if (mMap == null) {
return;
}
mMap.clear();
gatewaysWithMarkers.clear();
markersOnMap.clear();
if (mApplication.packets != null) {
//do not use an iterator as it causes a ConcurrentModificationException when the array list is modified in another thread
//the latest added packet might not be drawn
for (int i = 0; i < mApplication.packets.size(); i++) {
Packet packet = mApplication.packets.get(i);
//we had an exception where packet was a null object
if (packet == null) {
continue;
}
addMeasurementMarker(packet);
if (myPrefs.getBoolean(SettingConstants.LORDRIVE, SettingConstants.LORDRIVE_DEFAULT)) {
addMeasurementLine(packet);
addGateway(packet);
}
}
//update counters after adding a packet
TextView tv = (TextView) findViewById(R.id.textViewCounters);
if (gatewaysWithMarkers.isEmpty()) {
tv.setText(mApplication.packets.size() + " packets");
} else {
tv.setText(mApplication.packets.size() + " packets\n" +
gatewaysWithMarkers.size() + " gateways");
}
}
if (myPrefs.getBoolean(SettingConstants.COVERAGE, SettingConstants.COVERAGE_DEFAULT)) {
CoverageTileProvider mTileProvider = new CoverageTileProvider(256, 256, getString(R.string.ttnmapper_tms_url));
TileOverlayOptions options = new TileOverlayOptions();
options.tileProvider(mTileProvider);
options.transparency((float) 0.8);
mMap.addTileOverlay(options);
}
}
示例9: onCreate
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.nearbymapview);
t1 = (TextView) findViewById(R.id.TextViewT1);
t2 = (TextView) findViewById(R.id.TextViewT2);
t3 = (TextView) findViewById(R.id.TextViewT3);
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
Location loc = lm.getLastKnownLocation(lm.getBestProvider(criteria, false));
t1.setText("Bicycle Racks and Parking");
//t3.setText("loading...");
if (loc != null) {
mySpot = new LatLng(loc.getLatitude(), loc.getLongitude());
} else {
// try with coarse accuracy
criteria.setAccuracy(Criteria.ACCURACY_FINE);
loc = lm.getLastKnownLocation(lm.getBestProvider(criteria, false));
if (loc == null) {
mySpot = new LatLng(39.952451,-75.163664); // city hall by default
}
}
// test location in S Philly
//mySpot = new LatLng(39.924877,-75.158871);
/////////////////
// check if already instantiated
if (mMap == null) {
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.setMyLocationEnabled(true);
layout = (LinearLayout)findViewById(R.id.LinearLayout01);
ViewTreeObserver vto = layout.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
layout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
// Center & zoom the map after map layout completes
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mySpot, 15));
}
});
} else {
mMap.clear();
}
// check if got map
if (mMap == null) {
Log.e("Couldn't get map fragment!", "No map fragment");
return;
}
mMap.setInfoWindowAdapter(new BikeRackInfoWindow(getLayoutInflater()));
// use mapbox map with base layer
//TileOverlayOptions tileOpts = new TileOverlayOptions();
//tileOpts.tileProvider(new MapTileProvider("banderkat.map-xdg8ubm7"));
//mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
//mMap.addTileOverlay(tileOpts);
TileOverlayOptions racksOpts = new TileOverlayOptions();
racksOpts.tileProvider(new MapTileProvider("banderkat.PhillyBikeRacks"));
TileOverlayOptions routesOpts = new TileOverlayOptions();
routesOpts.tileProvider(new MapTileProvider("banderkat.philly_bikeroutes"));
routesOverlay = mMap.addTileOverlay(routesOpts);
racksOverlay = mMap.addTileOverlay(racksOpts);
}
示例10: onCreate
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// get the database path
mMapName = getIntent().getStringExtra(Const.EXTRA_NAME);
if (mMapName == null) {
Toast.makeText(this, getString(R.string.crouton_invalid_file), Toast.LENGTH_SHORT).show();
finish();
return;
}
// set the action bar title
getActionBar().setTitle(mMapName);
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.setMapType(GoogleMap.MAP_TYPE_NONE);
// display tiles
MBTilesProvider mbTilesProvider = new MBTilesProvider(this, TilesContract.CONTENT_URI + mMapName + File.separator + TilesContract.TABLE_TILES);
// create new TileOverlayOptions instance.
TileOverlayOptions tileOverlayOptions = new TileOverlayOptions();
// set the tile provider to your custom implementation.
tileOverlayOptions.tileProvider(mbTilesProvider);
map.addTileOverlay(tileOverlayOptions);
// at this point the map will not be focused
// use the metadata to get the map center and default zoom level
MapMetadata mapMetadata = mbTilesProvider.getCenterAndZoom(TilesContract.CONTENT_URI + mMapName + File.separator + TilesContract.TABLE_METADATA);
// if no metadata is present don't display the map
// TODO maybe find a random tile and center it on certain zoom level
if (mapMetadata == null)
return;
// center and zoom to map
CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(mapMetadata.getLat(), mapMetadata.getLon()));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(mapMetadata.getZoom());
map.moveCamera(center);
map.animateCamera(zoom);
}
示例11: createTileOverlayOptions
import com.google.android.gms.maps.model.TileOverlayOptions; //導入方法依賴的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;
}