-
- All Implemented Interfaces:
-
org.osmdroid.views.overlay.IOverlayMenuProvider,org.osmdroid.views.util.constants.OverlayConstants
public class TilesOverlay extends Overlay implements IOverlayMenuProvider
A TilesOverlay is responsible to display a MapTileIndex.
These objects are the principle consumer of map tiles.
see MapTileIndex for an overview of how tiles are acquired by this overlay.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intMENU_MAP_MODEpublic final static intMENU_TILE_SOURCE_STARTING_IDpublic final static intMENU_OFFLINEpublic final static intMENU_SNAPSHOTpublic final static intMENU_STATESprivate booleanhorizontalWrapEnabledprivate booleanverticalWrapEnabledpublic final static ColorFilterINVERT_COLORS
-
Constructor Summary
Constructors Constructor Description TilesOverlay(MapTileProviderBase aTileProvider, Context aContext)TilesOverlay(MapTileProviderBase aTileProvider, Context aContext, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)
-
Method Summary
Modifier and Type Method Description voidsetHorizontalWrapEnabled(boolean horizontalWrapEnabled)voidsetVerticalWrapEnabled(boolean verticalWrapEnabled)voidsetLoadingDrawable(Drawable drawable)See issue https://github. voidonDetach(MapView pMapView)Override to perform clean up of resources before shutdown. intgetMinimumZoomLevel()intgetMaximumZoomLevel()booleanuseDataConnection()Whether to use the network connection if it's available. voidsetUseDataConnection(boolean aMode)Set whether to use the network connection if it's available. voidprotectDisplayedTilesForCache(Canvas pCanvas, Projection pProjection)Populates the tile provider's memory cache with the list of displayed tiles voiddraw(Canvas c, Projection pProjection)voiddrawTiles(Canvas c, Projection projection, double zoomLevel, RectL viewPort)This is meant to be a "pure" tile drawing function that doesn't take into accountosmdroid-specific characteristics (like osmdroid's canvas's having 0,0 as the center ratherthan the upper-left corner). voidsetOptionsMenuEnabled(boolean pOptionsMenuEnabled)booleanisOptionsMenuEnabled()Can be used to signal to external callers that this Overlay should not be used for providingoption menu items. booleanonCreateOptionsMenu(Menu pMenu, int pMenuIdOffset, MapView pMapView)booleanonPrepareOptionsMenu(Menu pMenu, int pMenuIdOffset, MapView pMapView)booleanonOptionsItemSelected(MenuItem pItem, int pMenuIdOffset, MapView pMapView)intgetLoadingBackgroundColor()voidsetLoadingBackgroundColor(int pLoadingBackgroundColor)Set the color to use to draw the background while we're waiting for the tile to load. intgetLoadingLineColor()voidsetLoadingLineColor(int pLoadingLineColor)voidsetColorFilter(ColorFilter filter)sets the current color filter, which is applied to tiles before being drawn to the screen.Use this to enable night mode or any other tile rendering adjustment as necessary. booleanisHorizontalWrapEnabled()booleanisVerticalWrapEnabled()TileStatesgetTileStates()-
Methods inherited from class org.osmdroid.views.overlay.Overlay
draw, draw, getBounds, isEnabled, onDetach, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onPause, onResume, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
TilesOverlay
TilesOverlay(MapTileProviderBase aTileProvider, Context aContext)
-
TilesOverlay
TilesOverlay(MapTileProviderBase aTileProvider, Context aContext, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)
-
-
Method Detail
-
setHorizontalWrapEnabled
void setHorizontalWrapEnabled(boolean horizontalWrapEnabled)
-
setVerticalWrapEnabled
void setVerticalWrapEnabled(boolean verticalWrapEnabled)
-
setLoadingDrawable
void setLoadingDrawable(Drawable drawable)
See issue https://github.com/osmdroid/osmdroid/issues/330customizable override for the grey grid
-
onDetach
void onDetach(MapView pMapView)
Override to perform clean up of resources before shutdown. By default does nothing.
-
getMinimumZoomLevel
int getMinimumZoomLevel()
-
getMaximumZoomLevel
int getMaximumZoomLevel()
-
useDataConnection
boolean useDataConnection()
Whether to use the network connection if it's available.
-
setUseDataConnection
void setUseDataConnection(boolean aMode)
Set whether to use the network connection if it's available.
- Parameters:
aMode- if true use the network connection if it's available.
-
protectDisplayedTilesForCache
void protectDisplayedTilesForCache(Canvas pCanvas, Projection pProjection)
Populates the tile provider's memory cache with the list of displayed tiles
-
draw
void draw(Canvas c, Projection pProjection)
-
drawTiles
void drawTiles(Canvas c, Projection projection, double zoomLevel, RectL viewPort)
This is meant to be a "pure" tile drawing function that doesn't take into accountosmdroid-specific characteristics (like osmdroid's canvas's having 0,0 as the center ratherthan the upper-left corner). Once the tile is ready to be drawn, it is passed toonTileReadyToDraw where custom manipulations can be made before drawing the tile.
-
setOptionsMenuEnabled
void setOptionsMenuEnabled(boolean pOptionsMenuEnabled)
-
isOptionsMenuEnabled
boolean isOptionsMenuEnabled()
Can be used to signal to external callers that this Overlay should not be used for providingoption menu items.
-
onCreateOptionsMenu
boolean onCreateOptionsMenu(Menu pMenu, int pMenuIdOffset, MapView pMapView)
-
onPrepareOptionsMenu
boolean onPrepareOptionsMenu(Menu pMenu, int pMenuIdOffset, MapView pMapView)
-
onOptionsItemSelected
boolean onOptionsItemSelected(MenuItem pItem, int pMenuIdOffset, MapView pMapView)
-
getLoadingBackgroundColor
int getLoadingBackgroundColor()
-
setLoadingBackgroundColor
void setLoadingBackgroundColor(int pLoadingBackgroundColor)
Set the color to use to draw the background while we're waiting for the tile to load.
- Parameters:
pLoadingBackgroundColor- the color to use.
-
getLoadingLineColor
int getLoadingLineColor()
-
setLoadingLineColor
void setLoadingLineColor(int pLoadingLineColor)
-
setColorFilter
void setColorFilter(ColorFilter filter)
sets the current color filter, which is applied to tiles before being drawn to the screen.Use this to enable night mode or any other tile rendering adjustment as necessary. use null to clear.INVERT_COLORS provides color inversion for convenience and to support the previous night mode
-
isHorizontalWrapEnabled
boolean isHorizontalWrapEnabled()
-
isVerticalWrapEnabled
boolean isVerticalWrapEnabled()
-
getTileStates
TileStates getTileStates()
-
-
-
-