org.openstreetmap.gui.jmapviewer.tilesources
Class AbstractTMSTileSource
java.lang.Object
org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource
org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
- All Implemented Interfaces:
- Attributed, TileSource
- Direct Known Subclasses:
- AbstractOsmTileSource, BingAerialTileSource, ScanexTileSource, TMSTileSource
public abstract class AbstractTMSTileSource
- extends AbstractTileSource
Field Summary |
protected java.lang.String |
baseUrl
|
protected java.lang.String |
name
|
Method Summary |
java.lang.String |
getBaseUrl()
|
java.lang.String |
getExtension()
|
int |
getMaxZoom()
Specifies the maximum zoom value. |
int |
getMinZoom()
Specifies the minimum zoom value. |
java.lang.String |
getName()
A tile layer name has to be unique and has to consist only of characters
valid for filenames. |
java.lang.String |
getTilePath(int zoom,
int tilex,
int tiley)
|
int |
getTileSize()
Specifies how large each tile is. |
java.lang.String |
getTileType()
Specifies the tile image type. |
java.lang.String |
getTileUrl(int zoom,
int tilex,
int tiley)
Constructs the tile url. |
double |
latToTileY(double lat,
int zoom)
|
double |
lonToTileX(double lon,
int zoom)
|
double |
tileXToLon(int x,
int zoom)
|
double |
tileYToLat(int y,
int zoom)
|
java.lang.String |
toString()
|
Methods inherited from class org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource |
getAttributionImage, getAttributionImageURL, getAttributionLinkURL, getAttributionText, getTermsOfUseText, getTermsOfUseURL, requiresAttribution, setAttributionImage, setAttributionImageURL, setAttributionLinkURL, setAttributionText, setTermsOfUseText, setTermsOfUseURL |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
name
protected java.lang.String name
baseUrl
protected java.lang.String baseUrl
AbstractTMSTileSource
public AbstractTMSTileSource(java.lang.String name,
java.lang.String base_url)
getName
public java.lang.String getName()
- Description copied from interface:
TileSource
- A tile layer name has to be unique and has to consist only of characters
valid for filenames.
- Returns:
- Name of the tile layer
getMaxZoom
public int getMaxZoom()
- Description copied from interface:
TileSource
- Specifies the maximum zoom value. The number of zoom levels is [0..
TileSource.getMaxZoom()
].
- Returns:
- maximum zoom value that has to be smaller or equal to
JMapViewer.MAX_ZOOM
getMinZoom
public int getMinZoom()
- Description copied from interface:
TileSource
- Specifies the minimum zoom value. This value is usually 0.
Only for maps that cover a certain region up to a limited zoom level
this method should return a value different than 0.
- Returns:
- minimum zoom value - usually 0
getExtension
public java.lang.String getExtension()
getTilePath
public java.lang.String getTilePath(int zoom,
int tilex,
int tiley)
throws java.io.IOException
- Throws:
java.io.IOException
- when subclass cannot return the tile URL
getBaseUrl
public java.lang.String getBaseUrl()
getTileUrl
public java.lang.String getTileUrl(int zoom,
int tilex,
int tiley)
throws java.io.IOException
- Description copied from interface:
TileSource
- Constructs the tile url.
- Returns:
- fully qualified url for downloading the specified tile image
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getTileType
public java.lang.String getTileType()
- Description copied from interface:
TileSource
- Specifies the tile image type. For tiles rendered by Mapnik or
Osmarenderer this is usually
"png"
.
- Returns:
- file extension of the tile image type
getTileSize
public int getTileSize()
- Description copied from interface:
TileSource
- Specifies how large each tile is.
- Returns:
- The size of a single tile in pixels.
latToTileY
public double latToTileY(double lat,
int zoom)
lonToTileX
public double lonToTileX(double lon,
int zoom)
tileYToLat
public double tileYToLat(int y,
int zoom)
tileXToLon
public double tileXToLon(int x,
int zoom)
JOSM