Class DemoTileSource

java.lang.Object
com.codename1.maps.vector.DemoTileSource
All Implemented Interfaces:
TileSource

public final class DemoTileSource extends Object implements TileSource
A self-contained TileSource that synthesizes a deterministic Mapbox Vector Tile in memory for every address, with no network or bundled assets. Every tile carries the same recognizable content -- a water body, a landuse area, two roads, a building and a labeled place -- which makes it ideal for offline demos and for reproducible map screenshot tests.
  • Constructor Details

    • DemoTileSource

      public DemoTileSource()
  • Method Details

    • isVector

      public boolean isVector()
      True for MVT vector tiles, false for raster image tiles.
      Specified by:
      isVector in interface TileSource
    • getTileSize

      public int getTileSize()
      The tile edge in pixels (almost always 256).
      Specified by:
      getTileSize in interface TileSource
    • getMinZoom

      public int getMinZoom()
      The smallest zoom level this source serves.
      Specified by:
      getMinZoom in interface TileSource
    • getMaxZoom

      public int getMaxZoom()
      The largest zoom level this source serves.
      Specified by:
      getMaxZoom in interface TileSource
    • getAttribution

      public String getAttribution()
      Attribution text that must be displayed over the map.
      Specified by:
      getAttribution in interface TileSource
    • fetchTile

      public void fetchTile(int z, int x, int y, TileCallback callback)
      Requests the tile at z/x/y, delivering the result to callback on the event dispatch thread.
      Specified by:
      fetchTile in interface TileSource
    • buildTile

      public static byte[] buildTile() throws IOException
      Builds the synthetic MVT payload. Public and static so unit tests and the demo can reuse exactly the same bytes.
      Throws:
      IOException