public class DefaultConfigurationProvider extends Object implements IConfigurationProvider
IConfigurationProvider
,
Configuration
Modifier and Type | Field and Description |
---|---|
protected short |
cacheMapTileCount |
protected boolean |
debugMapTileDownloader |
protected boolean |
debugMapView |
protected boolean |
debugMode |
protected boolean |
debugTileProviders |
protected long |
expirationAdder |
protected Long |
expirationOverride |
protected long |
gpsWaitTime |
protected SimpleDateFormat |
httpHeaderDateTimeFormat |
protected boolean |
isMapViewHardwareAccelerated |
protected File |
osmdroidBasePath |
protected File |
osmdroidTileCache |
protected short |
tileDownloadMaxQueueSize |
protected short |
tileDownloadThreads |
protected long |
tileFileSystemCacheMaxBytes |
protected long |
tileFileSystemCacheTrimBytes |
protected short |
tileFileSystemMaxQueueSize |
protected short |
tileFileSystemThreads |
protected String |
userAgentHttpHeader |
protected String |
userAgentValue |
Constructor and Description |
---|
DefaultConfigurationProvider() |
Modifier and Type | Method and Description |
---|---|
short |
getCacheMapTileCount()
Initial tile cache size (in memory).
|
long |
getExpirationExtendedDuration()
Returns the amount of time in ms added to server specified tile expiration time
Added as part of issue https://github.com/osmdroid/osmdroid/issues/490
|
Long |
getExpirationOverrideDuration()
Optional period of time in ms that will override any downloaded tile's expiration timestamp
|
long |
getGpsWaitTime()
default is 20 seconds
|
SimpleDateFormat |
getHttpHeaderDateTimeFormat() |
File |
getOsmdroidBasePath()
Base path for osmdroid files.
|
File |
getOsmdroidTileCache()
maps to getOsmdroidBasePath() + "/tiles"
Change the root path of the osmdroid tile cache.
|
short |
getTileDownloadMaxQueueSize() |
short |
getTileDownloadThreads()
number of tile download threads, conforming to OSM policy:
http://wiki.openstreetmap.org/wiki/Tile_usage_policy
default is 2
|
long |
getTileFileSystemCacheMaxBytes()
default is 600 Mb
|
long |
getTileFileSystemCacheTrimBytes()
When the cache size exceeds maxCacheSize, tiles will be automatically removed to reach this target.
|
short |
getTileFileSystemMaxQueueSize() |
short |
getTileFileSystemThreads()
used for both file system cache and the sqlite cache
|
String |
getUserAgentHttpHeader()
"User-Agent" is the default value and standard used throughout all http servers, unlikely to change
made adjustable just in case
from
OpenStreetMapTileProviderConstants |
String |
getUserAgentValue() |
boolean |
isDebugMapTileDownloader() |
boolean |
isDebugMapView()
Typically used to enable additional debugging
from
MapViewConstants |
boolean |
isDebugMode()
Typically used to enable additional debugging
from
OpenStreetMapTileProviderConstants |
boolean |
isDebugTileProviders()
Typically used to enable additional debugging
from
OpenStreetMapTileProviderConstants |
boolean |
isMapViewHardwareAccelerated()
default is false
|
void |
load(Context ctx,
SharedPreferences prefs)
loads the configuration from shared preferences, if the preferences defined in this file are not already
set, them they will be populated with defaults.
|
void |
save(Context ctx,
SharedPreferences prefs)
saves the current configuration to the shared preference location
|
void |
setCacheMapTileCount(short cacheMapTileCount) |
void |
setDebugMapTileDownloader(boolean debugMapTileDownloader) |
void |
setDebugMapView(boolean debugMapView) |
void |
setDebugMode(boolean debugMode) |
void |
setDebugTileProviders(boolean debugTileProviders) |
void |
setExpirationExtendedDuration(long period)
Optionally extends the amount of time that downloaded tiles remain in the cache beyond either the
server specified expiration time stamp or the default expiration time {
OpenStreetMapTileProviderConstants.DEFAULT_MAXIMUM_CACHED_FILE_AGE }
Note: this setting only controls tiles as they are downloaded. |
void |
setExpirationOverrideDuration(Long period)
Optional period of time in ms that will override any downloaded tile's expiration timestamp
|
void |
setGpsWaitTime(long gpsWaitTime)
The time we wait after the last gps location before using a non-gps location.
|
void |
setHttpHeaderDateTimeFormat(SimpleDateFormat httpHeaderDateTimeFormat) |
void |
setMapViewHardwareAccelerated(boolean mapViewHardwareAccelerated)
must be set before the mapview is created or inflated from a layout.
|
void |
setOsmdroidBasePath(File osmdroidBasePath)
Base path for osmdroid files.
|
void |
setOsmdroidTileCache(File osmdroidTileCache) |
void |
setTileDownloadMaxQueueSize(short tileDownloadMaxQueueSize) |
void |
setTileDownloadThreads(short tileDownloadThreads) |
void |
setTileFileSystemCacheMaxBytes(long tileFileSystemCacheMaxBytes) |
void |
setTileFileSystemCacheTrimBytes(long tileFileSystemCacheTrimBytes) |
void |
setTileFileSystemMaxQueueSize(short tileFileSystemMaxQueueSize) |
void |
setTileFileSystemThreads(short tileFileSystemThreads)
used for both file system cache and the sqlite cache
|
void |
setUserAgentHttpHeader(String userAgentHttpHeader) |
void |
setUserAgentValue(String userAgentValue)
Enables you to override the default "osmdroid" value for HTTP user agents.
|
protected long gpsWaitTime
protected boolean debugMode
protected boolean debugMapView
protected boolean debugTileProviders
protected boolean debugMapTileDownloader
protected boolean isMapViewHardwareAccelerated
protected String userAgentValue
protected String userAgentHttpHeader
protected short cacheMapTileCount
protected short tileDownloadThreads
protected short tileFileSystemThreads
protected short tileDownloadMaxQueueSize
protected short tileFileSystemMaxQueueSize
protected long tileFileSystemCacheMaxBytes
protected long tileFileSystemCacheTrimBytes
protected SimpleDateFormat httpHeaderDateTimeFormat
protected File osmdroidBasePath
protected File osmdroidTileCache
protected long expirationAdder
protected Long expirationOverride
public long getGpsWaitTime()
getGpsWaitTime
in interface IConfigurationProvider
public void setGpsWaitTime(long gpsWaitTime)
IConfigurationProvider
setGpsWaitTime
in interface IConfigurationProvider
public boolean isDebugMode()
IConfigurationProvider
OpenStreetMapTileProviderConstants
isDebugMode
in interface IConfigurationProvider
public void setDebugMode(boolean debugMode)
setDebugMode
in interface IConfigurationProvider
public boolean isDebugMapView()
IConfigurationProvider
MapViewConstants
isDebugMapView
in interface IConfigurationProvider
public void setDebugMapView(boolean debugMapView)
setDebugMapView
in interface IConfigurationProvider
public boolean isDebugTileProviders()
IConfigurationProvider
OpenStreetMapTileProviderConstants
isDebugTileProviders
in interface IConfigurationProvider
public void setDebugTileProviders(boolean debugTileProviders)
setDebugTileProviders
in interface IConfigurationProvider
public boolean isDebugMapTileDownloader()
isDebugMapTileDownloader
in interface IConfigurationProvider
public void setDebugMapTileDownloader(boolean debugMapTileDownloader)
setDebugMapTileDownloader
in interface IConfigurationProvider
public boolean isMapViewHardwareAccelerated()
IConfigurationProvider
isMapViewHardwareAccelerated
in interface IConfigurationProvider
public void setMapViewHardwareAccelerated(boolean mapViewHardwareAccelerated)
IConfigurationProvider
setMapViewHardwareAccelerated
in interface IConfigurationProvider
Polygon
,
Polyline
,
OsmPath
public String getUserAgentValue()
getUserAgentValue
in interface IConfigurationProvider
public void setUserAgentValue(String userAgentValue)
IConfigurationProvider
OpenStreetMapTileProviderConstants
setUserAgentValue
in interface IConfigurationProvider
public short getCacheMapTileCount()
IConfigurationProvider
LRUMapTileCache.ensureCapacity(int)
The tile cache will always be at least 3x3.
from OpenStreetMapTileProviderConstants
used by MapTileCachegetCacheMapTileCount
in interface IConfigurationProvider
MapTileCache
public void setCacheMapTileCount(short cacheMapTileCount)
setCacheMapTileCount
in interface IConfigurationProvider
public short getTileDownloadThreads()
IConfigurationProvider
getTileDownloadThreads
in interface IConfigurationProvider
public void setTileDownloadThreads(short tileDownloadThreads)
setTileDownloadThreads
in interface IConfigurationProvider
public short getTileFileSystemThreads()
IConfigurationProvider
getTileFileSystemThreads
in interface IConfigurationProvider
public void setTileFileSystemThreads(short tileFileSystemThreads)
IConfigurationProvider
setTileFileSystemThreads
in interface IConfigurationProvider
public short getTileDownloadMaxQueueSize()
getTileDownloadMaxQueueSize
in interface IConfigurationProvider
public void setTileDownloadMaxQueueSize(short tileDownloadMaxQueueSize)
setTileDownloadMaxQueueSize
in interface IConfigurationProvider
public short getTileFileSystemMaxQueueSize()
getTileFileSystemMaxQueueSize
in interface IConfigurationProvider
public void setTileFileSystemMaxQueueSize(short tileFileSystemMaxQueueSize)
setTileFileSystemMaxQueueSize
in interface IConfigurationProvider
public long getTileFileSystemCacheMaxBytes()
IConfigurationProvider
getTileFileSystemCacheMaxBytes
in interface IConfigurationProvider
public void setTileFileSystemCacheMaxBytes(long tileFileSystemCacheMaxBytes)
setTileFileSystemCacheMaxBytes
in interface IConfigurationProvider
public long getTileFileSystemCacheTrimBytes()
IConfigurationProvider
getTileFileSystemCacheTrimBytes
in interface IConfigurationProvider
public void setTileFileSystemCacheTrimBytes(long tileFileSystemCacheTrimBytes)
setTileFileSystemCacheTrimBytes
in interface IConfigurationProvider
public SimpleDateFormat getHttpHeaderDateTimeFormat()
getHttpHeaderDateTimeFormat
in interface IConfigurationProvider
public void setHttpHeaderDateTimeFormat(SimpleDateFormat httpHeaderDateTimeFormat)
setHttpHeaderDateTimeFormat
in interface IConfigurationProvider
public File getOsmdroidBasePath()
IConfigurationProvider
getOsmdroidBasePath
in interface IConfigurationProvider
public void setOsmdroidBasePath(File osmdroidBasePath)
IConfigurationProvider
setOsmdroidBasePath
in interface IConfigurationProvider
public File getOsmdroidTileCache()
IConfigurationProvider
getOsmdroidTileCache
in interface IConfigurationProvider
public void setOsmdroidTileCache(File osmdroidTileCache)
setOsmdroidTileCache
in interface IConfigurationProvider
public String getUserAgentHttpHeader()
IConfigurationProvider
OpenStreetMapTileProviderConstants
getUserAgentHttpHeader
in interface IConfigurationProvider
public void setUserAgentHttpHeader(String userAgentHttpHeader)
setUserAgentHttpHeader
in interface IConfigurationProvider
public void load(Context ctx, SharedPreferences prefs)
IConfigurationProvider
load
in interface IConfigurationProvider
public void save(Context ctx, SharedPreferences prefs)
IConfigurationProvider
save
in interface IConfigurationProvider
public long getExpirationExtendedDuration()
IConfigurationProvider
getExpirationExtendedDuration
in interface IConfigurationProvider
public void setExpirationExtendedDuration(long period)
IConfigurationProvider
OpenStreetMapTileProviderConstants.DEFAULT_MAXIMUM_CACHED_FILE_AGE
}
Note: this setting only controls tiles as they are downloaded. tiles already in the cache are
not effected by this setting
Added as part of issue https://github.com/osmdroid/osmdroid/issues/490setExpirationExtendedDuration
in interface IConfigurationProvider
period
- time in ms, if 0, no additional time to the 'server provided expiration' or the
'default expiration time' is added. If the value is less than 0, 0 will be usedpublic void setExpirationOverrideDuration(Long period)
IConfigurationProvider
setExpirationOverrideDuration
in interface IConfigurationProvider
period
- if null, this setting is unset, server value + getExpirationExtendedDuration apply
if not null, this this value is usedpublic Long getExpirationOverrideDuration()
IConfigurationProvider
getExpirationOverrideDuration
in interface IConfigurationProvider