Package org.geotools.renderer.lite
Class SynchronizedLabelCache
- Object
-
- SynchronizedLabelCache
-
- All Implemented Interfaces:
LabelCache
public class SynchronizedLabelCache extends Object implements LabelCache
Allow multiple thread to modify LabelCache.- Author:
- Jesse
-
-
Constructor Summary
Constructors Constructor Description SynchronizedLabelCache()
SynchronizedLabelCache(LabelCache cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the cache completelyvoid
clear(String layerId)
Clears the cache of all information relating to the layer identified.void
disableLayer(String layerId)
Leaves the label information in the cache but ignores it when calculating what labels are drawn.void
enableLayer(String layerId)
Enable a layer after being disabled.void
end(Graphics2D graphics, Rectangle displayArea)
Called to indicate that the map is done rendering.void
endLayer(String layerId, Graphics2D graphics, Rectangle displayArea)
Called to indicate that a layer is done rendering.List
orderedLabels()
Return a list with all the values in priority order.void
put(Rectangle2D area)
Reserve the provided geometry prior to sorting out where labels can go.void
put(String layerId, TextSymbolizer symbolizer, Feature feature, LiteShape2 shape, NumberRange<Double> scaleRange)
Puts a Label in the cache.void
start()
Called by renderer to indicate that the rendering process is starting.void
startLayer(String layerId)
Called by renderer to indication the start of rendering a layer.void
stop()
Tells the cache to stop labelling.
-
-
-
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 interfaceLabelCache
-
clear
public void clear()
Description copied from interface:LabelCache
Clears the cache completely- Specified by:
clear
in interfaceLabelCache
-
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 interfaceLabelCache
- 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 interfaceLabelCache
- 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 interfaceLabelCache
- 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 interfaceLabelCache
- Parameters:
layerId
- an id for the layergraphics
- 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 interfaceLabelCache
- Parameters:
layerId
- id indicating the layer the feature is part ofsymbolizer
- The symbolizer containing the style informationfeature
- 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 interfaceLabelCache
- 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 interfaceLabelCache
- 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 interfaceLabelCache
-
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 interfaceLabelCache
- 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 interfaceLabelCache
- Returns:
- list with all values in priority order
-
-