Class MVTLayer
- 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<MapboxVectorTileSource>
-
- org.openstreetmap.josm.gui.layer.imagery.MVTLayer
-
- All Implemented Interfaces:
ImageObserver
,org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener
,MVTTile.TileListener
,ProjectionChangeListener
,ImageryFilterSettings.FilterChangeListener
,TileSourceDisplaySettings.DisplaySettingsChangeListener
,MapViewPaintable
,NavigatableComponent.ZoomChangeListener
,Destroyable
public class MVTLayer extends AbstractCachedTileSourceLayer<MapboxVectorTileSource> implements MVTTile.TileListener
A layer for Mapbox Vector Tiles- Since:
- 17862
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MVTLayer.ConvertLayerAction
private static class
MVTLayer.EnableLayerAction
-
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 String
CACHE_REGION_NAME
private VectorDataSet
dataSet
private static Action[]
EMPTY_ACTIONS
private Map<String,Boolean>
layerNames
-
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
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description MVTLayer(ImageryInfo info)
Creates an instance of an MVT layer
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.openstreetmap.gui.jmapviewer.Tile
createTile(MapboxVectorTileSource source, int x, int y, int zoom)
Create a new tile.void
finishedLoading(MVTTile tile)
Called when the MVTTile is finished loadingstatic org.apache.commons.jcs3.access.CacheAccess<String,BufferedImageCacheEntry>
getCache()
Returns cache region for MVT layer.protected String
getCacheName()
VectorDataSet
getData()
Get the data set for this layerAction[]
getMenuEntries()
Returns list of actions.Collection<String>
getNativeProjections()
Get projections this imagery layer supports natively.protected Class<? extends org.openstreetmap.gui.jmapviewer.interfaces.TileLoader>
getTileLoaderClass()
protected MapboxVectorTileSource
getTileSource()
Creates and returns a newTileSource
instance depending onImageryLayer.info
specified in the constructor.void
paint(Graphics2D g, MapView mv, Bounds box)
Paint the dataset using the engine set.-
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, clearTileCache, createAndOpenSaveFileChooser, createDisplaySettings, createMapViewPainter, 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, 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 String CACHE_REGION_NAME
- See Also:
- Constant Field Values
-
EMPTY_ACTIONS
private static final Action[] EMPTY_ACTIONS
-
layerNames
private final Map<String,Boolean> layerNames
-
dataSet
private final VectorDataSet dataSet
-
-
Constructor Detail
-
MVTLayer
public MVTLayer(ImageryInfo info)
Creates an instance of an MVT layer- Parameters:
info
- ImageryInfo describing the layer
-
-
Method Detail
-
getTileLoaderClass
protected Class<? extends org.openstreetmap.gui.jmapviewer.interfaces.TileLoader> getTileLoaderClass()
- Specified by:
getTileLoaderClass
in classAbstractCachedTileSourceLayer<MapboxVectorTileSource>
-
getCacheName
protected String getCacheName()
- Specified by:
getCacheName
in classAbstractCachedTileSourceLayer<MapboxVectorTileSource>
-
getCache
public static org.apache.commons.jcs3.access.CacheAccess<String,BufferedImageCacheEntry> getCache()
Returns cache region for MVT layer.- Returns:
- cache region for MVT layer
- Since:
- 18186
-
getNativeProjections
public Collection<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<MapboxVectorTileSource>
- Returns:
- projections this imagery layer supports natively; null if layer is projection agnostic.
-
paint
public void paint(Graphics2D g, MapView mv, Bounds box)
Description copied from interface:MapViewPaintable
Paint the dataset using the engine set.- Specified by:
paint
in interfaceMapViewPaintable
- Overrides:
paint
in classAbstractTileSourceLayer<MapboxVectorTileSource>
- Parameters:
g
- Graphicsmv
- The object that can translate GeoPoints to screen coordinates.box
- Bounding box
-
getTileSource
protected MapboxVectorTileSource getTileSource()
Description copied from class:AbstractTileSourceLayer
Creates and returns a newTileSource
instance depending onImageryLayer.info
specified in the constructor.- Specified by:
getTileSource
in classAbstractTileSourceLayer<MapboxVectorTileSource>
- Returns:
- TileSource for specified ImageryInfo
-
createTile
public org.openstreetmap.gui.jmapviewer.Tile createTile(MapboxVectorTileSource source, int x, int y, int zoom)
Description copied from class:AbstractTileSourceLayer
Create a new tile. Added to allow use of customTile
objects.- Overrides:
createTile
in classAbstractTileSourceLayer<MapboxVectorTileSource>
- Parameters:
source
- Tile sourcex
- X coordinatey
- Y coordinatezoom
- Zoom level- Returns:
- The new
Tile
-
getMenuEntries
public Action[] getMenuEntries()
Description copied from class:Layer
Returns 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. UseLayer.SeparatorLayerAction.INSTANCE
instead of new JSeparator- Overrides:
getMenuEntries
in classAbstractTileSourceLayer<MapboxVectorTileSource>
- Returns:
- menu actions for this layer
-
getData
public VectorDataSet getData()
Get the data set for this layer
-
finishedLoading
public void finishedLoading(MVTTile tile)
Description copied from interface:MVTTile.TileListener
Called when the MVTTile is finished loading- Specified by:
finishedLoading
in interfaceMVTTile.TileListener
- Parameters:
tile
- The tile that finished loading
-
-