public class LabelPainter extends Object
Constructor and Description |
---|
LabelPainter(Graphics2D graphics,
LabelCacheImpl.LabelRenderingMode labelRenderingMode)
Builds a new painter
|
Modifier and Type | Method and Description |
---|---|
double |
getAscent()
The full size above the baseline
|
Rectangle2D |
getFullLabelBounds()
Get the straight label bounds, taking into account halo, shield and line wrapping
|
LabelCacheItem |
getLabel()
Returns the current label item
|
Rectangle2D |
getLabelBounds()
Get the straight label bounds, without taking into account halo and shield
|
int |
getLineCount()
Number of lines for this label (more than 1 if the label has embedded newlines or if we're
auto-wrapping it)
|
double |
getLineHeight()
Returns the line height for this label in pixels (for multiline labels, it's the height of
the first line)
|
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.
|
int |
getStraightLabelWidth()
Returns the width of the label, as painted in straight form (
|
void |
paintCurvedLabel(LineStringCursor cursor)
Paints a label that follows the line, centered in the current cursor position
|
void |
paintStraightLabel(AffineTransform transform)
Paints the label as a non curved one.
|
void |
setLabel(LabelCacheItem labelItem)
Sets the current label.
|
public LabelPainter(Graphics2D graphics, LabelCacheImpl.LabelRenderingMode labelRenderingMode)
graphics
- outlineRenderingEnabled
- public void setLabel(LabelCacheItem labelItem)
labelItem
- public LabelCacheItem getLabel()
public double getLineHeight()
public double getAscent()
public int getStraightLabelWidth()
public int getLineCount()
public Rectangle2D getFullLabelBounds()
public Rectangle2D getLabelBounds()
public void paintStraightLabel(AffineTransform transform) throws Exception
transform
- Exception
public void paintCurvedLabel(LineStringCursor cursor)
cursor
- public double getLinePlacementYAnchor()
Copyright © 1996–2019 Geotools. All rights reserved.