|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maryanovsky.map.client.ImageTileLayer
public class ImageTileLayer
An implementation of tile layers in which each tile consists of a single
image retrieved from a URL. The URL for each tile is constructed from a
pattern; see ImageTileLayer(SizeView, String)
for more information.
Constructor Summary | |
---|---|
ImageTileLayer(SizeView tileImageSize,
String tileUrlPattern)
Creates a new ImageTileLayer with the specified tile image
size and tile URL pattern. |
Method Summary | |
---|---|
Tile |
getTile(int x,
int y,
int zoom)
Returns the tile to display at the specified location (in pixels, relative to the top-left of the map) and zoom. |
SizeView |
getTileSize()
Returns the size of tiles. |
protected String |
getTileUrl(int xIndex,
int yIndex,
int zoom)
Returns the URL of the tile image at the specified zoom and indices, or null if none. |
protected String |
getTileUrl(String xArg,
String yArg,
String zoomArg)
Returns the URL of the tile image at the specified zoom and indices. |
void |
releaseTile(Tile tile)
Releases any resources associated with the specified tile that was returned by TileLayer.getTile(int, int, int) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageTileLayer(SizeView tileImageSize, String tileUrlPattern)
Creates a new ImageTileLayer
with the specified tile image
size and tile URL pattern. The pattern is used to obtain a URL from the x
index, y index and the zoom of a tile in the following manner:
{x}
in the pattern is
replaced with the x index.{y}
in the pattern is
replaced with the y index.{zoom}
in the pattern is
replaced with the x index.[
(square bracket open), ends with ]
(square bracket close),
and contains a list of comma separated strings is replaced with a
pseudorandomly chosen string from that list.The first three replacement rules allow specifying the positions of the x and y indices and the zoom value within the URL. The last rule allows specifying the different domains at which the tiles are available. This is commonly used to work around the browser limitation on the number of simultaneous connections to a single domain.
Example: the pattern
http://tile[1,2,3].mymaps.com/plain/{zoom}/{x}_{y}.png
could produce the URL
http://tile2.mymaps.com/plain/9/734_983.png
.
Method Detail |
---|
public SizeView getTileSize()
getTileSize
in interface TileLayer
public Tile getTile(int x, int y, int zoom)
null
if there is no tile at the specified location, if, for example, it is
outside the boundaries of the map.
getTile
in interface TileLayer
public void releaseTile(Tile tile)
TileLayer.getTile(int, int, int)
.
releaseTile
in interface TileLayer
protected String getTileUrl(int xIndex, int yIndex, int zoom)
null
if none. Note that xIndex
and
yIndex
are not pixel coordinates like in
TileLayer.getTile(int, int, int)
, but the indices of the tiles
in their respective row and column at the tile grid of the specified
zoom.
The default implementation converts the three arguments to string
representations via String.valueOf(int)
and invokes
getTileUrl(int, int, int)
. You should override this method if
you need to perform some checks or possibly change the values of the
parameters, or if you need a different representation of them to be
inserted into the pattern.
protected String getTileUrl(String xArg, String yArg, String zoomArg)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |