Class TPKFile


  • public class TPKFile
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      TPKFile​(File theFile, Map<Long,​TPKZoomLevel> zoomLevelMap)
      Constructor -- used for first open of a TPK file, parses the conf.xml file and builds the zoomLevelMap
      TPKFile​(File theFile, Map<Long,​TPKZoomLevel> zoomLevelMap, Bounds bounds, String imageFormat)
      Constructor -- used for all subsequent opens of the TPK file (ie once the zoomLevelMap has been created)
    • Constructor Detail

      • TPKFile

        public TPKFile​(File theFile,
                       Map<Long,​TPKZoomLevel> zoomLevelMap)
        Constructor -- used for first open of a TPK file, parses the conf.xml file and builds the zoomLevelMap
        Parameters:
        theFile - -- the TPK file in question
        zoomLevelMap - -- reference to an empty hashmap object that we will populate
      • TPKFile

        public TPKFile​(File theFile,
                       Map<Long,​TPKZoomLevel> zoomLevelMap,
                       Bounds bounds,
                       String imageFormat)
        Constructor -- used for all subsequent opens of the TPK file (ie once the zoomLevelMap has been created)
        Parameters:
        theFile - -- the TPK file
        zoomLevelMap - -- previously constructed zoomLevelMap
        bounds - -- bounds of the map
        imageFormat - -- the image format being used
    • Method Detail

      • close

        public void close()
        Called to close the TPK file and release resources being held
      • getMinZoomLevel

        public long getMinZoomLevel()
        Returns:
        -- the minimum Web Tile Service zoom level contained in the TPK
      • getMaxZoomLevel

        public long getMaxZoomLevel()
        Returns:
        -- the maximum Web Tile Service zoom level contained in the TPK
      • getImageFormat

        public String getImageFormat()
        Returns:
        -- the image format used in the TPK (eg JPEG, PNG)
      • getBounds

        public Bounds getBounds()
        Using the highest zoom level contained in the TPK file use the tile coverage to calculate the geographical bounds of the map
        Returns:
        -- the geographical coverage of the map
      • getClosestZoom

        public long getClosestZoom​(long zoomLevel)
        Find the closest zoom level in the TPK to the given zoom level
        Parameters:
        zoomLevel - -- zoom level to match or approximate
        Returns:
        -- the given zoom level of the nearest one to it
      • getMinColumn

        public long getMinColumn​(long zoomLevel)
        Find the minimum Web Tile Map Service column number for the given zoom level
        Parameters:
        zoomLevel - -- zoom level in question
        Returns:
        -- -1 if zoom level not in TPK else minimum column at zoom level
      • getMaxColumn

        public long getMaxColumn​(long zoomLevel)
        Find the maximum Web Tile Map Service column number for the given zoom level
        Parameters:
        zoomLevel - -- zoom level in question
        Returns:
        -- -1 if zoom level not in TPK else maximum column at zoom level
      • getMinRow

        public long getMinRow​(long zoomLevel)
        Find the minimum Web Tile Map Service row number for the given zoom level
        Parameters:
        zoomLevel - -- zoom level in question
        Returns:
        -- -1 if zoom level not in TPK else minimum row at zoom level
      • getMaxRow

        public long getMaxRow​(long zoomLevel)
        Find the maximum Web Tile Map Service row number for the given zoom level
        Parameters:
        zoomLevel - -- zoom level in question
        Returns:
        -- -1 if zoom level not in TPK else maximum row at zoom level
      • getTiles

        public List<TPKTile> getTiles​(long zoomLevel,
                                      long top,
                                      long bottom,
                                      long left,
                                      long right,
                                      String format)
        Return a list of tile objects, each with its intended location, format and raw data
        Parameters:
        zoomLevel - -- zoom level of tiles to return
        top - -- topmost row of tiles (lattitude)
        bottom - -- bottommost row of tiles
        left - -- leftmost column of tiles (longitude)
        right - -- rightmost column of tiles
        format - -- format to interpret tile data (PNG, JPEG)
        Returns:
        -- list of TPKTile objects