Class 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
    • Constructor Detail

      • StyledTiledMapRenderer

        public StyledTiledMapRenderer​(java.awt.Graphics2D g,
                                      NavigatableComponent nc,
                                      boolean isInactiveMode)
        Constructs a new StyledMapRenderer.
        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 - if g is null
        java.lang.IllegalArgumentException - if nc is null
    • Method Detail

      • render

        public void render​(OsmData<?,​?,​?,​?> data,
                           boolean renderVirtualNodes,
                           Bounds bounds)
        Description copied from interface: Rendering

        Renders the OSM data in data

        Specified by:
        render in interface Rendering
        Overrides:
        render in class StyledMapRenderer
        Parameters:
        data - the data set to be rendered
        renderVirtualNodes - if true, renders virtual nodes. Otherwise, ignores them.
        bounds - the bounding box for the data to be rendered. Only objects within or intersecting with bbox are 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 like StyledMapRenderer.
        Parameters:
        box - The box we will be rendering -- any jobs for tiles outside of this box will be cancelled
        cache - The cache to use
        zoom - The zoom level to use for creating the tiles
        notifier - The method to call when a tile has been updated. This may or may not be called in the EDT.
      • 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 from
        tiles - 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
      • 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_TILES on all sides.