Package org.geotools.renderer.label
Class LabelPainter
- Object
- 
- LabelPainter
 
- 
 public class LabelPainter extends Object This class performs the layouting and painting of the single label (leaving the label cache the task to sort labels and locate the best label points)- Author:
- Andrea Aime
 
- 
- 
Constructor SummaryConstructors Constructor Description LabelPainter(Graphics2D graphics, LabelCacheImpl.LabelRenderingMode labelRenderingMode)Builds a new painter
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetAscent()The full size above the baselineRectangle2DgetFullLabelBounds()Get the straight label bounds, taking into account halo, shield and line wrappingLabelCacheItemgetLabel()Returns the current label itemRectangle2DgetLabelBounds()Get the straight label bounds, without taking into account halo and shieldintgetLineCount()Number of lines for this label (more than 1 if the label has embedded newlines or if we're auto-wrapping it)doublegetLineHeight()Returns the line height for this label in pixels (for multiline labels, it's the height of the first line)doublegetLineHeightForAnchorY(double anchorY)Returns appropriate line height for the given displacemntY Should give Top line for max displacementY (1) and Bottom line for min displacemntY (0)doublegetLinePlacementYAnchor()Vertical centering is not trivial, because visually we want centering on characters such as a,m,e, and not centering on d,g whose center is affected by the full ascent or the full descent.intgetStraightLabelWidth()Returns the width of the label, as painted in straight form (voidpaintCurvedLabel(LineStringCursor cursor)Paints a label that follows the line, centered in the current cursor positionvoidpaintStraightLabel(AffineTransform transform)Paints the label as a non curved one.voidpaintStraightLabel(AffineTransform transform, Coordinate labelPoint)Paints the label as a non curved one.voidsetLabel(LabelCacheItem labelItem)Sets the current label.
 
- 
- 
- 
Constructor Detail- 
LabelPainterpublic LabelPainter(Graphics2D graphics, LabelCacheImpl.LabelRenderingMode labelRenderingMode) Builds a new painter
 
- 
 - 
Method Detail- 
setLabelpublic void setLabel(LabelCacheItem labelItem) Sets the current label. The label will be laid out according to the label item settings (curved lines, auto wrapping, curved line usage) and the painter will be ready to draw it.
 - 
getLabelpublic LabelCacheItem getLabel() Returns the current label item
 - 
getLineHeightpublic double getLineHeight() Returns the line height for this label in pixels (for multiline labels, it's the height of the first line)
 - 
getLineHeightForAnchorYpublic double getLineHeightForAnchorY(double anchorY) Returns appropriate line height for the given displacemntY Should give Top line for max displacementY (1) and Bottom line for min displacemntY (0)- Returns:
- height of appropriate line for passed label displacementY
 
 - 
getAscentpublic double getAscent() The full size above the baseline
 - 
getStraightLabelWidthpublic int getStraightLabelWidth() Returns the width of the label, as painted in straight form (
 - 
getLineCountpublic int getLineCount() Number of lines for this label (more than 1 if the label has embedded newlines or if we're auto-wrapping it)
 - 
getFullLabelBoundspublic Rectangle2D getFullLabelBounds() Get the straight label bounds, taking into account halo, shield and line wrapping
 - 
getLabelBoundspublic Rectangle2D getLabelBounds() Get the straight label bounds, without taking into account halo and shield
 - 
paintStraightLabelpublic void paintStraightLabel(AffineTransform transform) throws Exception Paints the label as a non curved one. The positioning and rotation are provided by the transformation- Throws:
- Exception
 
 - 
paintStraightLabelpublic void paintStraightLabel(AffineTransform transform, Coordinate labelPoint) throws Exception Paints the label as a non curved one. The positioning and rotation are provided by the transformation- Throws:
- Exception
 
 - 
paintCurvedLabelpublic void paintCurvedLabel(LineStringCursor cursor) Paints a label that follows the line, centered in the current cursor position
 - 
getLinePlacementYAnchorpublic double getLinePlacementYAnchor() Vertical centering is not trivial, because visually we want centering on characters such as a,m,e, and not centering on d,g whose center is affected by the full ascent or the full descent. This method tries to computes the y anchor taking into account those.
 
- 
 
-