org.openstreetmap.josm.gui.bbox
Class SlippyMapBBoxChooser.RenamedSourceDecorator

java.lang.Object
  extended by org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser.RenamedSourceDecorator
All Implemented Interfaces:
Attributed, TileSource
Enclosing class:
SlippyMapBBoxChooser

public static class SlippyMapBBoxChooser.RenamedSourceDecorator
extends java.lang.Object
implements TileSource


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.openstreetmap.gui.jmapviewer.interfaces.TileSource
TileSource.TileUpdate
 
Field Summary
private  java.lang.String name
           
private  TileSource source
           
 
Constructor Summary
SlippyMapBBoxChooser.RenamedSourceDecorator(TileSource source, java.lang.String name)
           
 
Method Summary
 java.awt.Image getAttributionImage()
           
 java.lang.String getAttributionImageURL()
           
 java.lang.String getAttributionLinkURL()
           
 java.lang.String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight)
           
 int getMaxZoom()
          Specifies the maximum zoom value.
 int getMinZoom()
          Specifies the minimum zoom value.
 java.lang.String getName()
          A tile layer name has to be unique and has to consist only of characters valid for filenames.
 java.lang.String getTermsOfUseText()
           
 java.lang.String getTermsOfUseURL()
           
 int getTileSize()
          Specifies how large each tile is.
 java.lang.String getTileType()
          Specifies the tile image type.
 TileSource.TileUpdate getTileUpdate()
           
 java.lang.String getTileUrl(int zoom, int tilex, int tiley)
          Constructs the tile url.
 double latToTileY(double lat, int zoom)
           
 double lonToTileX(double lon, int zoom)
           
 boolean requiresAttribution()
           
 double tileXToLon(int x, int zoom)
           
 double tileYToLat(int y, int zoom)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private final TileSource source

name

private final java.lang.String name
Constructor Detail

SlippyMapBBoxChooser.RenamedSourceDecorator

public SlippyMapBBoxChooser.RenamedSourceDecorator(TileSource source,
                                                   java.lang.String name)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: TileSource
A tile layer name has to be unique and has to consist only of characters valid for filenames.

Specified by:
getName in interface TileSource
Returns:
Name of the tile layer

getMaxZoom

public int getMaxZoom()
Description copied from interface: TileSource
Specifies the maximum zoom value. The number of zoom levels is [0.. TileSource.getMaxZoom()].

Specified by:
getMaxZoom in interface TileSource
Returns:
maximum zoom value that has to be smaller or equal to JMapViewer.MAX_ZOOM

getMinZoom

public int getMinZoom()
Description copied from interface: TileSource
Specifies the minimum zoom value. This value is usually 0. Only for maps that cover a certain region up to a limited zoom level this method should return a value different than 0.

Specified by:
getMinZoom in interface TileSource
Returns:
minimum zoom value - usually 0

getTileSize

public int getTileSize()
Description copied from interface: TileSource
Specifies how large each tile is.

Specified by:
getTileSize in interface TileSource
Returns:
The size of a single tile in pixels.

getTileType

public java.lang.String getTileType()
Description copied from interface: TileSource
Specifies the tile image type. For tiles rendered by Mapnik or Osmarenderer this is usually "png".

Specified by:
getTileType in interface TileSource
Returns:
file extension of the tile image type

getTileUpdate

public TileSource.TileUpdate getTileUpdate()
Specified by:
getTileUpdate in interface TileSource
Returns:
The supported tile update mechanism
See Also:
TileSource.TileUpdate

getTileUrl

public java.lang.String getTileUrl(int zoom,
                                   int tilex,
                                   int tiley)
                            throws java.io.IOException
Description copied from interface: TileSource
Constructs the tile url.

Specified by:
getTileUrl in interface TileSource
Returns:
fully qualified url for downloading the specified tile image
Throws:
java.io.IOException

requiresAttribution

public boolean requiresAttribution()
Specified by:
requiresAttribution in interface Attributed
Returns:
True if the tile source requires attribution in text or image form.

getAttributionText

public java.lang.String getAttributionText(int zoom,
                                           Coordinate topLeft,
                                           Coordinate botRight)
Specified by:
getAttributionText in interface Attributed
Parameters:
zoom - The optional zoom level for the view.
topLeft - The top left of the bounding box for attribution.
botRight - The bottom right of the bounding box for attribution.
Returns:
Attribution text for the image source.

getAttributionLinkURL

public java.lang.String getAttributionLinkURL()
Specified by:
getAttributionLinkURL in interface Attributed
Returns:
The URL to open when the user clicks the attribution text.

getAttributionImage

public java.awt.Image getAttributionImage()
Specified by:
getAttributionImage in interface Attributed
Returns:
The URL for the attribution image. Null if no image should be displayed.

getAttributionImageURL

public java.lang.String getAttributionImageURL()
Specified by:
getAttributionImageURL in interface Attributed
Returns:
The URL to open when the user clicks the attribution image. When return value is null, the image is still displayed (provided getAttributionImage() returns a value other than null), but the image does not link to a website.

getTermsOfUseText

public java.lang.String getTermsOfUseText()
Specified by:
getTermsOfUseText in interface Attributed
Returns:
The attribution "Terms of Use" text. In case it returns null, but getTermsOfUseURL() is not null, a default terms of use text is used.

getTermsOfUseURL

public java.lang.String getTermsOfUseURL()
Specified by:
getTermsOfUseURL in interface Attributed
Returns:
The URL to open when the user clicks the attribution "Terms of Use" text.

latToTileY

public double latToTileY(double lat,
                         int zoom)
Specified by:
latToTileY in interface TileSource

lonToTileX

public double lonToTileX(double lon,
                         int zoom)
Specified by:
lonToTileX in interface TileSource

tileYToLat

public double tileYToLat(int y,
                         int zoom)
Specified by:
tileYToLat in interface TileSource

tileXToLon

public double tileXToLon(int x,
                         int zoom)
Specified by:
tileXToLon in interface TileSource


JOSM