Class AbstractTileSource
- java.lang.Object
-
- org.mapsforge.map.layer.download.tilesource.AbstractTileSource
-
- All Implemented Interfaces:
TileSource
- Direct Known Subclasses:
OnlineTileSource,OpenStreetMapMapnik
public abstract class AbstractTileSource extends java.lang.Object implements TileSource
The abstract base class for tiles downloaded from a web server. This class defines a default TTL for cached tiles, accessible through thegetDefaultTimeToLive()method. The value here will be used as the initial TTL by theTileDownloadLayerusing this tile source, but applications can change the TTL at any time (refer toTileDownloadLayerfor details). The default value is set to one day, or 86,400,000 milliseconds. Subclasses should set#defaultTTLin their constructor to a value that is appropriate for their tile source.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringapiKeyprotected java.lang.Stringauthorizationprotected longdefaultTimeToLiveThe default time-to-live (TTL) for cached tiles (one day, or 86,400,000 milliseconds).protected booleanfollowRedirectsprotected java.lang.String[]hostNamesprotected java.lang.StringkeyNameprotected intportprotected java.util.Randomrandomprotected java.lang.Stringrefererprotected inttimeoutConnectprotected inttimeoutReadprotected java.lang.StringuserAgent
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTileSource(java.lang.String[] hostNames, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.StringgetApiKey()java.lang.StringgetAuthorization()longgetDefaultTimeToLive()Returns the default time-to-live (TTL) for cached tiles.protected java.lang.StringgetHostName()java.lang.StringgetKeyName()java.lang.StringgetReferer()intgetTimeoutConnect()intgetTimeoutRead()java.lang.StringgetUserAgent()inthashCode()booleanisFollowRedirects()voidsetApiKey(java.lang.String apiKey)voidsetAuthorization(java.lang.String authorization)voidsetFollowRedirects(boolean followRedirects)voidsetKeyName(java.lang.String keyName)voidsetReferer(java.lang.String referer)voidsetTimeoutConnect(int timeoutConnect)voidsetTimeoutRead(int timeoutRead)voidsetUserAgent(java.lang.String userAgent)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mapsforge.map.layer.download.tilesource.TileSource
getParallelRequestsLimit, getTileUrl, getZoomLevelMax, getZoomLevelMin, hasAlpha
-
-
-
-
Field Detail
-
apiKey
protected java.lang.String apiKey
-
authorization
protected java.lang.String authorization
-
defaultTimeToLive
protected long defaultTimeToLive
The default time-to-live (TTL) for cached tiles (one day, or 86,400,000 milliseconds).
-
followRedirects
protected boolean followRedirects
-
hostNames
protected final java.lang.String[] hostNames
-
keyName
protected java.lang.String keyName
-
port
protected final int port
-
random
protected final java.util.Random random
-
referer
protected java.lang.String referer
-
timeoutConnect
protected int timeoutConnect
-
timeoutRead
protected int timeoutRead
-
userAgent
protected java.lang.String userAgent
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getApiKey
public java.lang.String getApiKey()
-
getAuthorization
public java.lang.String getAuthorization()
- Specified by:
getAuthorizationin interfaceTileSource- Returns:
- the Authorization (may be null).
-
getDefaultTimeToLive
public long getDefaultTimeToLive()
Returns the default time-to-live (TTL) for cached tiles.- Specified by:
getDefaultTimeToLivein interfaceTileSource
-
getHostName
protected java.lang.String getHostName()
-
getKeyName
public java.lang.String getKeyName()
-
getReferer
public java.lang.String getReferer()
- Specified by:
getRefererin interfaceTileSource- Returns:
- the HTTP referer (may be null).
-
getTimeoutConnect
public int getTimeoutConnect()
- Specified by:
getTimeoutConnectin interfaceTileSource- Returns:
- the connect timeout value in milliseconds.
-
getTimeoutRead
public int getTimeoutRead()
- Specified by:
getTimeoutReadin interfaceTileSource- Returns:
- the read timeout value in milliseconds.
-
getUserAgent
public java.lang.String getUserAgent()
- Specified by:
getUserAgentin interfaceTileSource- Returns:
- the HTTP user agent (may be null).
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isFollowRedirects
public boolean isFollowRedirects()
- Specified by:
isFollowRedirectsin interfaceTileSource- Returns:
- whether or not to follow HTTP redirects.
-
setApiKey
public void setApiKey(java.lang.String apiKey)
-
setAuthorization
public void setAuthorization(java.lang.String authorization)
-
setFollowRedirects
public void setFollowRedirects(boolean followRedirects)
-
setKeyName
public void setKeyName(java.lang.String keyName)
-
setReferer
public void setReferer(java.lang.String referer)
-
setTimeoutConnect
public void setTimeoutConnect(int timeoutConnect)
-
setTimeoutRead
public void setTimeoutRead(int timeoutRead)
-
setUserAgent
public void setUserAgent(java.lang.String userAgent)
-
-