AI-generated Key Takeaways
-
UrlTileProvideris a partial implementation ofTileProvidersimplifying tile creation by using image URLs. -
It requires all tile images to have identical dimensions, specified during construction.
-
The core functionality involves implementing
getTileUrlto provide URLs for tile images based on coordinates and zoom level. -
If a tile image is unavailable, the method should return null, triggering retry attempts with exponential backoff.
implements TileProvider
A partial implementation of TileProvider that only requires a URL that points to an image
to be provided.
Note that this class requires that all the images have the same dimensions.
Inherited Field Summary
Public Constructor Summary
|
UrlTileProvider(int width, int height)
Constructs a UrlTileProvider.
|
Public Method Summary
| final Tile |
getTile(int x, int y, int zoom)
Returns the tile to be used for this tile coordinate.
|
| abstract URL |
getTileUrl(int x, int y, int zoom)
Returns a
URL that points to the image to be used for this tile. |
Inherited Method Summary
Public Constructors
public UrlTileProvider (int width, int height)
Constructs a UrlTileProvider.
Parameters
| width | width of the images used for tiles |
|---|---|
| height | height of the images used for tiles |
Public Methods
public final Tile getTile (int x, int y, int zoom)
Returns the tile to be used for this tile coordinate.
Parameters
| x | The x coordinate of the tile. This will be in the range [0, 2zoom - 1] inclusive. |
|---|---|
| y | The y coordinate of the tile. This will be in the range [0, 2zoom - 1] inclusive. |
| zoom | The zoom level of the tile. This will be in the range [ GoogleMap.getMinZoomLevel, GoogleMap.getMaxZoomLevel]
inclusive. |
public abstract URL getTileUrl (int x, int y, int zoom)
Returns a URL that points to the image to be used for this tile. If no image is found
on the initial request, further requests will be made with an exponential backoff. If you do
not wish to provide an image for this tile coordinate, return null.
Parameters
| x | The x coordinate of the tile. This will be in the range [0, 2zoom - 1] inclusive. |
|---|---|
| y | The y coordinate of the tile. This will be in the range [0, 2zoom - 1] inclusive. |
| zoom | The zoom level of the tile. This will be in the range [ GoogleMap.getMinZoomLevel, GoogleMap.getMaxZoomLevel]
inclusive. |
Returns
- URL a
URLthat points to the image to be used for this tile. If you do not wish to provide an image for this tile coordinate, returnnull.