当前位置: 首页>>代码示例>>Java>>正文


Java TileLayer类代码示例

本文整理汇总了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);
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:31,代码来源:OfflineMapActivity.java

示例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);
      }
    });
  }
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:31,代码来源:Mapbox.java

示例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);
    }
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:14,代码来源:MapTileDownloader.java

示例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;
        }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:16,代码来源:MapTileDownloader.java

示例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;
        }
 
开发者ID:posm,项目名称:OpenMapKitAndroid,代码行数:16,代码来源:MapTileDownloader.java

示例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);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:6,代码来源:MapTileDownloader.java

示例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);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:6,代码来源:MapTileDownloader.java

示例8: getBoundingBox

import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public BoundingBox getBoundingBox() {
    TileLayer tileLayer = mTileSource.get();
    return (tileLayer != null ? tileLayer.getBoundingBox() : null);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:6,代码来源:MapTileDownloader.java

示例9: getCenterCoordinate

import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public LatLng getCenterCoordinate() {
    TileLayer tileLayer = mTileSource.get();
    return (tileLayer != null ? tileLayer.getCenterCoordinate() : null);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:6,代码来源:MapTileDownloader.java

示例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);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:7,代码来源:MapTileDownloader.java

示例11: getTileSizePixels

import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public int getTileSizePixels() {
    TileLayer tileLayer = mTileSource.get();
    return (tileLayer != null) ? tileLayer.getTileSizePixels() : 0;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:6,代码来源:MapTileDownloader.java

示例12: getCacheKey

import com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer; //导入依赖的package包/类
@Override
public String getCacheKey() {
    TileLayer tileLayer = mTileSource.get();
    return (tileLayer != null) ? tileLayer.getCacheKey() : "";
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:6,代码来源:MapTileDownloader.java


注:本文中的com.mapbox.mapboxsdk.tileprovider.tilesource.TileLayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。