Package org.openstreetmap.josm.gui.layer
Class WMSLayer
- java.lang.Object
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener,ProjectionChangeListener,ImageryFilterSettings.FilterChangeListener,TileSourceDisplaySettings.DisplaySettingsChangeListener,MapViewPaintable,NavigatableComponent.ZoomChangeListener,Destroyable
public class WMSLayer extends AbstractCachedTileSourceLayer<AbstractWMSTileSource>
This is a layer that grabs the current screen from an WMS server. The data fetched this way is tiled and managed to the disc to reduce server load.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classWMSLayer.BookmarkWmsActionThis action will add a WMS layer menu entry with the current WMS layer URL and name extended by the current resolution.-
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
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCACHE_REGION_NAMEprivate static java.lang.StringPREFERENCE_PREFIXstatic BooleanPropertyPROP_DEFAULT_AUTOZOOMshould WMS layer autozoom in default modestatic IntegerPropertyPROP_IMAGE_SIZEdefault tile size for WMS Layerprivate java.util.List<java.lang.String>serverProjections-
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, MAX_ZOOM, MIN_ZOOM, PROP_MAX_ZOOM_LVL, PROP_MIN_ZOOM_LVL, 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 WMSLayer(ImageryInfo info)Constructs a newWMSLayer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private ProjectionchooseProjection(Projection requested)protected TileSourceDisplaySettingscreateDisplaySettings()This method creates theTileSourceDisplaySettingsobject.static org.apache.commons.jcs3.access.CacheAccess<java.lang.String,BufferedImageCacheEntry>getCache()Returns cache region for WMS layer.protected java.lang.StringgetCacheName()javax.swing.Action[]getMenuEntries()Returns list of actions.java.util.Collection<java.lang.String>getNativeProjections()Get projections this imagery layer supports natively.protected java.lang.Class<? extends org.openstreetmap.gui.jmapviewer.interfaces.TileLoader>getTileLoaderClass()protected AbstractWMSTileSourcegetTileSource()Creates and returns a newTileSourceinstance depending onImageryLayer.infospecified in the constructor.voidprojectionChanged(Projection oldValue, Projection newValue)private ProjectionselectProjection(Projection proj)-
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, createMapViewPainter, createTile, decreaseZoomLevel, destroy, displaySettingsChanged, estimateTileCacheSize, filterChanged, getAdjustAction, getBestZoom, getCommonEntries, getDisplaySettings, getDownloadAreaToCacheTask, getHeaders, getInfoComponent, getLayerListEntries, getMaxZoomLvl, getMaxZoomLvl, getMinZoomLvl, getMinZoomLvl, getOffsetMenuEntries, getScaleFactor, getTileSet, getToolTipText, getZoomLevel, hookUpMapView, imageUpdate, increaseZoomLevel, initTileSource, isSavable, loadAllErrorTiles, loadAllTiles, paint, 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
-
PREFERENCE_PREFIX
private static final java.lang.String PREFERENCE_PREFIX
- See Also:
- Constant Field Values
-
PROP_IMAGE_SIZE
public static final IntegerProperty PROP_IMAGE_SIZE
default tile size for WMS Layer
-
PROP_DEFAULT_AUTOZOOM
public static final BooleanProperty PROP_DEFAULT_AUTOZOOM
should WMS layer autozoom in default mode
-
CACHE_REGION_NAME
private static final java.lang.String CACHE_REGION_NAME
- See Also:
- Constant Field Values
-
serverProjections
private java.util.List<java.lang.String> serverProjections
-
-
Constructor Detail
-
WMSLayer
public WMSLayer(ImageryInfo info)
Constructs a newWMSLayer.- Parameters:
info- ImageryInfo description of the layer
-
-
Method Detail
-
createDisplaySettings
protected TileSourceDisplaySettings createDisplaySettings()
Description copied from class:AbstractTileSourceLayerThis method creates theTileSourceDisplaySettingsobject. Subclasses may implement it to e.g. change the prefix.- Overrides:
createDisplaySettingsin classAbstractTileSourceLayer<AbstractWMSTileSource>- Returns:
- The object.
-
getMenuEntries
public javax.swing.Action[] getMenuEntries()
Description copied from class:LayerReturns list of actions. Action can implement LayerAction interface when it needs to be represented by other menu component than JMenuItem or when it supports multiple layers. Actions that support multiple layers should also have correct equals implementation.Use
Layer.SeparatorLayerAction.INSTANCEinstead of new JSeparator- Overrides:
getMenuEntriesin classAbstractTileSourceLayer<AbstractWMSTileSource>- Returns:
- menu actions for this layer
-
getTileSource
protected AbstractWMSTileSource getTileSource()
Description copied from class:AbstractTileSourceLayerCreates and returns a newTileSourceinstance depending onImageryLayer.infospecified in the constructor.- Specified by:
getTileSourcein classAbstractTileSourceLayer<AbstractWMSTileSource>- Returns:
- TileSource for specified ImageryInfo
-
getNativeProjections
public java.util.Collection<java.lang.String> getNativeProjections()
Description copied from class:AbstractTileSourceLayerGet 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:
getNativeProjectionsin classAbstractTileSourceLayer<AbstractWMSTileSource>- Returns:
- projections this imagery layer supports natively; null if layer is projection agnostic.
-
projectionChanged
public void projectionChanged(Projection oldValue, Projection newValue)
- Specified by:
projectionChangedin interfaceProjectionChangeListener- Overrides:
projectionChangedin classAbstractTileSourceLayer<AbstractWMSTileSource>
-
chooseProjection
private Projection chooseProjection(Projection requested)
-
selectProjection
private Projection selectProjection(Projection proj)
-
getTileLoaderClass
protected java.lang.Class<? extends org.openstreetmap.gui.jmapviewer.interfaces.TileLoader> getTileLoaderClass()
- Specified by:
getTileLoaderClassin classAbstractCachedTileSourceLayer<AbstractWMSTileSource>
-
getCacheName
protected java.lang.String getCacheName()
- Specified by:
getCacheNamein classAbstractCachedTileSourceLayer<AbstractWMSTileSource>
-
getCache
public static org.apache.commons.jcs3.access.CacheAccess<java.lang.String,BufferedImageCacheEntry> getCache()
Returns cache region for WMS layer.- Returns:
- cache region for WMS layer
-
-