org.geotools.renderer.lite
Interface LabelCache

All Known Implementing Classes:
LabelCacheImpl, SynchronizedLabelCache

public interface LabelCache

Used to cache labels prior to their being drawn on the screen.

Implementations exisit with different trade offs about what labels can fit where.

Since:
2.2
Author:
jeichar
Module:
modules/library/render (gt-render.jar)

Method Summary
 void clear()
          Clears the cache completely
 void 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 geometry)
          Reserve the provided geometry prior to sorting out where labels can go.
 void put(String layerId, TextSymbolizer symbolizer, SimpleFeature 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.
 

Method Detail

start

void start()
Called by renderer to indicate that the rendering process is starting.


startLayer

void startLayer(String layerId)
Called by renderer to indication the start of rendering a layer. Will add the layer to the set of active layers.

Parameters:
layerId - an id for the layer

put

void put(String layerId,
         TextSymbolizer symbolizer,
         SimpleFeature feature,
         LiteShape2 shape,
         NumberRange<Double> scaleRange)
Puts a Label in the cache.

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

void put(Rectangle2D geometry)
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...

Parameters:
Geometry - The Area of the screen to reserve (in screen coordinates)

endLayer

void endLayer(String layerId,
              Graphics2D graphics,
              Rectangle displayArea)
Called to indicate that a layer is done rendering. The method may draw labels if appropriate for the labeling algorithm

Parameters:
graphics - the graphics to draw on.
displayArea - The size of the display area
layerId - an id for the layer

end

void end(Graphics2D graphics,
         Rectangle displayArea)
Called to indicate that the map is done rendering. The method may draw labels if appropriate for the labeling algorithm

Parameters:
graphics - the graphics to draw on.
displayArea - The size of the display area.

stop

void stop()
Tells the cache to stop labelling.


clear

void clear()
Clears the cache completely


clear

void clear(String layerId)
Clears the cache of all information relating to the layer identified.

Parameters:
layerId - id of the layer

disableLayer

void disableLayer(String layerId)
Leaves the label information in the cache but ignores it when calculating what labels are drawn.

Parameters:
layerId - id of the layer to disable.

enableLayer

void enableLayer(String layerId)
Enable a layer after being disabled. If startLayer is called this does not need to be called as start layer implicitely activates the layer.

Parameters:
layerId - layer to activate.

orderedLabels

List orderedLabels()
Return a list with all the values in priority order. Both grouped and non-grouped

Parameters:
labelCache -
Returns:
list with all values in priority order


Copyright © 1996-2010 Geotools. All Rights Reserved.