Package globus.glmap

Class GLMapRasterTileSource

java.lang.Object
globus.glmap.GLNativeObject
globus.glmap.GLMapRasterTileSource
All Implemented Interfaces:
GLMapTileSource

@ParametersAreNonnullByDefault
public class GLMapRasterTileSource
extends GLNativeObject
implements GLMapTileSource
GLMapRasterTileSource setups custom raster tile source.
  • Constructor Summary

    Constructors 
    Constructor Description
    GLMapRasterTileSource​(java.lang.String cachePath)
    Default constructor of GLMapRasterTileSource
  • Method Summary

    Modifier and Type Method Description
    android.graphics.Bitmap bitmapForTilePos​(int x, int y, int z)
    Gets bitmap of tile.
    long cacheSize()
    Returns size of cache database
    void dropCache()
    Drops cached tiles
    int getTileSize()
    Returns size of tile in points.
    void setAttributionText​(java.lang.String text)
    Sets attribution text.
    void setCanOverlapTiles​(boolean canOverlapTiles)
    Allows overlap tiles from different zoom levels.
    void setOverzoom​(boolean overzoom)
    Allows to draw tiles after maximum zoom
    void setTileRefreshTimeInterval​(long tileRefreshTimeInterval)
    Cached tile will be refreshed if it will stay in cache more than given time.
    void setTileSize​(int tileSize)
    Sets size of tile in points.
    void setValidZoomMask​(int validZoomMask)
    Defines valid zooms for tile source.
    java.lang.String urlForTilePos​(int x, int y, int z)
    Gets url of tile.
    void willAttach​(GLMapView mapView)
    Called when layer will be attached to map view
    void willDetach​(GLMapView mapView)
    Called when layer will be detached from map view

    Methods inherited from class globus.glmap.GLNativeObject

    dispose

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GLMapRasterTileSource

      public GLMapRasterTileSource​(@Nullable java.lang.String cachePath) throws java.lang.OutOfMemoryError
      Default constructor of GLMapRasterTileSource
      Parameters:
      cachePath - Path where database with cached tiles will be stored. If cachePath is `null` no caching will happens.
      Throws:
      java.lang.OutOfMemoryError
  • Method Details

    • urlForTilePos

      @Nullable public java.lang.String urlForTilePos​(int x, int y, int z)
      Gets url of tile. Default implementation return nil.
      Parameters:
      x - x coordinate of tile
      y - y coordinate of tile
      z - z coordinate of tile
      Returns:
      URL of the tile
    • bitmapForTilePos

      @Nullable public android.graphics.Bitmap bitmapForTilePos​(int x, int y, int z)
      Gets bitmap of tile. Default implementation return nil.
      Parameters:
      x - x coordinate of tile
      y - y coordinate of tile
      z - z coordinate of tile
      Returns:
      URL of the tile
    • setTileRefreshTimeInterval

      public void setTileRefreshTimeInterval​(long tileRefreshTimeInterval)
      Cached tile will be refreshed if it will stay in cache more than given time. By default tileRefreshTimeInterval is -1. If tileRefreshTimeInterval less than zero no tile refreshing will be triggered.
      Parameters:
      tileRefreshTimeInterval - New refresh time interval for source
    • dropCache

      public void dropCache()
      Drops cached tiles
    • cacheSize

      public long cacheSize()
      Returns size of cache database
      Returns:
      size of cache database in bytes.
    • setValidZoomMask

      public void setValidZoomMask​(int validZoomMask)
      Defines valid zooms for tile source. Default is 0xFFFFFFFF.
      Parameters:
      validZoomMask - New zoom mask for tile source
    • setTileSize

      public void setTileSize​(int tileSize)
      Sets size of tile in points. Default is 256.
      Parameters:
      tileSize - New tile size for tile source
    • getTileSize

      public int getTileSize()
      Returns size of tile in points. Default is 256
      Returns:
      tile size in points
    • setAttributionText

      public void setAttributionText​(java.lang.String text)
      Sets attribution text. Default is "© OpenStreetMap"
      Parameters:
      text - New attribution text for tile source
    • setOverzoom

      public void setOverzoom​(boolean overzoom)
      Allows to draw tiles after maximum zoom
      Parameters:
      overzoom - if `true` will draw tiles after maximum zoom
    • setCanOverlapTiles

      public void setCanOverlapTiles​(boolean canOverlapTiles)
      Allows overlap tiles from different zoom levels.
      Parameters:
      canOverlapTiles - if `true` tiles from different zoom levels can overlap
    • willAttach

      public void willAttach​(GLMapView mapView)
      Description copied from interface: GLMapTileSource
      Called when layer will be attached to map view
      Specified by:
      willAttach in interface GLMapTileSource
      Parameters:
      mapView - map view where layer will be attached
    • willDetach

      public void willDetach​(GLMapView mapView)
      Description copied from interface: GLMapTileSource
      Called when layer will be detached from map view
      Specified by:
      willDetach in interface GLMapTileSource
      Parameters:
      mapView - map view from where layer will be detached