/** Wrapper for the OpenStreetMap view. */ public OpenStreetMapWrapper(final Context context) { this.context = context; this.markerManager = new OpenStreetMapMarkerManager(this); this.overlayItemToMarker = Maps.newHashMap(); // Create a custom tile source final ITileSource seamarks = new XYTileSource( "seamarks", null, 0, 19, 256, ".png", new String[] {"http://tiles.openseamap.org/seamark/"}); final MapTileProviderBasic tileProvider = new MapTileProviderBasic(context, seamarks); final TilesOverlay seamarksOverlay = new TilesOverlay(tileProvider, context); seamarksOverlay.setLoadingBackgroundColor(Color.TRANSPARENT); seamarksOverlay.setUseSafeCanvas(true); // Create the mapview with the custom tile provider array this.mapView = new MapView(context, 256); this.mapView.setMultiTouchControls(true); this.mapView.setUseSafeCanvas(false); this.mapView.getOverlays().add(seamarksOverlay); CloudmadeUtil.retrieveCloudmadeKey(context); }
public void setUseSafeCanvas(boolean useSafeCanvas) { mUseSafeCanvas = useSafeCanvas; for (Overlay overlay : mOverlayList) if (overlay instanceof SafeDrawOverlay) ((SafeDrawOverlay) overlay).setUseSafeCanvas(this.isUsingSafeCanvas()); if (mTilesOverlay != null) { mTilesOverlay.setUseSafeCanvas(this.isUsingSafeCanvas()); } }
/** * Sets the optional TilesOverlay class. If set, this overlay will be drawn before all other * overlays and will not be included in the editable list of overlays and can't be cleared except * by a subsequent call to setTilesOverlay(). * * @param tilesOverlay the tilesOverlay to set */ public void setTilesOverlay(final TilesOverlay tilesOverlay) { mTilesOverlay = tilesOverlay; if (mTilesOverlay != null) { mTilesOverlay.setUseSafeCanvas(this.isUsingSafeCanvas()); } }