Package org.openstreetmap.josm.gui.layer
Class TMSLayer
- java.lang.Object
-
- org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
-
- org.openstreetmap.josm.gui.layer.Layer
-
- org.openstreetmap.josm.gui.layer.ImageryLayer
-
- org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer<T>
-
- org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer<org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource>
-
- org.openstreetmap.josm.gui.layer.TMSLayer
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener
,ProjectionChangeListener
,ImageryFilterSettings.FilterChangeListener
,TileSourceDisplaySettings.DisplaySettingsChangeListener
,MapViewPaintable
,NativeScaleLayer
,NavigatableComponent.ZoomChangeListener
,Destroyable
public class TMSLayer extends AbstractCachedTileSourceLayer<org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource> implements NativeScaleLayer
Class that displays a slippy map layer.- Since:
- 3715
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer
AbstractTileSourceLayer.PrecacheTask, AbstractTileSourceLayer.TileSet, AbstractTileSourceLayer.TileSourceLayerPopup
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.ImageryLayer
ImageryLayer.OffsetAction, ImageryLayer.OffsetMenuEntry
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.Layer
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
AbstractMapViewPaintable.CompatibilityModeLayerPainter
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.MapViewPaintable
MapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.layer.NativeScaleLayer
NativeScaleLayer.Scale, NativeScaleLayer.ScaleList
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
CACHE_REGION_NAME
static int
MAX_ZOOM
override minimum/maximum zoom level with those supported by JMapViewer, as these might be used in slippymap chooserstatic int
MIN_ZOOM
private static NativeScaleLayer.ScaleList
nativeScaleList
private static java.lang.String
PREFERENCE_PREFIX
static BooleanProperty
PROP_ADD_TO_SLIPPYMAP_CHOOSER
shall TMS layers be added to download dialogstatic IntegerProperty
PROP_MAX_ZOOM_LVL
maximum zoom level for TMS layerstatic IntegerProperty
PROP_MIN_ZOOM_LVL
minimum zoom level for TMS layer-
Fields inherited from class org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer
MAX_DISK_CACHE_SIZE
-
Fields inherited from class org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer
coordinateConverter, tileCache, tileLoader, tileSource, ZOOM_OFFSET
-
Fields inherited from class org.openstreetmap.josm.gui.layer.ImageryLayer
icon, info, PROP_SHARPEN_LEVEL
-
Fields inherited from class org.openstreetmap.josm.gui.layer.Layer
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
-
-
Constructor Summary
Constructors Constructor Description TMSLayer(ImageryInfo info)
Create a layer based on ImageryInfo
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.apache.commons.jcs3.access.CacheAccess<java.lang.String,BufferedImageCacheEntry>
getCache()
Returns cache for TMS region.protected java.lang.String
getCacheName()
java.util.Collection<java.lang.String>
getNativeProjections()
Get projections this imagery layer supports natively.NativeScaleLayer.ScaleList
getNativeScales()
Get native scales of this layer.protected java.lang.Class<? extends org.openstreetmap.gui.jmapviewer.interfaces.TileLoader>
getTileLoaderClass()
protected org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
getTileSource()
Creates and returns a new TileSource instance depending on theImageryInfo.ImageryType
of theImageryInfo
object specified in the constructor.static org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource
getTileSourceStatic(ImageryInfo info)
Creates and returns a new TileSource instance depending on theImageryInfo.ImageryType
of the passed ImageryInfo object.static org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource
getTileSourceStatic(ImageryInfo info, java.lang.Runnable attributionLoadedTask)
Creates and returns a new TileSource instance depending on theImageryInfo.ImageryType
of the passed ImageryInfo object.private static NativeScaleLayer.ScaleList
initNativeScaleList()
-
Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer
getCache, getDiskCacheSize, getTileLoaderFactory, getTileLoaderFactory, setTileLoaderFactory
-
Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer
actionSupportLayers, attachToMapView, checkMaxZoomLvl, checkMinZoomLvl, clearErrorTiles, clearTileCache, createAndOpenSaveFileChooser, createDisplaySettings, createMapViewPainter, createTile, decreaseZoomLevel, destroy, displaySettingsChanged, estimateTileCacheSize, filterChanged, getAdjustAction, getBestZoom, getCommonEntries, getDisplaySettings, getDownloadAreaToCacheTask, getHeaders, getInfoComponent, getLayerListEntries, getMaxZoomLvl, getMaxZoomLvl, getMenuEntries, getMinZoomLvl, getMinZoomLvl, getOffsetMenuEntries, getScaleFactor, getTileSet, getToolTipText, getZoomLevel, hookUpMapView, imageUpdate, increaseZoomLevel, initTileSource, isSavable, loadAllErrorTiles, loadAllTiles, paint, projectionChanged, registerMenuAddition, registerMenuAddition, setMaxZoomLvl, setMinZoomLvl, setZoomLevel, tileLoadingFinished, visitBoundingBox, zoomChanged, zoomDecreaseAllowed, zoomIncreaseAllowed
-
Methods inherited from class org.openstreetmap.josm.gui.layer.ImageryLayer
addImageProcessor, applyImageProcessors, create, createImageProcessor, createTextField, getChangesetSourceTag, getFilterSettings, getIcon, getImageProcessors, getInfo, getOffsetMenuItem, getOffsetMenuItem, getPPD, isMergable, mergeFrom, removeImageProcessor, toString
-
Methods inherited from class org.openstreetmap.josm.gui.layer.Layer
addPropertyChangeListener, checkSaveConditions, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getDefaultLayerPosition, getLabel, getName, getOpacity, getViewProjectionBounds, hasColor, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isVisible, nameSupportedProjections, onPostLoadFromFile, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible
-
Methods inherited from class org.openstreetmap.josm.gui.layer.AbstractMapViewPaintable
addInvalidationListener, invalidate, removeInvalidationListener
-
-
-
-
Field Detail
-
CACHE_REGION_NAME
private static final java.lang.String CACHE_REGION_NAME
- See Also:
- Constant Field Values
-
PREFERENCE_PREFIX
private static final java.lang.String PREFERENCE_PREFIX
- See Also:
- Constant Field Values
-
PROP_MIN_ZOOM_LVL
public static final IntegerProperty PROP_MIN_ZOOM_LVL
minimum zoom level for TMS layer
-
PROP_MAX_ZOOM_LVL
public static final IntegerProperty PROP_MAX_ZOOM_LVL
maximum zoom level for TMS layer
-
PROP_ADD_TO_SLIPPYMAP_CHOOSER
public static final BooleanProperty PROP_ADD_TO_SLIPPYMAP_CHOOSER
shall TMS layers be added to download dialog
-
MAX_ZOOM
public static final int MAX_ZOOM
override minimum/maximum zoom level with those supported by JMapViewer, as these might be used in slippymap chooser- See Also:
- Constant Field Values
-
MIN_ZOOM
public static final int MIN_ZOOM
- See Also:
- Constant Field Values
-
nativeScaleList
private static final NativeScaleLayer.ScaleList nativeScaleList
-
-
Constructor Detail
-
TMSLayer
public TMSLayer(ImageryInfo info)
Create a layer based on ImageryInfo- Parameters:
info
- description of the layer
-
-
Method Detail
-
getTileSource
protected org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource getTileSource()
Creates and returns a new TileSource instance depending on theImageryInfo.ImageryType
of theImageryInfo
object specified in the constructor. If no appropriate TileSource is found, null is returned. Currently supported ImageryType areImageryInfo.ImageryType.TMS
,ImageryInfo.ImageryType.BING
,ImageryInfo.ImageryType.SCANEX
.- Specified by:
getTileSource
in classAbstractTileSourceLayer<org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource>
- Returns:
- a new TileSource instance or null if no TileSource for the ImageryInfo/ImageryType could be found.
- Throws:
java.lang.IllegalArgumentException
- if url from imagery info is null or invalid
-
getNativeProjections
public java.util.Collection<java.lang.String> getNativeProjections()
Description copied from class:AbstractTileSourceLayer
Get projections this imagery layer supports natively. For example projection of tiles that are downloaded from a server. Layer may support even more projections (by reprojecting the tiles), but with a certain loss in image quality and performance.- Specified by:
getNativeProjections
in classAbstractTileSourceLayer<org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource>
- Returns:
- projections this imagery layer supports natively; null if layer is projection agnostic.
-
getTileSourceStatic
public static org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource getTileSourceStatic(ImageryInfo info)
Creates and returns a new TileSource instance depending on theImageryInfo.ImageryType
of the passed ImageryInfo object. If no appropriate TileSource is found, null is returned. Currently supported ImageryType areImageryInfo.ImageryType.TMS
,ImageryInfo.ImageryType.BING
,ImageryInfo.ImageryType.SCANEX
.- Parameters:
info
- imagery info- Returns:
- a new TileSource instance or null if no TileSource for the ImageryInfo/ImageryType could be found.
- Throws:
java.lang.IllegalArgumentException
- if url from imagery info is null or invalid
-
getTileSourceStatic
public static org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource getTileSourceStatic(ImageryInfo info, java.lang.Runnable attributionLoadedTask)
Creates and returns a new TileSource instance depending on theImageryInfo.ImageryType
of the passed ImageryInfo object. If no appropriate TileSource is found, null is returned. Currently supported ImageryType areImageryInfo.ImageryType.TMS
,ImageryInfo.ImageryType.BING
,ImageryInfo.ImageryType.SCANEX
.- Parameters:
info
- imagery infoattributionLoadedTask
- task to be run once attribution is loaded, might be null, if nothing special shall happen- Returns:
- a new TileSource instance or null if no TileSource for the ImageryInfo/ImageryType could be found.
- Throws:
java.lang.IllegalArgumentException
- if url from imagery info is null or invalid
-
getTileLoaderClass
protected java.lang.Class<? extends org.openstreetmap.gui.jmapviewer.interfaces.TileLoader> getTileLoaderClass()
- Specified by:
getTileLoaderClass
in classAbstractCachedTileSourceLayer<org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource>
-
getCacheName
protected java.lang.String getCacheName()
- Specified by:
getCacheName
in classAbstractCachedTileSourceLayer<org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource>
-
getCache
public static org.apache.commons.jcs3.access.CacheAccess<java.lang.String,BufferedImageCacheEntry> getCache()
Returns cache for TMS region.- Returns:
- cache for TMS region
-
getNativeScales
public NativeScaleLayer.ScaleList getNativeScales()
Description copied from interface:NativeScaleLayer
Get native scales of this layer.- Specified by:
getNativeScales
in interfaceNativeScaleLayer
- Returns:
NativeScaleLayer.ScaleList
of native scales
-
initNativeScaleList
private static NativeScaleLayer.ScaleList initNativeScaleList()
-
-