Class TileFactoryInfo

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String baseURL
      The base url for loading tiles from.
      protected double[] longitudeDegreeWidthInPixels
      An array of doubles that contain the number of pixels per degree of longitude at a give zoom level.
      protected double[] longitudeRadianWidthInPixels
      An array of doubles that contain the number of radians per degree of longitude at a given zoom level (where longitudeRadianWidthInPixels[0] is the most zoomed out)
      protected java.awt.geom.Point2D[] mapCenterInPixelsAtZoom
      An array of coordinates in pixels that indicates the center in the world map for the given zoom level.
      protected int[] mapWidthInTilesAtZoom  
      protected int maximumZoomLevel  
      protected int minimumZoomLevel  
      protected int totalMapZoom  
    • Constructor Summary

      Constructors 
      Constructor Description
      TileFactoryInfo​(int minimumZoomLevel, int maximumZoomLevel, int totalMapZoom, int tileSize, boolean xr2l, boolean yt2b, java.lang.String baseURL, java.lang.String xparam, java.lang.String yparam, java.lang.String zparam)
      Creates a new instance of TileFactoryInfo.
      TileFactoryInfo​(java.lang.String name, int minimumZoomLevel, int maximumZoomLevel, int totalMapZoom, int tileSize, boolean xr2l, boolean yt2b, java.lang.String baseURL, java.lang.String xparam, java.lang.String yparam, java.lang.String zparam)
      Creates a new instance of TileFactoryInfo.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getDefaultZoomLevel​()  
      java.lang.String getLanguage​()
      Get language
      double getLongitudeDegreeWidthInPixels​(int zoom)
      Get longitude degree within pixels
      double getLongitudeRadianWidthInPixels​(int zoom)
      Get longitude radian width in pixels
      java.awt.geom.Point2D getMapCenterInPixelsAtZoom​(int zoom)
      Get map center in pixels at zoom
      int getMapWidthInTilesAtZoom​(int zoom)
      Get map width in tiles at zoom
      int getMaximumZoomLevel​()
      Get maximum zoom level
      int getMinimumZoomLevel​()
      Get minimum zoom level
      java.lang.String getName​()
      The name of this info.
      protected int getServerNum​(int x, int y, int max)  
      int getTileSize​(int zoom)
      Get the tile size.
      java.lang.String getTileUrl​(int x, int y, int zoom)
      Returns the tile url for the specified tile at the specified zoom level.
      int getTotalMapZoom​()
      Get total map zoom
      boolean isXr2l​()
      A property indicating if the X coordinates of tiles go from right to left or left to right.
      boolean isYt2b​()
      A property indicating if the Y coordinates of tiles go from right to left or left to right.
      void setDefaultZoomLevel​(int defaultZoomLevel)  
      void setLanguage​(java.lang.String value)
      Set language
      void setXr2l​(boolean xr2l)
      A property indicating if the X coordinates of tiles go from right to left or left to right.
      void setYt2b​(boolean yt2b)
      A property indicating if the Y coordinates of tiles go from right to left or left to right.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • minimumZoomLevel

        protected int minimumZoomLevel
      • maximumZoomLevel

        protected int maximumZoomLevel
      • totalMapZoom

        protected int totalMapZoom
      • mapWidthInTilesAtZoom

        protected int[] mapWidthInTilesAtZoom
      • mapCenterInPixelsAtZoom

        protected java.awt.geom.Point2D[] mapCenterInPixelsAtZoom
        An array of coordinates in pixels that indicates the center in the world map for the given zoom level.
      • longitudeDegreeWidthInPixels

        protected double[] longitudeDegreeWidthInPixels
        An array of doubles that contain the number of pixels per degree of longitude at a give zoom level.
      • longitudeRadianWidthInPixels

        protected double[] longitudeRadianWidthInPixels
        An array of doubles that contain the number of radians per degree of longitude at a given zoom level (where longitudeRadianWidthInPixels[0] is the most zoomed out)
      • baseURL

        protected java.lang.String baseURL
        The base url for loading tiles from.
    • Constructor Detail

      • TileFactoryInfo

        public TileFactoryInfo​(int minimumZoomLevel,
                               int maximumZoomLevel,
                               int totalMapZoom,
                               int tileSize,
                               boolean xr2l,
                               boolean yt2b,
                               java.lang.String baseURL,
                               java.lang.String xparam,
                               java.lang.String yparam,
                               java.lang.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​(java.lang.String name,
                               int minimumZoomLevel,
                               int maximumZoomLevel,
                               int totalMapZoom,
                               int tileSize,
                               boolean xr2l,
                               boolean yt2b,
                               java.lang.String baseURL,
                               java.lang.String xparam,
                               java.lang.String yparam,
                               java.lang.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​()
        Get minimum zoom level
        Returns:
        Minimum zoom level
      • getMaximumZoomLevel

        public int getMaximumZoomLevel​()
        Get maximum zoom level
        Returns:
        Maximum zoom level
      • getTotalMapZoom

        public int getTotalMapZoom​()
        Get total map zoom
        Returns:
        Total map zoom
      • getMapWidthInTilesAtZoom

        public int getMapWidthInTilesAtZoom​(int zoom)
        Get map width in tiles at zoom
        Parameters:
        zoom - The zoom
        Returns:
        Map width
      • getMapCenterInPixelsAtZoom

        public java.awt.geom.Point2D getMapCenterInPixelsAtZoom​(int zoom)
        Get map center in pixels at zoom
        Parameters:
        zoom - The zoom
        Returns:
        Map center
      • getTileUrl

        public java.lang.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:
        x - X
        y - Y
        zoom - the zoom level
        Returns:
        a valid url to load the tile
      • getTileSize

        public int getTileSize​(int zoom)
        Get the tile size.
        Parameters:
        zoom - Zoom
        Returns:
        the tile size
      • getServerNum

        protected int getServerNum​(int x,
                                   int y,
                                   int max)
      • getLongitudeDegreeWidthInPixels

        public double getLongitudeDegreeWidthInPixels​(int zoom)
        Get longitude degree within pixels
        Parameters:
        zoom - The zoom
        Returns:
        Longitude degree
      • getLongitudeRadianWidthInPixels

        public double getLongitudeRadianWidthInPixels​(int zoom)
        Get longitude radian width in pixels
        Parameters:
        zoom - The zoom
        Returns:
        Longitude radian width
      • isXr2l

        public boolean isXr2l​()
        A property indicating if the X coordinates of tiles go from right to left or left to right.
        Returns:
        Boolean
      • 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:
        Boolean
      • 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 java.lang.String getName​()
        The name of this info.
        Returns:
        Returns the name of this info class for debugging or GUI widgets.
      • getLanguage

        public java.lang.String getLanguage​()
        Get language
        Returns:
        The language
      • setLanguage

        public void setLanguage​(java.lang.String value)
        Set language
        Parameters:
        value - The language