## com.bbn.openmap.omGraphics
Class OMText

    java.lang.Object
      com.bbn.openmap.omGraphics.geom.BasicGeometry
          com.bbn.openmap.omGraphics.OMGraphic
              com.bbn.openmap.omGraphics.OMText

All Implemented Interfaces:
  java.lang.Cloneable, OMGeometry, OMGraphicConstants, java.io.Serializable

Direct Known Subclasses:
  EsriTextPoint, MIFText, OMTextLabeler

public class OMText
extends OMGraphic
implements java.io.Serializable

The OMText graphic type lets you put text on the screen. The location of the string is really the location of the lower left corner of the first letter of the string.

See Also:
  Serialized Form

Field Summary
`static int` `ASCENT` Parameter of Font to count toward footprint of height of Text.
`static int` `ASCENT_DESCENT` Parameter of Font to count toward footprint of height of Text.
`static int` `ASCENT_LEADING` Parameter of Font to count toward footprint of height of Text.
`protected int` `baseline` Location of the baseline of the text compared to the location point of the OMText object.
`static int` `BASELINE_BOTTOM` Parameter that dictates where the font baseline will be set compared to the location of the OMText.
`static int` `BASELINE_MIDDLE` Parameter that dictates where the font baseline will be set compared to the location of the OMText.
`static int` `BASELINE_TOP` Parameter that dictates where the font baseline will be set compared to the location of the OMText.
`protected java.lang.String` `data` The string to be displayed.
`static java.awt.Font` `DEFAULT_FONT`
`static java.awt.Stroke` `DEFAULT_TEXT_MATTE_STROKE` The default text matte stroke that is used to surround each character with the color set in the textMatteColor attribute.
`protected java.awt.Font` `f` The Font type that the string should be displayed with.
`protected java.awt.FontMetrics` `fm` The Metrics of the current font.
`protected int` `fmHeight` The fmHeight is the FontMetric height to use for calculating the footprint for the line.
`protected FontSizer` `fontSizer` The FontSizer set in the OMText, changing the font size appropriate for a projection scale.
`protected Projection` `hackProj`
`static int` `HEIGHT` Parameter of Font to count toward footprint of height of Text.
`protected int` `justify` Justification of the string.
`static int` `JUSTIFY_CENTER` Align the text centered on the location.
`static int` `JUSTIFY_LEFT` Align the text to the right of the location.
`static int` `JUSTIFY_RIGHT` Align the text to the left of the location.
`protected float` `lat` The latitude location for the text, used for lat/lon or offset rendertype texts, in decimal degrees.
`protected float` `lon` The longitude location for the text, used for lat/lon or offset rendertype texts, in decimal degrees.
`protected java.lang.String[]` `parsedData` The text split by newlines.
`protected java.awt.Point` `point` The X/Y point or the offset amount depending on render type.
`protected java.awt.Polygon` `polyBounds` The bounding rectangle of this Text.
`protected java.awt.Point` `pt` The projected xy window location of the bottom left corner of the first letter of the text string.
`protected double` `rotationAngle` The angle by which the text is to be rotated, in radians
`protected java.awt.Color` `textMatteColor` The text matte color surrounds each character of the string with this color.
`protected java.awt.Stroke` `textMatteStroke` The stroke used to paint the outline of each character.
`protected boolean` `useMaxWidthForBounds`
`protected int[]` `widths` cached string widths.

Fields inherited from class com.bbn.openmap.omGraphics.OMGraphic
`declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask`

Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
`APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, visible`

Fields inherited from interface com.bbn.openmap.omGraphics.OMGraphicConstants

`ADD_GRAPHIC_MASK, BASIC_STROKE, CHANGE_APPEARANCE, clear, DECIMAL_DEGREES, DECLUTTERTYPE_LINE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_NONE, DECLUTTERTYPE_SPACE, DEFAULT_ROTATIONANGLE, DELETE_GRAPHIC_MASK, DESELECT_GRAPHIC_MASK, DESELECTALL_GRAPHIC_MASK, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, REMOVABLE, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK`

Constructor Summary
`OMText()` Default constructor.
`OMText(float lt, float ln, int offX, int offY, java.lang.String aString, java.awt.Font font, int just)` Creates a Text object, with lat/lon placement with XY offset.
`OMText(float lt, float ln, int offX, int offY, java.lang.String aString, int just)` Creates a Text object, with lat/lon placement with XY offset, and default SansSerif font.
`OMText(float lt, float ln, java.lang.String stuff, java.awt.Font font, int just)` Creates a text object, with Lat/Lon placement.
`OMText(float lt, float ln, java.lang.String stuff, int just)` Creates a text object, with Lat/Lon placement, and default SansSerif font.
`OMText(int px1, int py1, java.lang.String stuff, java.awt.Font font, int just)` Creates a text object, with XY placement.
`OMText(int px1, int py1, java.lang.String stuff, int just)` Creates a text object, with XY placement, and default SansSerif font.

Method Summary
`protected void` `computeBounds()` Computes the bounding polygon.
`protected void` `computeStringWidths(java.awt.FontMetrics fm)` Computes the widths of each line of the text.
`protected int` `countChar(java.lang.String str, int ch)` Counts occurences of a character in a string.
`float` `distance(int x, int y)` Return the shortest distance from the OMText to an XY-point.
`static java.lang.String` `fontToXFont(java.awt.Font font)` In some applications, fonts are represented by a string.
`boolean` `generate(Projection proj)` Prepares the text for rendering.
`int` `getBaseline()` Gets the baseline location of this OMText.
`java.lang.String` `getData()` Return the string.
`int` `getFMHeight()` Get the fmHeight used for the footprint.
`java.awt.Font` `getFont()` Get the font of the text object, which might have been scaled by the font sizer.
`FontSizer` `getFontSizer()` Get the FontSizer object, which provides different font sizes at different scales.
`int` `getJustify()` Gets the justification of this OMText.
`float` `getLat()` Get the latitude location of the string.
`float` `getLon()` Return the longitude.
`java.awt.Point` `getMapLocation()` Not for the faint hearted.
`java.awt.Polygon` `getPolyBounds()` Get the text bounds.
`double` `getRotationAngle()` Get the current rotation of the text.
`boolean` `getShowBounds()` Deprecated. use isMatted() instead.
`java.awt.Color` `getTextMatteColor()` Returns the color used to matte the actuall text of this class.
`java.awt.Stroke` `getTextMatteStroke()` Returns the stroke used to paint the outline of the characters in this text.
`double` `getTheta()` Deprecated. use getRotationAngle instead.
`boolean` `getUseMaxWidthForBounds()` Get flag to specify that the bounds, if displayed, should be rectangular.
`int` `getX()` Get the x location.
`int` `getY()` Get the y location.
`protected boolean` `hasLineTypeChoice()` Used by the GraphicAttributes object to provide a choice on whether the line type choice can be changed.
`protected void` `parseData()` Breaks the text down into separate lines.
`void` `prepareForRender(java.awt.Graphics g)` This function can be called to initialize the internals such as height and width of OMText.
`static java.awt.Font` `rebuildFont(java.lang.String fontString)` Build a font out of an X Font description string.
`void` `render(java.awt.Graphics g)` Renders the text onto the given graphics.
`protected void` `renderString(java.awt.Graphics g, java.lang.String string, int x, int y)`
`void` `setBaseline(int b)` Sets the location of the baseline of this OMText.
`void` `setData(java.lang.String d)` Sets the string contents that are presented.
`void` `setFMHeight(int fmh)` Set the fmHeight to use for the footprint.
`void` `setFont(float scale)` If the font sizer is not null, sets the scaled font with the proper value for the given scale.
`void` `setFont(java.awt.Font aFont)` Set the base font.
`void` `setFontSizer(FontSizer fs)` Set the FontSizer object, which provides different font sizes at different scales.
`void` `setJustify(int j)` Sets the justification of this OMText.
`void` `setLat(float l)` Set the latitude.
`void` `setLon(float l)` Set the longitude.
`void` `setMapLocation(java.awt.Point point)` Not for the faint hearted.
`void` `setRotationAngle(double angle)` Set the angle by which the text is to rotated.
`protected void` `setScaledFont(java.awt.Font aFont)` Sets the scaled font, which is the one that is used for rendering.
`void` `setShowBounds(boolean show)` Deprecated. use setMatted(boolean) instead.
`void` `setTextMatteColor(java.awt.Color textMatteColor)` Sets the color used to paint the outline of the characters in this text.
`void` `setTextMatteStroke(java.awt.Stroke textMatteStroke)` Sets the stroke used to paint the outline of the characters in this text For best effect the stroke thickness should be larger than 1 and it should be continuous.
`void` `setTheta(double theta)` Deprecated. use setRotationAngle instead.
`void` `setUseMaxWidthForBounds(boolean value)` Set flag to specify that the bounds, if displayed, should be rectangular.
`void` `setX(int newX)` Set the x location.
`void` `setY(int newY)` Set the y location.

Methods inherited from class com.bbn.openmap.omGraphics.OMGraphic

`clone, deselect, getDeclutterType, getDescription, getDescription, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShape, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill`

Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry

`_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, checkAttributeMap, checkAttributeMap, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, draw, fill, getAppObject, getAppObject, getAttribute, getAttributeMap, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
`clearAttributes, contains, draw, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible`

Field Detail

### JUSTIFY_LEFT

    public static final transient int JUSTIFY_LEFT

  Align the text to the right of the location.

  See Also:
    Constant Field Values

### JUSTIFY_CENTER

    public static final transient int JUSTIFY_CENTER

  Align the text centered on the location.

  See Also:
    Constant Field Values

### JUSTIFY_RIGHT

    public static final transient int JUSTIFY_RIGHT

  Align the text to the left of the location.

  See Also:
    Constant Field Values

### HEIGHT

    public static final transient int HEIGHT

  Parameter of Font to count toward footprint of height of Text. This indicates that the ascent, descent and leading of the text should count toward the footprint of the text. This is the same as the full height of the FontMetric, and is the default.

  See Also:
    Constant Field Values

### ASCENT_DESCENT

    public static final transient int ASCENT_DESCENT

  Parameter of Font to count toward footprint of height of Text. This indicates that the ascent and the descent of the text should count toward the footprint of the text.

  See Also:
    Constant Field Values

### ASCENT_LEADING

    public static final transient int ASCENT_LEADING

  Parameter of Font to count toward footprint of height of Text. This indicates that the ascent and the leading of the text should count toward the footprint of the text.

  See Also:
    Constant Field Values

### ASCENT

    public static final transient int ASCENT

  Parameter of Font to count toward footprint of height of Text. This indicates that just the ascent of the text should count toward the footprint of the text.

  See Also:
    Constant Field Values

### BASELINE_BOTTOM

    public static final transient int BASELINE_BOTTOM

  Parameter that dictates where the font baseline will be set compared to the location of the OMText. The BASELINE_BOTTOM setting, the default, means that the location will be set along the normal bottom edge of the text where the letters rest.

  See Also:
    Constant Field Values

### BASELINE_MIDDLE

    public static final transient int BASELINE_MIDDLE

  Parameter that dictates where the font baseline will be set compared to the location of the OMText. The BASELINE_MIDDLE setting means that the location will be set along the middle of the height of the text.

  See Also:
    Constant Field Values

### BASELINE_TOP

    public static final transient int BASELINE_TOP

  Parameter that dictates where the font baseline will be set compared to the location of the OMText. The BASELINE_TOP setting means that the location will be set along the top of the height of the text.

  See Also:
    Constant Field Values

### DEFAULT_FONT

    public static final java.awt.Font DEFAULT_FONT

### DEFAULT_TEXT_MATTE_STROKE

    public static final java.awt.Stroke DEFAULT_TEXT_MATTE_STROKE

  The default text matte stroke that is used to surround each character with the color set in the textMatteColor attribute.

### pt

    protected java.awt.Point pt

  The projected xy window location of the bottom left corner of the first letter of the text string.

### point

    protected java.awt.Point point

  The X/Y point or the offset amount depending on render type.

### f

    protected java.awt.Font f

  The Font type that the string should be displayed with.

### fontSizer

    protected FontSizer fontSizer

  The FontSizer set in the OMText, changing the font size appropriate for a projection scale.

### lat

    protected float lat

  The latitude location for the text, used for lat/lon or offset rendertype texts, in decimal degrees.

### lon

    protected float lon

  The longitude location for the text, used for lat/lon or offset rendertype texts, in decimal degrees.

### data

    protected java.lang.String data

  The string to be displayed.

### justify

    protected int justify

  Justification of the string. Will let you put the text to the right, centered or to the left of the given location.

### baseline

    protected int baseline

  Location of the baseline of the text compared to the location point of the OMText object. You can set this to be BASELINE_BOTTOM (default), BASELINE_MIDDLE or BASELINE_TOP, depending on if you want the bottom of the letters to be lined up to the location, or the middle or the top of them.

### fmHeight

    protected int fmHeight

  The fmHeight is the FontMetric height to use for calculating the footprint for the line. This becomes important for multi-line text and text in decluttering, because it dictates the amount of space surrounding the text. The default height is to take into account the ascent, descent and leading of the font.

### useMaxWidthForBounds

    protected boolean useMaxWidthForBounds

### rotationAngle

    protected double rotationAngle

  The angle by which the text is to be rotated, in radians

### textMatteColor

    protected java.awt.Color textMatteColor

  The text matte color surrounds each character of the string with this color. If the color is null, the text matte is not used.

### textMatteStroke

    protected java.awt.Stroke textMatteStroke

  The stroke used to paint the outline of each character. The stroke should be larger than 1 to give proper effect.

### polyBounds

    protected transient java.awt.Polygon polyBounds

  The bounding rectangle of this Text.

### fm

    protected transient java.awt.FontMetrics fm

  The Metrics of the current font.

### parsedData

    protected transient java.lang.String[] parsedData

  The text split by newlines.

### widths

    protected transient int[] widths

  cached string widths.

### hackProj

    protected Projection hackProj

Constructor Detail

### OMText

    public OMText()

  Default constructor. Produces an instance with no location and an empty string for text. For this instance to be useful it needs text (setData), a location (setX, setY, setLat, setLon) and a renderType (setRenderType).

### OMText

    public OMText(float lt,
                  float ln,
                  java.lang.String stuff,
                  int just)

  Creates a text object, with Lat/Lon placement, and default SansSerif font.

Parameters:
  `lt` - latitude of the string, in decimal degrees.
  `ln` - longitude of the string, in decimal degrees.
  `stuff` - the string to be displayed.
  `just` - the justification of the string

### OMText

    public OMText(float lt,
                  float ln,
                  java.lang.String stuff,
                  java.awt.Font font,
                  int just)

  Creates a text object, with Lat/Lon placement.

Parameters:
  `lt` - latitude of the string, in decimal degrees.
  `ln` - longitude of the string, in decimal degrees.
  `stuff` - the string to be displayed.
  `font` - the Font description for the string.
  `just` - the justification of the string

### OMText

    public OMText(int px1,
                  int py1,
                  java.lang.String stuff,
                  int just)

  Creates a text object, with XY placement, and default SansSerif font.

Parameters:
  `px1` - horizontal window pixel location of the string.
  `py1` - vertical window pixel location of the string.
  `stuff` - the string to be displayed.
  `just` - the justification of the string

### OMText

    public OMText(int px1,
                  int py1,
                  java.lang.String stuff,
                  java.awt.Font font,
                  int just)

  Creates a text object, with XY placement.

Parameters:
  `px1` - horizontal window pixel location of the string.
  `py1` - vertical window pixel location of the string.
  `stuff` - the string to be displayed.
  `font` - the Font description for the string.
  `just` - the justification of the string

### OMText

    public OMText(float lt,
                  float ln,
                  int offX,
                  int offY,
                  java.lang.String aString,
                  int just)

  Creates a Text object, with lat/lon placement with XY offset, and default SansSerif font.

Parameters:
  `lt` - latitude of the string, in decimal degrees.
  `ln` - longitude of the string, in decimal degrees.
  `offX` - horizontal offset of string
  `offY` - vertical offset of string
  `aString` - the string to be displayed.
  `just` - the justification of the string

### OMText

    public OMText(float lt,
                  float ln,
                  int offX,
                  int offY,
                  java.lang.String aString,
                  java.awt.Font font,
                  int just)

  Creates a Text object, with lat/lon placement with XY offset.

Parameters:
  `lt` - latitude of the string, in decimal degrees.
  `ln` - longitude of the string, in decimal degrees.
  `offX` - horizontal offset of string
  `offY` - vertical offset of string
  `aString` - the string to be displayed.
  `font` - the Font description for the string.
  `just` - the justification of the string

Method Detail

### getFont

    public java.awt.Font getFont()

  Get the font of the text object, which might have been scaled by the font sizer.

  Returns:
    the font of the object.

### setFont

    public void setFont(java.awt.Font aFont)

  Set the base font. Will take effect on the next render. If the font sizer is not null, this font will be set in that object as well, and the active font will come from the font sizer. To make the set font the constant font, set the font sizer to null. Flushes the cache fields `fm`, `widths`, and `polyBounds`. Calls setScaledFont.

  Parameters:
    `aFont` - font to be used for the text.
  See Also:
    `fm`, `widths`, `polyBounds`

### setScaledFont

    protected void setScaledFont(java.awt.Font aFont)

  Sets the scaled font, which is the one that is used for rendering.

### setFont

    public void setFont(float scale)

  If the font sizer is not null, sets the scaled font with the proper value for the given scale.

### setFontSizer

    public void setFontSizer(FontSizer fs)

  Set the FontSizer object, which provides different font sizes at different scales. If set to null, the font size will remain constant regardless of projection scale.

### getFontSizer

    public FontSizer getFontSizer()

  Get the FontSizer object, which provides different font sizes at different scales. If set to null, the font size will remain constant regardless of projection scale.

### getX

    public int getX()

  Get the x location. Applies to XY and OFFSET text objects.

  Returns:
    the horizontal window location of the string, from the left of the window.

### setX

    public void setX(int newX)

  Set the x location. Applies to XY and OFFSET text objects.

  Parameters:
    `newX` - the horizontal pixel location of the window to place the string.

### getY

    public int getY()

  Get the y location. Applies to XY and OFFSET text objects.

  Returns:
    the vertical pixel location of the string, from the top of the window.

### setY

    public void setY(int newY)

  Set the y location. Applies to XY and OFFSET text objects.

  Parameters:
    `newY` - the vertical pixel location of the window to place the string.

### getLat

    public float getLat()

  Get the latitude location of the string. Applies to LATLON and OFFSET text objects.

  Returns:
    the latitude, in decimal degrees.

### setLat

    public void setLat(float l)

  Set the latitude. Applies to LATLON and OFFSET text objects.

  Parameters:
    `l` - latitude for new location, in decimal degrees.

### getLon

    public float getLon()

  Return the longitude. Applies to LATLON and OFFSET text objects.

  Returns:
    the longitude location of the string, in decimal degrees.

### setLon

    public void setLon(float l)

  Set the longitude. Applies to LATLON and OFFSET text objects.

  Parameters:
    `l` - the longitude location for the string, in decimal degrees.

### getMapLocation

    public java.awt.Point getMapLocation()

  Not for the faint hearted. Used by the DeclutterMatrix to replace text on the map after it has been projected. This method lets the declutter matrix find out where the text should go.

  Returns:
    Point on the map where the text has been projected to go.

### setMapLocation

    public void setMapLocation(java.awt.Point point)

  Not for the faint hearted. Used by the DeclutterMatrix to replace text on the map after it has been projected. This method lets the declutter matrix put the text in an uncluttered place.

  Parameters:
    `point` - the point on the map where the text being placed.

### getTextMatteColor

    public java.awt.Color getTextMatteColor()

  Returns the color used to matte the actuall text of this class.

  Returns:
    the text matte color, null if not used

### setTextMatteColor

    public void setTextMatteColor(java.awt.Color textMatteColor)

  Sets the color used to paint the outline of the characters in this text. The thickness of the outline is decided by the textMatteStroke. If the color is null, the outline will not be painted. The default value is null.

  Parameters:
    `textMatteColor` -

### getTextMatteStroke

    public java.awt.Stroke getTextMatteStroke()

  Returns the stroke used to paint the outline of the characters in this text.

  Returns:
    the stroke used to paint the outline

### setTextMatteStroke

    public void setTextMatteStroke(java.awt.Stroke textMatteStroke)

  Sets the stroke used to paint the outline of the characters in this text For best effect the stroke thickness should be larger than 1 and it should be continuous. The default thickness is 2.

  Parameters:
    `textMatteStroke` - the new stroke

### getData

    public java.lang.String getData()

  Return the string.

  Returns:
    the string

### setData

    public void setData(java.lang.String d)

  Sets the string contents that are presented. Flushes the cache fields `parsedData`,`widths`, and `polyBounds`. HACK synchronized so that it doesn't interfere with other methods that are using parsedData.

  Parameters:
    `d` - the text to be displayed
  See Also:
    `parsedData`, `widths`, `polyBounds`

### getJustify

    public int getJustify()

  Gets the justification of this OMText.

  Returns:
    one of JUSTIFY_LEFT, JUSTIFY_CENTER, JUSTIFY_RIGHT

### setJustify

    public void setJustify(int j)

  Sets the justification of this OMText. Flushes the cache fields `fm`,`widths`, and `polyBounds`.

  Parameters:
    `j` - one of JUSTIFY_LEFT, JUSTIFY_CENTER, JUSTIFY_RIGHT
  See Also:
    `polyBounds`

### getBaseline

    public int getBaseline()

  Gets the baseline location of this OMText.

  Returns:
    one of BASELINE_BOTTOM, BASELINE_MIDDLE or BASELINE_TOP.

### setBaseline

    public void setBaseline(int b)

  Sets the location of the baseline of this OMText. Flushes the cache fields `fm`,`widths`, and `polyBounds`.

  Parameters:
    `b` - one of BASELINE_BOTTOM, BASELINE_MIDDLE or BASELINE_TOP.
  See Also:
    `polyBounds`

### getShowBounds

    public boolean getShowBounds()

  Deprecated. use isMatted() instead.

  Gets the show bounds field.

  Returns:
    true if bounds are shown, false if hidden.

### setShowBounds

    public void setShowBounds(boolean show)

  Deprecated. use setMatted(boolean) instead.

  Sets the show bounds field. When `true`, the bounding box of this text is displayed.

  Parameters:
    `show` - true to show, false to hide.
  See Also:
    `OMGraphic.setFillColor(java.awt.Color)`

### setUseMaxWidthForBounds

    public void setUseMaxWidthForBounds(boolean value)

  Set flag to specify that the bounds, if displayed, should be rectangular. Only really affects mult-line text.

  Parameters:
    `value` - if true, bounds for multi-line text will be retangular instead of closely following text.

### getUseMaxWidthForBounds

    public boolean getUseMaxWidthForBounds()

  Get flag to specify that the bounds, if displayed, should be rectangular. Only really affects mult-line text.

  Returns:
    true if bounds for multi-line text will be retangular instead of closely following text.

### getPolyBounds

    public java.awt.Polygon getPolyBounds()

  Get the text bounds.

  Returns:
    Polygon or null if bounds not calculated yet

### setFMHeight

    public void setFMHeight(int fmh)

  Set the fmHeight to use for the footprint.

  Parameters:
    `fmh` - the setting for fmHeight, out of the parameters stated above.

### getFMHeight

    public int getFMHeight()

  Get the fmHeight used for the footprint.

  Returns:
    the setting for fmHeight, out of the parameters stated above.

### setTheta

    public void setTheta(double theta)

  Deprecated. use setRotationAngle instead.

  Set the angle by which the text is to rotated.

  Parameters:
    `theta` - the number of radians the text is to be rotated. Measured clockwise from horizontal.

### getTheta

    public double getTheta()

  Deprecated. use getRotationAngle instead.

  Get the current rotation of the text.

  Returns:
    the text rotation.

### setRotationAngle

    public void setRotationAngle(double angle)

  Set the angle by which the text is to rotated.

  Parameters:
    `angle` - the number of radians the text is to be rotated. Measured clockwise from horizontal. Positive numbers move the positive x axis toward the positive y axis.

### getRotationAngle

    public double getRotationAngle()

  Get the current rotation of the text.

  Returns:
    the text rotation.

### generate

    public boolean generate(Projection proj)

  Prepares the text for rendering. Determines the location based on the renderType and possibly the projection. Sets the field `pt`. Flushes the cache field `polyBounds`.

  Specified by:
    `generate` in interface `OMGeometry`
  Specified by:
    `generate` in class `OMGraphic`
  Parameters:
    `proj` - the projection of the window.
  Returns:
    true if the placement of the string on the window is valid.
  See Also:
    `pt`

### rebuildFont

    public static java.awt.Font rebuildFont(java.lang.String fontString)

  Build a font out of an X Font description string. This function take this common string format, and pulls the font type, style, and size out of it.

  Parameters:
    `fontString` - the X font description.

### fontToXFont

    public static java.lang.String fontToXFont(java.awt.Font font)

  In some applications, fonts are represented by a string. Traditionally, with MATT, the font was a X representation of a font. That's what is being done here - we're taking the Font structure, and then going to XFont type text structure. Dashes need to be included, line feeds are not. They are here only for readability. The rebuildFont method brings this back to a java Font.

  Parameters:
    `font` - the Java font to convert to an XFont string.
  Returns:
    the font as a string.

### countChar

    protected int countChar(java.lang.String str,
                            int ch)

  Counts occurences of a character in a string.

  Parameters:
    `str` - the String
    `ch` - the character to count
  Returns:
    the number of occurences

### parseData

    protected void parseData()

  Breaks the text down into separate lines. Sets the cache field `parsedData`.

  See Also:
    `parsedData`

### computeStringWidths

    protected void computeStringWidths(java.awt.FontMetrics fm)

  Computes the widths of each line of the text. Sets the cache field `widths`.

  Parameters:
    `fm` - the metrics to use for computation.
  See Also:
    `widths`

### prepareForRender

    public void prepareForRender(java.awt.Graphics g)

  This function can be called to initialize the internals such as height and width of OMText. Lets you use the graphics, and thus the FontMetrics object, to figure out the dimensions of the text in order to manipulate the placement of the text on the map. These internals were otherwise initialized only when render function was called.

  Parameters:
    `g` - the java.awt.Graphics to put the string on.

### render

    public void render(java.awt.Graphics g)

  Renders the text onto the given graphics. Sets the cache field `fm`.

  Overrides:
    `render` in class `OMGraphic`
  Parameters:
    `g` - the java.awt.Graphics to put the string on.
  See Also:
    `fm`

### renderString

    protected void renderString(java.awt.Graphics g,
                                java.lang.String string,
                                int x,
                                int y)

### computeBounds

    protected void computeBounds()

  Computes the bounding polygon. Sets the cache field `polyBounds`.

  See Also:
    `polyBounds`

### distance

    public float distance(int x,
                          int y)

  Return the shortest distance from the OMText to an XY-point.

  This method uses the OMText's internal Shape object, created from the boundary of the text, as its boundary.

  Specified by:
    `distance` in interface `OMGeometry`
  Overrides:
    `distance` in class `OMGraphic`
  Parameters:
    `x` - X coordinate of the point.
    `y` - Y coordinate of the point.
  Returns:
    float distance, in pixels, from graphic to the point. Returns Float.POSITIVE_INFINITY if the graphic isn't ready (ungenerated).

### hasLineTypeChoice

    protected boolean hasLineTypeChoice()

  Description copied from class: `OMGraphic`
  Used by the GraphicAttributes object to provide a choice on whether the line type choice can be changed.

  Overrides:
    `hasLineTypeChoice` in class `OMGraphic`

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details