Class StyledTiledMapRenderer
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
-
- org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer
-
- org.openstreetmap.josm.data.osm.visitor.paint.StyledTiledMapRenderer
-
- All Implemented Interfaces:
Rendering
public final class StyledTiledMapRenderer extends StyledMapRenderer
A styled render that does the rendering on a tile basis. Note: this is currently experimental! It may be extracted to an interface at a later date.- Since:
- 19176
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classStyledTiledMapRenderer.TileLoaderA loader for tiles-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer
StyledMapRenderer.StyleRecord
-
-
Field Summary
Fields Modifier and Type Field Description private static intBUFFER_PIXELSprivate static intBUFFER_TILESprivate org.apache.commons.jcs3.access.CacheAccess<TileZXY,ImageCache>cacheprivate java.util.function.Consumer<TileZXY>notifierprivate java.util.concurrent.ExecutorServiceworkerprivate intzoom-
Fields inherited from class org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer
FLAG_DISABLED, FLAG_MEMBER_OF_SELECTED, FLAG_NORMAL, FLAG_OUTERMEMBER_OF_SELECTED, FLAG_SELECTED, PREFERENCE_ANTIALIASING_USE, PREFERENCE_TEXT_ANTIALIASING
-
Fields inherited from class org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
backgroundColor, doSlowOperations, g, highlightColor, inactiveColor, isInactiveMode, mapState, nc, nodeColor, relationSelectedColor, segmentNumberSpace, selectedColor, virtualNodeSize, virtualNodeSpace
-
-
Constructor Summary
Constructors Constructor Description StyledTiledMapRenderer(java.awt.Graphics2D g, NavigatableComponent nc, boolean isInactiveMode)Constructs a newStyledMapRenderer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidcancelImageFuture(org.apache.commons.jcs3.access.CacheAccess<TileZXY,ImageCache> cache, TileZXY key, ImageCache value)Cancel a job for a tileprivate static java.awt.image.BufferedImagecreateCompatibleImage(NavigatableComponent nc, int width, int height)private static BoundsgenerateRenderArea(java.util.Collection<TileZXY> tiles)Generate the area for renderingprivate java.awt.image.BufferedImagegenerateTiles(OsmData<?,?,?,?> data, java.util.Collection<TileZXY> tiles, int tileSize)Generate tile imagesvoidrender(OsmData<?,?,?,?> data, boolean renderVirtualNodes, Bounds bounds)Renders the OSM data indatavoidsetCache(Bounds box, org.apache.commons.jcs3.access.CacheAccess<TileZXY,ImageCache> cache, int zoom, java.util.function.Consumer<TileZXY> notifier)Set the cache for this painter.-
Methods inherited from class org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer
computeFlags, drawArea, drawArea, drawArea, drawAreaIcon, drawBoxText, drawNode, drawNodeIcon, drawNodeSymbol, drawOrderNumber, drawRepeatImage, drawRestriction, drawText, drawWay, getCircum, getColors, getSettings, isGlyphVectorDoubleTranslationBug, isInactiveMode, isShowIcons, isShowNames, setBenchmarkFactory, setStyles
-
Methods inherited from class org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
drawOrderNumber, drawVirtualNodes, enableSlowOperations, isLargeSegment, isSegmentVisible, isSegmentVisible, visitVirtual
-
-
-
-
Field Detail
-
BUFFER_TILES
private static final int BUFFER_TILES
- See Also:
- Constant Field Values
-
BUFFER_PIXELS
private static final int BUFFER_PIXELS
- See Also:
- Constant Field Values
-
cache
private org.apache.commons.jcs3.access.CacheAccess<TileZXY,ImageCache> cache
-
zoom
private int zoom
-
worker
private final java.util.concurrent.ExecutorService worker
-
-
Constructor Detail
-
StyledTiledMapRenderer
public StyledTiledMapRenderer(java.awt.Graphics2D g, NavigatableComponent nc, boolean isInactiveMode)
Constructs a newStyledMapRenderer.- Parameters:
g- the graphics context. Must not be null.nc- the map viewport. Must not be null.isInactiveMode- if true, the paint visitor shall render OSM objects such that they look inactive. Example: rendering of data in an inactive layer using light gray as color only.- Throws:
java.lang.IllegalArgumentException- ifgis nulljava.lang.IllegalArgumentException- ifncis null
-
-
Method Detail
-
render
public void render(OsmData<?,?,?,?> data, boolean renderVirtualNodes, Bounds bounds)
Description copied from interface:RenderingRenders the OSM data in
data- Specified by:
renderin interfaceRendering- Overrides:
renderin classStyledMapRenderer- Parameters:
data- the data set to be renderedrenderVirtualNodes- if true, renders virtual nodes. Otherwise, ignores them.bounds- the bounding box for the data to be rendered. Only objects within or intersecting withbboxare rendered
-
setCache
public void setCache(Bounds box, org.apache.commons.jcs3.access.CacheAccess<TileZXY,ImageCache> cache, int zoom, java.util.function.Consumer<TileZXY> notifier)
Set the cache for this painter. If not set, this acts likeStyledMapRenderer.- Parameters:
box- The box we will be rendering -- any jobs for tiles outside of this box will be cancelledcache- The cache to usezoom- The zoom level to use for creating the tilesnotifier- The method to call when a tile has been updated. This may or may not be called in the EDT.
-
cancelImageFuture
private static void cancelImageFuture(org.apache.commons.jcs3.access.CacheAccess<TileZXY,ImageCache> cache, TileZXY key, ImageCache value)
Cancel a job for a tile- Parameters:
cache- The cache with the jobkey- The tile keyvalue- TheImageCacheto remove and cancel
-
generateTiles
private java.awt.image.BufferedImage generateTiles(OsmData<?,?,?,?> data, java.util.Collection<TileZXY> tiles, int tileSize)
Generate tile images- Parameters:
data- The data to generate tiles fromtiles- The collection of tiles to generate (note: there is currently a bug with multiple tiles)tileSize- The size of the tile image- Returns:
- The image for the tiles passed in
-
createCompatibleImage
private static java.awt.image.BufferedImage createCompatibleImage(NavigatableComponent nc, int width, int height)
-
generateRenderArea
private static Bounds generateRenderArea(java.util.Collection<TileZXY> tiles)
Generate the area for rendering- Parameters:
tiles- The tiles that we want to render- Returns:
- The generated render area with
BUFFER_TILESon all sides.
-
-