Search in sources :

Example 1 with TileOverlayOptions

use of com.google.android.libraries.maps.model.TileOverlayOptions in project android-samples by googlemaps.

the class TileCoordinateDemoActivity method onMapReady.

@Override
public void onMapReady(GoogleMap map) {
    TileProvider coordTileProvider = new CoordTileProvider(this.getApplicationContext());
    map.addTileOverlay(new TileOverlayOptions().tileProvider(coordTileProvider));
}
Also used : TileOverlayOptions(com.google.android.libraries.maps.model.TileOverlayOptions) TileProvider(com.google.android.libraries.maps.model.TileProvider)

Example 2 with TileOverlayOptions

use of com.google.android.libraries.maps.model.TileOverlayOptions in project android-samples by googlemaps.

the class TileOverlayDemoActivity method onMapReady.

@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, x, reversedY);
            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);
}
Also used : MalformedURLException(java.net.MalformedURLException) TileOverlayOptions(com.google.android.libraries.maps.model.TileOverlayOptions) UrlTileProvider(com.google.android.libraries.maps.model.UrlTileProvider) TileProvider(com.google.android.libraries.maps.model.TileProvider) UrlTileProvider(com.google.android.libraries.maps.model.UrlTileProvider) URL(java.net.URL)

Example 3 with TileOverlayOptions

use of com.google.android.libraries.maps.model.TileOverlayOptions in project android-maps-utils by googlemaps.

the class TileProviderAndProjectionDemo method startDemo.

@Override
protected void startDemo(boolean isRestore) {
    PointTileOverlay pto = new PointTileOverlay();
    pto.addPoint(new LatLng(0, 0));
    pto.addPoint(new LatLng(21, -10));
    getMap().addTileOverlay(new TileOverlayOptions().tileProvider(pto));
}
Also used : TileOverlayOptions(com.google.android.libraries.maps.model.TileOverlayOptions) LatLng(com.google.android.libraries.maps.model.LatLng)

Aggregations

TileOverlayOptions (com.google.android.libraries.maps.model.TileOverlayOptions)3 TileProvider (com.google.android.libraries.maps.model.TileProvider)2 LatLng (com.google.android.libraries.maps.model.LatLng)1 UrlTileProvider (com.google.android.libraries.maps.model.UrlTileProvider)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1