org.geotools.styling
Interface TextSymbolizer

All Superinterfaces:
org.opengis.style.Symbolizer, org.opengis.style.TextSymbolizer
All Known Subinterfaces:
TextSymbolizer2
All Known Implementing Classes:
TextSymbolizerImpl

public interface TextSymbolizer
extends org.opengis.style.TextSymbolizer, Symbolizer

A symbolizer describes how a feature should appear on a map.

A symbolizer is obtained by specifying one of a small number of different types of symbolizer and then supplying parameters to override its default behaviour.

The text symbolizer describes how to display text labels and the like.

The details of this object are taken from the OGC Styled-Layer Descriptor Report (OGC 02-070) version 1.0.0.:


 <xsd:element name="TextSymbolizer" substitutionGroup="sld:Symbolizer">
   <xsd:annotation>
     <xsd:documentation>
       A "TextSymbolizer" is used to render text labels according to
       various graphical parameters.
     </xsd:documentation>
   </xsd:annotation>
   <xsd:complexType>
     <xsd:complexContent>
       <xsd:extension base="sld:SymbolizerType">
         <xsd:sequence>
           <xsd:element ref="sld:Geometry" minOccurs="0"/>
           <xsd:element ref="sld:Label" minOccurs="0"/>
           <xsd:element ref="sld:Font" minOccurs="0"/>
           <xsd:element ref="sld:LabelPlacement" minOccurs="0"/>
           <xsd:element ref="sld:Halo" minOccurs="0"/>
           <xsd:element ref="sld:Fill" minOccurs="0"/>
         </xsd:sequence>
       </xsd:extension>
     </xsd:complexContent>
   </xsd:complexType>
 </xsd:element>
 

Renderers can use this information when displaying styled features, though it must be remembered that not all renderers will be able to fully represent strokes as set out by this interface. For example, opacity may not be supported.

Notes:

$Id: TextSymbolizer.java 35746 2010-06-21 17:25:23Z aaime $

Author:
Ian Turton, CCG

Field Summary
static java.lang.String ALLOW_OVERRUNS_KEY
          When false does not allow labels on lines to get beyond the beginning/end of the line.
static java.lang.String AUTO_WRAP_KEY
          Number of pixels are which a long label should be split into multiple lines.
static java.lang.String CONFLICT_RESOLUTION_KEY
          Enables conflict resolution (default, true) meaning no two labels will be allowed to overlap.
static boolean DEFAULT_ALLOW_OVERRUNS
          We allow labels that are longer than the line to appear by default
static int DEFAULT_AUTO_WRAP
          Auto wrapping long labels default
static boolean DEFAULT_CONFLICT_RESOLUTION
          By default, put each label in the conflict resolution map
static boolean DEFAULT_FOLLOW_LINE
          If labels with a line placement should follow the line shape or be just tangent
static boolean DEFAULT_FORCE_LEFT_TO_RIGHT
          Force labels to a readable orientation (so that they don't look "upside down")
static double DEFAULT_GOODNESS_OF_FIT
          Default value for the goodness of fit threshold
static boolean DEFAULT_GROUP
          Default grouping value, false
static boolean DEFAULT_LABEL_ALL_GROUP
          If in case of grouping all resulting lines have to be labelled
static int DEFAULT_LABEL_REPEAT
          Default repetition distance for labels (<= 0 -> no repetition)
static double DEFAULT_MAX_ANGLE_DELTA
          When label follows line, the max angle change between two subsequent characters, keeping it low avoids chars overlaps.
static int DEFAULT_MAX_DISPLACEMENT
          Default max displacement
static int DEFAULT_MIN_GROUP_DISTANCE
          Default min distance between labels in the same group (-1 means no min distance)
static boolean DEFAULT_REMOVE_OVERLAPS
          If, in case of grouping, self overlaps have to be taken into account and removed (expensive!)
static int DEFAULT_SPACE_AROUND
          By default, don't add space around labels
static java.lang.String FOLLOW_LINE_KEY
          When true activates curved labels on linear geometries.
static java.lang.String FORCE_LEFT_TO_RIGHT_KEY
          When true forces labels to a readable orientation, when false they make follow the line orientation even if that means the label will look upside down (useful when using TTF symbol fonts to add direction markers along a line)
static java.lang.String GOODNESS_OF_FIT_KEY
          Sets the percentage of the label that must sit inside the geometry to allow drawing the label.
static java.lang.String GROUP_KEY
          If true, geometries with the same labels are grouped and considered a single entity to be labeled.
static java.lang.String LABEL_ALL_GROUP_KEY
          When false, only the biggest geometry in a group is labelled (the biggest is obtained by merging, when possible, the original geometries).
static java.lang.String LABEL_REPEAT_KEY
          When positive it's the desired distance between two subsequent labels on a "big" geometry.
static java.lang.String MAX_ANGLE_DELTA_KEY
          When drawing curved labels, max allowed angle between two subsequent characters.
static java.lang.String MAX_DISPLACEMENT_KEY
          The distance, in pixel, a label can be displaced from its natural position in an attempt to find a position that does not conflict with already drawn labels.
static java.lang.String MIN_GROUP_DISTANCE_KEY
          Minimum distance between two labels in the same label group.
static java.lang.String SPACE_AROUND_KEY
          The minimum distance between two labels, in pixels
 
Method Summary
 void addToOptions(java.lang.String key, java.lang.String value)
          Deprecated. Please use getOptions().put( key, value )
 Fill getFill()
          Returns the object that indicates how the text will be filled.
 Font getFont()
          Font to use when rendering this symbolizer.
 Font[] getFonts()
          Deprecated. use getFont()
 Halo getHalo()
          A halo fills an extended area outside the glyphs of a rendered text label to make the label easier to read over a background.
 org.opengis.filter.expression.Expression getLabel()
          Returns the expression that will be evaluated to determine what text is displayed.
 LabelPlacement getLabelPlacement()
          A LabelPlacement specifies how a text element should be rendered relative to its geometric point or line.
 java.lang.String getOption(java.lang.String key)
          Deprecated. Please use getOptions.get( key )
 java.util.Map<java.lang.String,java.lang.String> getOptions()
          return the map of option
 LabelPlacement getPlacement()
          Deprecated. Please use getLabelPlacement()
 org.opengis.filter.expression.Expression getPriority()
          Priority -- null = use the default labeling priority Expression = an expression that evaluates to a number (ie.
 void setFill(org.opengis.style.Fill fill)
          Sets the object that indicates how the text will be filled.
 void setFont(org.opengis.style.Font font)
          Font used when rendering this symbolizer.
 void setFonts(Font[] fonts)
          Deprecated. use getFont() setters to modify the set of font faces used
 void setHalo(org.opengis.style.Halo halo)
          A halo fills an extended area outside the glyphs of a rendered text label to make the label easier to read over a background.
 void setLabel(org.opengis.filter.expression.Expression label)
          Sets the expression that will be evaluated to determine what text is displayed.
 void setLabelPlacement(org.opengis.style.LabelPlacement labelPlacement)
          A LabelPlacement specifies how a text element should be rendered relative to its geometric point or line.
 void setPlacement(LabelPlacement labelPlacement)
          Deprecated. Please use setLabelPlacement
 void setPriority(org.opengis.filter.expression.Expression e)
          Priority -- null = use the default labeling priority Expression = an expression that evaluates to a number (ie.
 
Methods inherited from interface org.opengis.style.TextSymbolizer
accept
 
Methods inherited from interface org.geotools.styling.Symbolizer
accept, getDescription, getGeometry, getGeometryPropertyName, setDescription, setGeometry, setGeometryPropertyName, setName, setUnitOfMeasure
 
Methods inherited from interface org.opengis.style.Symbolizer
getName, getUnitOfMeasure
 

Field Detail

GROUP_KEY

static final java.lang.String GROUP_KEY
If true, geometries with the same labels are grouped and considered a single entity to be labeled. This allows to avoid or control repeated labels

See Also:
Constant Field Values

DEFAULT_GROUP

static final boolean DEFAULT_GROUP
Default grouping value, false

See Also:
Constant Field Values

SPACE_AROUND_KEY

static final java.lang.String SPACE_AROUND_KEY
The minimum distance between two labels, in pixels

See Also:
Constant Field Values

DEFAULT_SPACE_AROUND

static final int DEFAULT_SPACE_AROUND
By default, don't add space around labels

See Also:
Constant Field Values

MAX_DISPLACEMENT_KEY

static final java.lang.String MAX_DISPLACEMENT_KEY
The distance, in pixel, a label can be displaced from its natural position in an attempt to find a position that does not conflict with already drawn labels.

See Also:
Constant Field Values

DEFAULT_MAX_DISPLACEMENT

static final int DEFAULT_MAX_DISPLACEMENT
Default max displacement

See Also:
Constant Field Values

MIN_GROUP_DISTANCE_KEY

static final java.lang.String MIN_GROUP_DISTANCE_KEY
Minimum distance between two labels in the same label group. To be used when both displacement and repeat are used to avoid having two labels too close to each other

See Also:
Constant Field Values

DEFAULT_MIN_GROUP_DISTANCE

static final int DEFAULT_MIN_GROUP_DISTANCE
Default min distance between labels in the same group (-1 means no min distance)

See Also:
Constant Field Values

LABEL_REPEAT_KEY

static final java.lang.String LABEL_REPEAT_KEY
When positive it's the desired distance between two subsequent labels on a "big" geometry. Works only on lines at the moment. If zero only one label is drawn no matter how big the geometry is

See Also:
Constant Field Values

DEFAULT_LABEL_REPEAT

static final int DEFAULT_LABEL_REPEAT
Default repetition distance for labels (<= 0 -> no repetition)

See Also:
Constant Field Values

LABEL_ALL_GROUP_KEY

static final java.lang.String LABEL_ALL_GROUP_KEY
When false, only the biggest geometry in a group is labelled (the biggest is obtained by merging, when possible, the original geometries). When true, also the smaller items in the group are labeled. Works only on lines at the moment.

See Also:
Constant Field Values

DEFAULT_LABEL_ALL_GROUP

static final boolean DEFAULT_LABEL_ALL_GROUP
If in case of grouping all resulting lines have to be labelled

See Also:
Constant Field Values

ALLOW_OVERRUNS_KEY

static final java.lang.String ALLOW_OVERRUNS_KEY
When false does not allow labels on lines to get beyond the beginning/end of the line. By default a partial overrun is tolerated, set to false to disallow it.

See Also:
Constant Field Values

DEFAULT_ALLOW_OVERRUNS

static final boolean DEFAULT_ALLOW_OVERRUNS
We allow labels that are longer than the line to appear by default

See Also:
Constant Field Values

DEFAULT_REMOVE_OVERLAPS

static final boolean DEFAULT_REMOVE_OVERLAPS
If, in case of grouping, self overlaps have to be taken into account and removed (expensive!)

See Also:
Constant Field Values

FOLLOW_LINE_KEY

static final java.lang.String FOLLOW_LINE_KEY
When true activates curved labels on linear geometries. The label will follow the shape of the current line, as opposed to being drawn a tangent straight line

See Also:
Constant Field Values

DEFAULT_FOLLOW_LINE

static final boolean DEFAULT_FOLLOW_LINE
If labels with a line placement should follow the line shape or be just tangent

See Also:
Constant Field Values

MAX_ANGLE_DELTA_KEY

static final java.lang.String MAX_ANGLE_DELTA_KEY
When drawing curved labels, max allowed angle between two subsequent characters. Higher angles may cause disconnected words or overlapping characters

See Also:
Constant Field Values

DEFAULT_MAX_ANGLE_DELTA

static final double DEFAULT_MAX_ANGLE_DELTA
When label follows line, the max angle change between two subsequent characters, keeping it low avoids chars overlaps. When the angle is exceeded the label placement will fail.

See Also:
Constant Field Values

AUTO_WRAP_KEY

static final java.lang.String AUTO_WRAP_KEY
Number of pixels are which a long label should be split into multiple lines. Works on all geometries, on lines it is mutually exclusive with the followLine option

See Also:
Constant Field Values

DEFAULT_AUTO_WRAP

static final int DEFAULT_AUTO_WRAP
Auto wrapping long labels default

See Also:
Constant Field Values

FORCE_LEFT_TO_RIGHT_KEY

static final java.lang.String FORCE_LEFT_TO_RIGHT_KEY
When true forces labels to a readable orientation, when false they make follow the line orientation even if that means the label will look upside down (useful when using TTF symbol fonts to add direction markers along a line)

See Also:
Constant Field Values

DEFAULT_FORCE_LEFT_TO_RIGHT

static final boolean DEFAULT_FORCE_LEFT_TO_RIGHT
Force labels to a readable orientation (so that they don't look "upside down")

See Also:
Constant Field Values

CONFLICT_RESOLUTION_KEY

static final java.lang.String CONFLICT_RESOLUTION_KEY
Enables conflict resolution (default, true) meaning no two labels will be allowed to overlap. Symbolizers with conflict resolution off are considered outside of the conflict resolution game, they don't reserve area and can overlap with other labels.

See Also:
Constant Field Values

DEFAULT_CONFLICT_RESOLUTION

static final boolean DEFAULT_CONFLICT_RESOLUTION
By default, put each label in the conflict resolution map

See Also:
Constant Field Values

GOODNESS_OF_FIT_KEY

static final java.lang.String GOODNESS_OF_FIT_KEY
Sets the percentage of the label that must sit inside the geometry to allow drawing the label. Works only on polygons.

See Also:
Constant Field Values

DEFAULT_GOODNESS_OF_FIT

static final double DEFAULT_GOODNESS_OF_FIT
Default value for the goodness of fit threshold

See Also:
Constant Field Values
Method Detail

getLabel

org.opengis.filter.expression.Expression getLabel()
Returns the expression that will be evaluated to determine what text is displayed.

Specified by:
getLabel in interface org.opengis.style.TextSymbolizer
Returns:
Expression that will be evaulated as a String to display on screen

setLabel

void setLabel(org.opengis.filter.expression.Expression label)
Sets the expression that will be evaluated to determine what text is displayed. See getLabel() for details.


getFonts

Font[] getFonts()
Deprecated. use getFont()

Returns a device independent Font object that is to be used to render the label.


getFont

Font getFont()
Font to use when rendering this symbolizer.

Specified by:
getFont in interface org.opengis.style.TextSymbolizer
Returns:
Font to use when rendering this symbolizer

setFont

void setFont(org.opengis.style.Font font)
Font used when rendering this symbolizer.

Parameters:
font -

setFonts

void setFonts(Font[] fonts)
Deprecated. use getFont() setters to modify the set of font faces used

sets a list of device independent Font objects to be used to render the label.


getLabelPlacement

LabelPlacement getLabelPlacement()
A LabelPlacement specifies how a text element should be rendered relative to its geometric point or line.

Specified by:
getLabelPlacement in interface org.opengis.style.TextSymbolizer

setLabelPlacement

void setLabelPlacement(org.opengis.style.LabelPlacement labelPlacement)
A LabelPlacement specifies how a text element should be rendered relative to its geometric point or line.


setPlacement

void setPlacement(LabelPlacement labelPlacement)
Deprecated. Please use setLabelPlacement

A LabelPlacement specifies how a text element should be rendered relative to its geometric point or line.


getPlacement

LabelPlacement getPlacement()
Deprecated. Please use getLabelPlacement()

A LabelPlacement specifies how a text element should be rendered relative to its geometric point or line.


getHalo

Halo getHalo()
A halo fills an extended area outside the glyphs of a rendered text label to make the label easier to read over a background.

Specified by:
getHalo in interface org.opengis.style.TextSymbolizer

setHalo

void setHalo(org.opengis.style.Halo halo)
A halo fills an extended area outside the glyphs of a rendered text label to make the label easier to read over a background.


getFill

Fill getFill()
Returns the object that indicates how the text will be filled.

Specified by:
getFill in interface org.opengis.style.TextSymbolizer

setFill

void setFill(org.opengis.style.Fill fill)
Sets the object that indicates how the text will be filled. See getFill() for details.


setPriority

void setPriority(org.opengis.filter.expression.Expression e)
Priority -- null = use the default labeling priority Expression = an expression that evaluates to a number (ie. Integer, Long, Double...) Larger = more likely to be rendered


getPriority

org.opengis.filter.expression.Expression getPriority()
Priority -- null = use the default labeling priority Expression = an expression that evaluates to a number (ie. Integer, Long, Double...) Larger = more likely to be rendered


addToOptions

void addToOptions(java.lang.String key,
                  java.lang.String value)
Deprecated. Please use getOptions().put( key, value )

Adds a parameter value to the options map


getOption

java.lang.String getOption(java.lang.String key)
Deprecated. Please use getOptions.get( key )

Find the value of a key in the map (may return null)

Parameters:
key -

getOptions

java.util.Map<java.lang.String,java.lang.String> getOptions()
return the map of option

Returns:
null - no options set


Copyright © 1996-2010 Geotools. All Rights Reserved.