本文整理汇总了Java中com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer类的典型用法代码示例。如果您正苦于以下问题:Java TileLayer类的具体用法?Java TileLayer怎么用?Java TileLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TileLayer类属于com.mapbox.mapboxsdk.tileprovider.tilesource包,在下文中一共展示了TileLayer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = this.getIntent();
String fileName = intent.getStringExtra(Intent.EXTRA_TEXT);
MapView mapView = new MapView(this);
BoundingBox box;
TileLayer mbTileLayer = new MBTilesLayer(this, fileName);
mapView.setTileSource(new ITileLayer[] {
mbTileLayer, new WebSourceTileLayer("mapquest",
"http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png").setName(
"MapQuest Open Aerial")
.setAttribution("Tiles courtesy of MapQuest and OpenStreetMap contributors.")
.setMinimumZoomLevel(1)
.setMaximumZoomLevel(18)
});
box = mbTileLayer.getBoundingBox();
mapView.setScrollableAreaLimit(box);
mapView.setMinZoomLevel(mapView.getTileProvider().getMinimumZoomLevel());
mapView.setMaxZoomLevel(mapView.getTileProvider().getMaximumZoomLevel());
mapView.setCenter(mapView.getTileProvider().getCenterCoordinate());
mapView.setZoom(0);
Log.d("MapboxPlugin", "zoomToBoundingBox " + box.toString());
setContentView(mapView);
}
示例2: createMapboxMap
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
private void createMapboxMap(final String mapId) {
this.cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
Activity activity = cordova.getActivity();
MapView mapView = new MapView(webView.getContext());
BoundingBox box;
// Get Mapbox access token from Android's application resources.
Resources res = activity.getResources();
int resId = res.getIdentifier("mapboxAccessToken", "string", activity.getPackageName());
String accessToken = res.getString(resId);
// Mapbox tile layer.
mapView.setAccessToken(accessToken);
TileLayer mbTileLayer = new MapboxTileLayer(mapId);
mapView.setTileSource(mbTileLayer);
// END Mapbox tile layer.
box = mbTileLayer.getBoundingBox();
mapView.setScrollableAreaLimit(box);
mapView.setMinZoomLevel(mapView.getTileProvider().getMinimumZoomLevel());
mapView.setMaxZoomLevel(mapView.getTileProvider().getMaximumZoomLevel());
mapView.setCenter(mapView.getTileProvider().getCenterCoordinate());
mapView.setZoom(0);
Log.d("MapboxPlugin", "zoomToBoundingBox " + box.toString());
activity.setContentView(mapView);
}
});
}
示例3: setTileSource
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public void setTileSource(final ITileLayer tileSource) {
if (mTileSource.get() != null) {
mTileSource.get().detach();
}
// We are only interested in TileLayer tile sources
if (tileSource instanceof TileLayer) {
mTileSource.set((TileLayer) tileSource);
} else {
// Otherwise shut down the tile downloader
mTileSource.set(null);
}
}
示例4: loadTile
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public Drawable loadTile(final MapTileRequestState aState) throws CantContinueException {
final MapTile tile = aState.getMapTile();
// Log.d(TAG, "loadTile() with tile = '" + tile + "'");
if (mTileCache != null && mTileCache.get().containsTileInDiskCache(tile)) {
Log.d(TAG, "tile found in Disk Cache, so returning it. tile = '" + tile + "'");
return mTileCache.get().getMapTileFromDisk(tile);
}
TileLayer tileLayer = mTileSource.get();
Drawable result =
(tileLayer != null) ? tileLayer.getDrawableFromTile(MapTileDownloader.this,
tile, hdpi) : null;
// Log.d(TAG, "tileLayer.getDrawable() returning result = '" + result + "'");
return result;
}
示例5: loadTile
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public Drawable loadTile(final MapTileRequestState aState) throws CantContinueException {
final MapTile tile = aState.getMapTile();
// Log.d(TAG, "loadTile() with tile = '" + tile + "'");
if (mTileCache != null && mTileCache.get().containsTileInDiskCache(tile)) {
// Log.d(TAG, "tile found in Disk Cache, so returning it. tile = '" + tile + "'");
return mTileCache.get().getMapTileFromDisk(tile);
}
TileLayer tileLayer = mTileSource.get();
Drawable result =
(tileLayer != null) ? tileLayer.getDrawableFromTile(MapTileDownloader.this,
tile, hdpi) : null;
// Log.d(TAG, "tileLayer.getDrawable() returning result = '" + result + "'");
return result;
}
示例6: getMinimumZoomLevel
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public float getMinimumZoomLevel() {
TileLayer tileLayer = mTileSource.get();
return (tileLayer != null ? tileLayer.getMinimumZoomLevel() : MINIMUM_ZOOMLEVEL);
}
示例7: getMaximumZoomLevel
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public float getMaximumZoomLevel() {
TileLayer tileLayer = mTileSource.get();
return (tileLayer != null ? tileLayer.getMaximumZoomLevel() : MAXIMUM_ZOOMLEVEL);
}
示例8: getBoundingBox
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public BoundingBox getBoundingBox() {
TileLayer tileLayer = mTileSource.get();
return (tileLayer != null ? tileLayer.getBoundingBox() : null);
}
示例9: getCenterCoordinate
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public LatLng getCenterCoordinate() {
TileLayer tileLayer = mTileSource.get();
return (tileLayer != null ? tileLayer.getCenterCoordinate() : null);
}
示例10: getCenterZoom
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public float getCenterZoom() {
TileLayer tileLayer = mTileSource.get();
return (tileLayer != null ? tileLayer.getCenterZoom()
: (getMaximumZoomLevel() + getMinimumZoomLevel()) / 2);
}
示例11: getTileSizePixels
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public int getTileSizePixels() {
TileLayer tileLayer = mTileSource.get();
return (tileLayer != null) ? tileLayer.getTileSizePixels() : 0;
}
示例12: getCacheKey
import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public String getCacheKey() {
TileLayer tileLayer = mTileSource.get();
return (tileLayer != null) ? tileLayer.getCacheKey() : "";
}