public class TilesOverlay extends Overlay implements IOverlayMenuProvider
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.Modifier and Type | Class and Description |
---|---|
protected class |
TilesOverlay.CacheTileLooper
A simple loop in order to collect all tiles' indices
|
protected class |
TilesOverlay.OverlayTileLooper |
Overlay.Snappable
Modifier and Type | Field and Description |
---|---|
static ColorFilter |
INVERT_COLORS
provides a night mode like affect by inverting the map tile colors
|
protected Paint |
mDebugPaint |
static int |
MENU_MAP_MODE |
static int |
MENU_OFFLINE |
static int |
MENU_TILE_SOURCE_STARTING_ID |
protected Projection |
mProjection |
protected MapTileProviderBase |
mTileProvider
Current tile source
|
protected RectL |
mViewPort |
(package private) static float[] |
negate |
protected Drawable |
userSelectedLoadingDrawable |
mBounds, SHADOW_X_SKEW, SHADOW_Y_SCALE
DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Constructor and Description |
---|
TilesOverlay(MapTileProviderBase aTileProvider,
Context aContext) |
TilesOverlay(MapTileProviderBase aTileProvider,
Context aContext,
boolean horizontalWrapEnabled,
boolean verticalWrapEnabled) |
Modifier and Type | Method and Description |
---|---|
void |
draw(Canvas c,
MapView osmv,
boolean shadow)
Draw the overlay over the map.
|
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 account
osmdroid-specific characteristics (like osmdroid's canvas's having 0,0 as the center rather
than the upper-left corner).
|
protected Rect |
getCanvasRect() |
int |
getLoadingBackgroundColor() |
int |
getLoadingLineColor() |
int |
getMaximumZoomLevel() |
int |
getMinimumZoomLevel() |
protected Projection |
getProjection() |
boolean |
isHorizontalWrapEnabled() |
boolean |
isOptionsMenuEnabled()
Can be used to signal to external callers that this Overlay should not be used for providing
option menu items.
|
boolean |
isVerticalWrapEnabled() |
boolean |
onCreateOptionsMenu(Menu pMenu,
int pMenuIdOffset,
MapView pMapView) |
void |
onDetach(MapView pMapView)
Override to perform clean up of resources before shutdown.
|
boolean |
onOptionsItemSelected(MenuItem pItem,
int pMenuIdOffset,
MapView pMapView) |
boolean |
onPrepareOptionsMenu(Menu pMenu,
int pMenuIdOffset,
MapView pMapView) |
protected void |
onTileReadyToDraw(Canvas c,
Drawable currentMapTile,
Rect tileRect) |
void |
protectDisplayedTilesForCache(Canvas pCanvas,
MapView pMapView)
Populates the tile provider's memory cache with the list of displayed tiles
|
protected void |
setCanvasRect(Rect pCanvasRect) |
void |
setColorFilter(ColorFilter filter)
sets the current color filter, which is applied to tiles before being drawn to the screen.
|
void |
setHorizontalWrapEnabled(boolean horizontalWrapEnabled) |
void |
setLoadingBackgroundColor(int pLoadingBackgroundColor)
Set the color to use to draw the background while we're waiting for the tile to load.
|
void |
setLoadingDrawable(Drawable drawable)
See issue https://github.com/osmdroid/osmdroid/issues/330
customizable override for the grey grid
|
void |
setLoadingLineColor(int pLoadingLineColor) |
void |
setOptionsMenuEnabled(boolean pOptionsMenuEnabled) |
protected void |
setProjection(Projection pProjection) |
void |
setUseDataConnection(boolean aMode)
Set whether to use the network connection if it's available.
|
void |
setVerticalWrapEnabled(boolean verticalWrapEnabled) |
protected boolean |
setViewPort(Canvas pCanvas,
MapView pMapView)
Get the area we are drawing to
|
boolean |
useDataConnection()
Whether to use the network connection if it's available.
|
drawAt, getBounds, getSafeMenuId, getSafeMenuIdSequence, isEnabled, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onPause, onResume, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled
public static final int MENU_MAP_MODE
public static final int MENU_TILE_SOURCE_STARTING_ID
public static final int MENU_OFFLINE
protected final MapTileProviderBase mTileProvider
protected Drawable userSelectedLoadingDrawable
protected final Paint mDebugPaint
protected final RectL mViewPort
protected Projection mProjection
static final float[] negate
public static final ColorFilter INVERT_COLORS
public TilesOverlay(MapTileProviderBase aTileProvider, Context aContext)
public TilesOverlay(MapTileProviderBase aTileProvider, Context aContext, boolean horizontalWrapEnabled, boolean verticalWrapEnabled)
public void setLoadingDrawable(Drawable drawable)
drawable
- public void onDetach(MapView pMapView)
Overlay
public int getMinimumZoomLevel()
public int getMaximumZoomLevel()
public boolean useDataConnection()
public void setUseDataConnection(boolean aMode)
aMode
- if true use the network connection if it's available. if false don't use the
network connection even if it's available.public void protectDisplayedTilesForCache(Canvas pCanvas, MapView pMapView)
protected boolean setViewPort(Canvas pCanvas, MapView pMapView)
public void draw(Canvas c, MapView osmv, boolean shadow)
Overlay
public void drawTiles(Canvas c, Projection projection, double zoomLevel, RectL viewPort)
protected void setCanvasRect(Rect pCanvasRect)
protected Rect getCanvasRect()
protected void setProjection(Projection pProjection)
protected Projection getProjection()
protected void onTileReadyToDraw(Canvas c, Drawable currentMapTile, Rect tileRect)
public void setOptionsMenuEnabled(boolean pOptionsMenuEnabled)
setOptionsMenuEnabled
in interface IOverlayMenuProvider
public boolean isOptionsMenuEnabled()
IOverlayMenuProvider
isOptionsMenuEnabled
in interface IOverlayMenuProvider
public boolean onCreateOptionsMenu(Menu pMenu, int pMenuIdOffset, MapView pMapView)
onCreateOptionsMenu
in interface IOverlayMenuProvider
public boolean onPrepareOptionsMenu(Menu pMenu, int pMenuIdOffset, MapView pMapView)
onPrepareOptionsMenu
in interface IOverlayMenuProvider
public boolean onOptionsItemSelected(MenuItem pItem, int pMenuIdOffset, MapView pMapView)
onOptionsItemSelected
in interface IOverlayMenuProvider
public int getLoadingBackgroundColor()
public void setLoadingBackgroundColor(int pLoadingBackgroundColor)
pLoadingBackgroundColor
- the color to use. If the value is Color.TRANSPARENT
then there will be no
loading tile.public int getLoadingLineColor()
public void setLoadingLineColor(int pLoadingLineColor)
public void setColorFilter(ColorFilter filter)
filter
- public boolean isHorizontalWrapEnabled()
public void setHorizontalWrapEnabled(boolean horizontalWrapEnabled)
public boolean isVerticalWrapEnabled()
public void setVerticalWrapEnabled(boolean verticalWrapEnabled)