Modifier and Type | Class and Description |
---|---|
private static class |
Tile.CachedCallable<V> |
Modifier and Type | Field and Description |
---|---|
protected boolean |
error |
static BufferedImage |
ERROR_IMAGE
Red cross image that is displayed after a loading error, except for overlay sources
|
protected String |
error_message |
protected BufferedImage |
image |
protected String |
key |
protected boolean |
loaded |
protected boolean |
loading |
static BufferedImage |
LOADING_IMAGE
Hourglass image that is displayed until a map tile has been loaded, except for overlay sources
|
protected Map<String,String> |
metadata
TileLoader-specific tile metadata
|
protected TileSource |
source |
protected int |
xtile |
protected int |
ytile |
protected int |
zoom |
Constructor and Description |
---|
Tile(TileSource source,
int xtile,
int ytile,
int zoom)
Creates a tile with empty image.
|
Tile(TileSource source,
int xtile,
int ytile,
int zoom,
BufferedImage image)
Creates a tile with specified image.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
|
void |
finishLoading()
indicate that loading process for this tile has ended
|
String |
getErrorMessage() |
BufferedImage |
getImage() |
String |
getKey() |
Map<String,String> |
getMetadata() |
TileSource |
getSource() |
String |
getStatus() |
static String |
getTileKey(TileSource source,
int xtile,
int ytile,
int zoom) |
TileSource |
getTileSource() |
String |
getUrl() |
String |
getValue(String key)
returns the metadata of the Tile
|
int |
getXtile()
Returns the X coordinate.
|
int |
getYtile()
Returns the Y coordinate.
|
int |
getZoom()
Returns the zoom level.
|
boolean |
hasError() |
int |
hashCode()
Note that the hash code does not include the
source . |
void |
initLoading()
indicate that loading process for this tile has started
|
boolean |
isLoaded() |
boolean |
isLoading() |
void |
loadImage(InputStream input) |
private static BufferedImage |
loadImage(String path) |
void |
loadingCanceled()
indicate that loading process for this tile has been canceled
|
void |
loadPlaceholderFromCache(TileCache cache)
Tries to get tiles of a lower or higher zoom level (one or two level
difference) from cache and use it as a placeholder until the tile has been loaded.
|
void |
paint(Graphics g,
int x,
int y)
|
void |
paint(Graphics g,
int x,
int y,
int width,
int height)
|
void |
putValue(String key,
String value)
Puts the given key/value pair to the metadata of the tile.
|
void |
setError(String message) |
void |
setImage(BufferedImage image) |
void |
setLoaded(boolean loaded) |
String |
toString() |
public static final BufferedImage LOADING_IMAGE
public static final BufferedImage ERROR_IMAGE
protected TileSource source
protected int xtile
protected int ytile
protected int zoom
protected BufferedImage image
protected volatile boolean loaded
protected volatile boolean loading
protected volatile boolean error
protected String error_message
public Tile(TileSource source, int xtile, int ytile, int zoom)
source
- Tile sourcextile
- X coordinateytile
- Y coordinatezoom
- Zoom levelpublic Tile(TileSource source, int xtile, int ytile, int zoom, BufferedImage image)
source
- Tile sourcextile
- X coordinateytile
- Y coordinatezoom
- Zoom levelimage
- Image contentprivate static BufferedImage loadImage(String path)
public void loadPlaceholderFromCache(TileCache cache)
cache
- Tile cachepublic TileSource getSource()
public int getXtile()
public int getYtile()
public int getZoom()
public BufferedImage getImage()
public void setImage(BufferedImage image)
public void loadImage(InputStream input) throws IOException
IOException
public boolean isLoaded()
public boolean isLoading()
public void setLoaded(boolean loaded)
public String getUrl() throws IOException
IOException
public void paint(Graphics g, int x, int y)
g
- the Graphics objectx
- x-coordinate in g
y
- y-coordinate in g
public void paint(Graphics g, int x, int y, int width, int height)
g
- the Graphics objectx
- x-coordinate in g
y
- y-coordinate in g
width
- width that tile should haveheight
- height that tile should havepublic int hashCode()
public static String getTileKey(TileSource source, int xtile, int ytile, int zoom)
public boolean hasError()
public String getErrorMessage()
public void putValue(String key, String value)
key
- Keyvalue
- Valuepublic String getValue(String key)
key
- metadata key that should be returnedpublic Map<String,String> getMetadata()
public void initLoading()
public void finishLoading()
public TileSource getTileSource()
public void loadingCanceled()