Class SynchronizedLabelCache

  • All Implemented Interfaces:
    LabelCache

    public class SynchronizedLabelCache
    extends Object
    implements LabelCache
    Allow multiple thread to modify LabelCache.
    Author:
    Jesse
    • Constructor Detail

      • SynchronizedLabelCache

        public SynchronizedLabelCache()
      • SynchronizedLabelCache

        public SynchronizedLabelCache​(LabelCache cache)
    • Method Detail

      • start

        public void start()
        Description copied from interface: LabelCache
        Called by renderer to indicate that the rendering process is starting.
        Specified by:
        start in interface LabelCache
      • clear

        public void clear()
        Description copied from interface: LabelCache
        Clears the cache completely
        Specified by:
        clear in interface LabelCache
      • clear

        public void clear​(String layerId)
        Description copied from interface: LabelCache
        Clears the cache of all information relating to the layer identified.
        Specified by:
        clear in interface LabelCache
        Parameters:
        layerId - id of the layer
      • enableLayer

        public void enableLayer​(String layerId)
        Description copied from interface: LabelCache
        Enable a layer after being disabled. If startLayer is called this does not need to be called as start layer implicitely activates the layer.
        Specified by:
        enableLayer in interface LabelCache
        Parameters:
        layerId - layer to activate.
      • end

        public void end​(Graphics2D graphics,
                        Rectangle displayArea)
        Description copied from interface: LabelCache
        Called to indicate that the map is done rendering. The method may draw labels if appropriate for the labeling algorithm
        Specified by:
        end in interface LabelCache
        Parameters:
        graphics - the graphics to draw on.
        displayArea - The size of the display area.
      • endLayer

        public void endLayer​(String layerId,
                             Graphics2D graphics,
                             Rectangle displayArea)
        Description copied from interface: LabelCache
        Called to indicate that a layer is done rendering. The method may draw labels if appropriate for the labeling algorithm
        Specified by:
        endLayer in interface LabelCache
        Parameters:
        layerId - an id for the layer
        graphics - the graphics to draw on.
        displayArea - The size of the display area
      • put

        public void put​(String layerId,
                        TextSymbolizer symbolizer,
                        Feature feature,
                        LiteShape2 shape,
                        NumberRange<Double> scaleRange)
        Description copied from interface: LabelCache
        Puts a Label in the cache.
        Specified by:
        put in interface LabelCache
        Parameters:
        layerId - id indicating the layer the feature is part of
        symbolizer - The symbolizer containing the style information
        feature - the feature that has the information required for the symbolizer to calculate the required render information.
        shape - the shape to be labeled. This is in screen coordinates.
        scaleRange - the scaleRange that the symbolizer is legal
      • put

        public void put​(Rectangle2D area)
        Description copied from interface: LabelCache
        Reserve the provided geometry prior to sorting out where labels can go.

        This facility is used to reserve an area so that labels do not end up overlapping on screen constructs like scalebars or north arrows etc...

        Specified by:
        put in interface LabelCache
        Parameters:
        area - The Area of the screen to reserve (in screen coordinates)
      • startLayer

        public void startLayer​(String layerId)
        Description copied from interface: LabelCache
        Called by renderer to indication the start of rendering a layer. Will add the layer to the set of active layers.
        Specified by:
        startLayer in interface LabelCache
        Parameters:
        layerId - an id for the layer
      • stop

        public void stop()
        Description copied from interface: LabelCache
        Tells the cache to stop labelling.
        Specified by:
        stop in interface LabelCache
      • disableLayer

        public void disableLayer​(String layerId)
        Description copied from interface: LabelCache
        Leaves the label information in the cache but ignores it when calculating what labels are drawn.
        Specified by:
        disableLayer in interface LabelCache
        Parameters:
        layerId - id of the layer to disable.
      • orderedLabels

        public List orderedLabels()
        Description copied from interface: LabelCache
        Return a list with all the values in priority order. Both grouped and non-grouped
        Specified by:
        orderedLabels in interface LabelCache
        Returns:
        list with all values in priority order