Class TileFactoryInfo
- java.lang.Object
-
- org.meteoinfo.data.mapdata.webmap.TileFactoryInfo
-
- Direct Known Subclasses:
AHybridMapInfo,AMapInfo,ArcGISImageInfo,ASatelliteMapInfo,BaiduMapInfo,BaiduSatelliteMapInfo,BingHybridMapInfo,BingMapInfo,BingSatelliteMapInfo,GoogleHybridMapInfo,GoogleHybridTerrainMapInfo,GoogleMapInfo,GoogleSatelliteMapInfo,GoogleTerrainMapInfo,OpenStreetMapInfo,OpenStreetMapQuestSatelliteInfo,OviHybridMapInfo,OviMapInfo,OviSatelliteMapInfo,OviTerrainMapInfo,SLMapServerInfo,TencentMapInfo,YahooHybridMapInfo,YahooMapInfo,YahooSatelliteMapInfo
public class TileFactoryInfo extends java.lang.ObjectA 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. Currently
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbaseURLThe base url for loading tiles from.protected double[]longitudeDegreeWidthInPixelsAn array of doubles that contain the number of pixels per degree of longitude at a give zoom level.protected double[]longitudeRadianWidthInPixelsAn 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[]mapCenterInPixelsAtZoomAn array of coordinates in pixels that indicates the center in the world map for the given zoom level.protected int[]mapWidthInTilesAtZoomprotected intmaximumZoomLevelprotected intminimumZoomLevelprotected inttotalMapZoom
-
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 intgetDefaultZoomLevel()java.lang.StringgetLanguage()Get languagedoublegetLongitudeDegreeWidthInPixels(int zoom)Get longitude degree within pixelsdoublegetLongitudeRadianWidthInPixels(int zoom)Get longitude radian width in pixelsjava.awt.geom.Point2DgetMapCenterInPixelsAtZoom(int zoom)Get map center in pixels at zoomintgetMapWidthInTilesAtZoom(int zoom)Get map width in tiles at zoomintgetMaximumZoomLevel()Get maximum zoom levelintgetMinimumZoomLevel()Get minimum zoom leveljava.lang.StringgetName()The name of this info.protected intgetServerNum(int x, int y, int max)intgetTileSize(int zoom)Get the tile size.java.lang.StringgetTileUrl(int x, int y, int zoom)Returns the tile url for the specified tile at the specified zoom level.intgetTotalMapZoom()Get total map zoombooleanisXr2l()A property indicating if the X coordinates of tiles go from right to left or left to right.booleanisYt2b()A property indicating if the Y coordinates of tiles go from right to left or left to right.voidsetDefaultZoomLevel(int defaultZoomLevel)voidsetLanguage(java.lang.String value)Set languagevoidsetXr2l(boolean xr2l)A property indicating if the X coordinates of tiles go from right to left or left to right.voidsetYt2b(boolean yt2b)A property indicating if the Y coordinates of tiles go from right to left or left to right.
-
-
-
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 levelmaximumZoomLevel- the maximum zoom leveltotalMapZoom- the top zoom level, essentially the height of the pyramidtileSize- 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 bottombaseURL- the base url for grabbing tilesxparam- the x parameter for the tile urlyparam- the y parameter for the tile urlzparam- 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 levelmaximumZoomLevel- the maximum zoom leveltotalMapZoom- the top zoom level, essentially the height of the pyramidtileSize- 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 bottombaseURL- the base url for grabbing tilesxparam- the x parameter for the tile urlyparam- the y parameter for the tile urlzparam- 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
then the resulting url would be:baseURl = http://www.myserver.com/maps?version=0.1 xparam = x yparam = y zparam = z tilepoint = [1,2] zoom level = 3
Note that the URL can be ahttp://www.myserver.com/maps?version=0.1&x=1&y=2&z=3file:url.- Parameters:
x- Xy- Yzoom- 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
-
-