Class TileFactoryInfo

  • Direct Known Subclasses:
    OSMTileFactoryInfo, SLMapServerInfo, VirtualEarthTileFactoryInfo

    public class TileFactoryInfo
    extends Object
    A TileFactoryInfo encapsulates all information specific to a map server. This includes everything from the url to load the map tiles from to the size and depth of the tiles. Theoretically any map server can be used by installing a customized TileFactoryInfo.
    Author:
    joshy
    • Constructor Detail

      • TileFactoryInfo

        public TileFactoryInfo​(int minimumZoomLevel,
                               int maximumZoomLevel,
                               int totalMapZoom,
                               int tileSize,
                               boolean xr2l,
                               boolean yt2b,
                               String baseURL,
                               String xparam,
                               String yparam,
                               String zparam)
        Creates a new instance of TileFactoryInfo. Note that TileFactoryInfo should be considered invariate, meaning that subclasses should ensure all of the properties stay the same after the class is constructed. Returning different values of getTileSize() for example is considered an error and may result in unexpected behavior.
        Parameters:
        minimumZoomLevel - The minimum zoom level
        maximumZoomLevel - the maximum zoom level
        totalMapZoom - the top zoom level, essentially the height of the pyramid
        tileSize - the size of the tiles in pixels (must be square)
        xr2l - if the x goes r to l (is this backwards?)
        yt2b - if the y goes top to bottom
        baseURL - the base url for grabbing tiles
        xparam - the x parameter for the tile url
        yparam - the y parameter for the tile url
        zparam - the z parameter for the tile url
      • TileFactoryInfo

        public TileFactoryInfo​(String name,
                               int minimumZoomLevel,
                               int maximumZoomLevel,
                               int totalMapZoom,
                               int tileSize,
                               boolean xr2l,
                               boolean yt2b,
                               String baseURL,
                               String xparam,
                               String yparam,
                               String zparam)
        Creates a new instance of TileFactoryInfo. Note that TileFactoryInfo should be considered invariate, meaning that subclasses should ensure all of the properties stay the same after the class is constructed. Returning different values of getTileSize() for example is considered an error and may result in unexpected behavior.
        Parameters:
        name - A name to identify this information.
        minimumZoomLevel - The minimum zoom level
        maximumZoomLevel - the maximum zoom level
        totalMapZoom - the top zoom level, essentially the height of the pyramid
        tileSize - the size of the tiles in pixels (must be square)
        xr2l - if the x goes r to l (is this backwards?)
        yt2b - if the y goes top to bottom
        baseURL - the base url for grabbing tiles
        xparam - the x parameter for the tile url
        yparam - the y parameter for the tile url
        zparam - the z parameter for the tile url
    • Method Detail

      • getMinimumZoomLevel

        public int getMinimumZoomLevel()
        Returns:
      • getMaximumZoomLevel

        public int getMaximumZoomLevel()
        Returns:
      • getTotalMapZoom

        public int getTotalMapZoom()
        Returns:
      • getMapWidthInTilesAtZoom

        public int getMapWidthInTilesAtZoom​(int zoom)
        Parameters:
        zoom -
        Returns:
      • getMapCenterInPixelsAtZoom

        public Point2D getMapCenterInPixelsAtZoom​(int zoom)
        Parameters:
        zoom -
        Returns:
      • getTileUrl

        public String getTileUrl​(int x,
                                 int y,
                                 int zoom)
        Returns the tile url for the specified tile at the specified zoom level. By default it will generate a tile url using the base url and parameters specified in the constructor. Thus if
        baseURl = http://www.myserver.com/maps?version=0.1 
         xparam = x 
         yparam = y 
         zparam = z 
         tilepoint = [1,2]
         zoom level = 3
         
         
        then the resulting url would be:
        http://www.myserver.com/maps?version=0.1&x=1&y=2&z=3
        Note that the URL can be a file: url.
        Parameters:
        zoom - the zoom level
        tilePoint - the tile point
        Returns:
        a valid url to load the tile
      • getTileSize

        public int getTileSize​(int zoom)
        Get the tile size.
        Returns:
        the tile size
      • getLongitudeDegreeWidthInPixels

        public double getLongitudeDegreeWidthInPixels​(int zoom)
        Parameters:
        zoom -
        Returns:
      • getLongitudeRadianWidthInPixels

        public double getLongitudeRadianWidthInPixels​(int zoom)
        Parameters:
        zoom -
        Returns:
      • isXr2l

        public boolean isXr2l()
        A property indicating if the X coordinates of tiles go from right to left or left to right.
        Returns:
      • setXr2l

        public void setXr2l​(boolean xr2l)
        A property indicating if the X coordinates of tiles go from right to left or left to right.
        Parameters:
        xr2l -
      • isYt2b

        public boolean isYt2b()
        A property indicating if the Y coordinates of tiles go from right to left or left to right.
        Returns:
      • setYt2b

        public void setYt2b​(boolean yt2b)
        A property indicating if the Y coordinates of tiles go from right to left or left to right.
        Parameters:
        yt2b -
      • getDefaultZoomLevel

        public int getDefaultZoomLevel()
      • setDefaultZoomLevel

        public void setDefaultZoomLevel​(int defaultZoomLevel)
      • getName

        public String getName()
        The name of this info.
        Returns:
        Returns the name of this info class for debugging or GUI widgets.
      • getCacheInfo

        public TileCacheInfo getCacheInfo​(URI uri)
        Translates URI to
        Parameters:
        uri -
        Returns:
      • setIconUrl

        public void setIconUrl​(URL iconUrl)
      • getIconUrl

        public URL getIconUrl()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • recalculateZoom

        protected int recalculateZoom​(int zoom)
      • setPersistent

        public void setPersistent​(boolean persistent)
      • isPersistent

        public boolean isPersistent()