|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.renderer.label.LabelCacheImpl
public final class LabelCacheImpl
Default LabelCache Implementation.
The label cache sports a number of features that are enabled depending on the programmatic configuration and the TextSymbolizer options.
The basic functionalitty of the label cache consist in finding the
best label position for each Feature according to the TextSymbolizer
specifications, and drawing it, provided it does not overlap with other labels.
This basic behaviour can be customized in a number of ways.
TextSymbolizer.getPriority()
OGC Expression controls a label priority.
A label with high priority will be drawn before others, increasing its likeliness to appear on the screen
Field Summary | |
---|---|
double |
DEFAULT_PRIORITY
|
protected java.util.Map<java.lang.String,LabelCacheItem> |
labelCache
Map |
protected java.util.ArrayList<LabelCacheItem> |
labelCacheNonGrouped
non-grouped labels get thrown in here* |
static double |
MIN_CURVED_DELTA
The angle delta at which we switch from curved rendering to straight rendering |
protected boolean |
outlineRenderingEnabled
When true, the text is rendered as its GlyphVector outline (as a geometry) instead of using drawGlypVector. |
protected SLDStyleFactory |
styleFactory
|
Constructor Summary | |
---|---|
LabelCacheImpl()
|
Method Summary | |
---|---|
void |
clear()
Clears the cache completely |
void |
clear(java.lang.String layerId)
Clears the cache of all information relating to the layer identified. |
com.vividsolutions.jts.geom.MultiLineString |
clipLineString(com.vividsolutions.jts.geom.LineString line,
com.vividsolutions.jts.geom.Polygon bbox,
com.vividsolutions.jts.geom.Envelope displayGeomEnv)
try to be more robust dont bother returning points This will try to solve robustness problems, but read code as to what it does. |
com.vividsolutions.jts.geom.MultiPolygon |
clipPolygon(com.vividsolutions.jts.geom.Polygon poly,
com.vividsolutions.jts.geom.Polygon bbox,
com.vividsolutions.jts.geom.Envelope displayGeomEnv)
try to do a more robust way of clipping a polygon to a bounding box. |
void |
disableLayer(java.lang.String layerId)
Leaves the label information in the cache but ignores it when calculating what labels are drawn. |
void |
enableLayer(java.lang.String layerId)
Enable a layer after being disabled. |
void |
end(java.awt.Graphics2D graphics,
java.awt.Rectangle displayArea)
Called to indicate that the map is done rendering. |
void |
endLayer(java.lang.String layerId,
java.awt.Graphics2D graphics,
java.awt.Rectangle displayArea)
Called to indicate that a layer is done rendering. |
double |
getPriority(TextSymbolizer symbolizer,
org.opengis.feature.simple.SimpleFeature feature)
get the priority from the symbolizer its an expression, so it will try to evaluate it: 1. |
boolean |
isOutlineRenderingEnabled()
|
java.util.List<LabelCacheItem> |
orderedLabels()
Return a list with all the values in priority order. |
java.util.List<com.vividsolutions.jts.geom.LineString> |
processNodes(java.util.List<com.vividsolutions.jts.geom.LineString> edges,
java.util.Map<com.vividsolutions.jts.geom.Coordinate,java.util.List<com.vividsolutions.jts.geom.LineString>> nodes)
pull a line from the list, and: 1. |
void |
put(java.awt.geom.Rectangle2D area)
Reserve the provided geometry prior to sorting out where labels can go. |
void |
put(java.lang.String layerId,
TextSymbolizer symbolizer,
org.opengis.feature.simple.SimpleFeature feature,
LiteShape2 shape,
NumberRange scaleRange)
Puts a Label in the cache. |
void |
removeFromHash(java.util.Map<com.vividsolutions.jts.geom.Coordinate,java.util.List<com.vividsolutions.jts.geom.LineString>> nodes,
com.vividsolutions.jts.geom.LineString ls)
|
void |
setOutlineRenderingEnabled(boolean outlineRenderingEnabled)
Sets the text rendering mode. |
void |
start()
Called by renderer to indicate that the rendering process is starting. |
void |
startLayer(java.lang.String layerId)
Called by renderer to indication the start of rendering a layer. |
void |
stop()
Tells the cache to stop labelling. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public double DEFAULT_PRIORITY
public static double MIN_CURVED_DELTA
protected java.util.Map<java.lang.String,LabelCacheItem> labelCache
protected java.util.ArrayList<LabelCacheItem> labelCacheNonGrouped
protected boolean outlineRenderingEnabled
protected SLDStyleFactory styleFactory
Constructor Detail |
---|
public LabelCacheImpl()
Method Detail |
---|
public void enableLayer(java.lang.String layerId)
LabelCache
enableLayer
in interface LabelCache
layerId
- layer to activate.public boolean isOutlineRenderingEnabled()
public void setOutlineRenderingEnabled(boolean outlineRenderingEnabled)
public void stop()
LabelCache
stop
in interface LabelCache
public void start()
LabelCache
start
in interface LabelCache
LabelCache.start()
public void clear()
LabelCache
clear
in interface LabelCache
public void clear(java.lang.String layerId)
LabelCache
clear
in interface LabelCache
layerId
- id of the layerpublic void disableLayer(java.lang.String layerId)
LabelCache
disableLayer
in interface LabelCache
layerId
- id of the layer to disable.public void startLayer(java.lang.String layerId)
LabelCache
startLayer
in interface LabelCache
layerId
- an id for the layerorg.geotools.renderer.lite.LabelCache#startLayer()
public double getPriority(TextSymbolizer symbolizer, org.opengis.feature.simple.SimpleFeature feature)
symbolizer
- feature
- public void put(java.lang.String layerId, TextSymbolizer symbolizer, org.opengis.feature.simple.SimpleFeature feature, LiteShape2 shape, NumberRange scaleRange)
LabelCache
put
in interface LabelCache
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 legalorg.geotools.renderer.lite.LabelCache#put(org.geotools.renderer.style.TextStyle2D,
org.geotools.renderer.lite.LiteShape)
public void put(java.awt.geom.Rectangle2D area)
LabelCache
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...
put
in interface LabelCache
public void endLayer(java.lang.String layerId, java.awt.Graphics2D graphics, java.awt.Rectangle displayArea)
LabelCache
endLayer
in interface LabelCache
layerId
- an id for the layergraphics
- the graphics to draw on.displayArea
- The size of the display areaorg.geotools.renderer.lite.LabelCache#endLayer(java.awt.Graphics2D,
java.awt.Rectangle)
public java.util.List<LabelCacheItem> orderedLabels()
orderedLabels
in interface LabelCache
public void end(java.awt.Graphics2D graphics, java.awt.Rectangle displayArea)
LabelCache
end
in interface LabelCache
graphics
- the graphics to draw on.displayArea
- The size of the display area.LabelCache.end(java.awt.Graphics2D,
java.awt.Rectangle)
public com.vividsolutions.jts.geom.MultiLineString clipLineString(com.vividsolutions.jts.geom.LineString line, com.vividsolutions.jts.geom.Polygon bbox, com.vividsolutions.jts.geom.Envelope displayGeomEnv)
line
- bbox
- MUST BE A BOUNDING BOXpublic com.vividsolutions.jts.geom.MultiPolygon clipPolygon(com.vividsolutions.jts.geom.Polygon poly, com.vividsolutions.jts.geom.Polygon bbox, com.vividsolutions.jts.geom.Envelope displayGeomEnv)
poly
- bbox
- displayGeomEnv
-
public java.util.List<com.vividsolutions.jts.geom.LineString> processNodes(java.util.List<com.vividsolutions.jts.geom.LineString> edges, java.util.Map<com.vividsolutions.jts.geom.Coordinate,java.util.List<com.vividsolutions.jts.geom.LineString>> nodes)
edges
- nodes
- result
- public void removeFromHash(java.util.Map<com.vividsolutions.jts.geom.Coordinate,java.util.List<com.vividsolutions.jts.geom.LineString>> nodes, com.vividsolutions.jts.geom.LineString ls)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |