OMText (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.omGraphics
Class OMText

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

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

Direct Known Subclasses:
  EsriTextPoint, MIFText, OMTextLabeler

    public class OMText

extends OMGraphicAdapter
implements OMGraphic

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.
`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 double` | `lat` The latitude location for the text, used for lat/lon or offset rendertype texts, in decimal degrees.
`protected double` | `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.geom.Point2D` | `pt` The projected xy window location of the bottom left corner of the first letter of the text string.
`protected java.lang.Double` | `renderRotationAngle` The rotation angle used at render time, depending on rotate-ability.
`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.OMGraphicAdapter
`declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask`

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

Fields inherited from interface com.bbn.openmap.omGraphics.OMGraphicConstants
`ADD_GRAPHIC_MASK, APP_OBJECT, 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, INDEX, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, NO_ROTATE, OMGRAPHIC_ELT, OMGRAPHIC_TYPE_ATTR, 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, UPDATED`

Constructor Summary
`OMText()` Default constructor.
`OMText(double lt, double ln, float offX, float offY, java.lang.String aString, java.awt.Font font, int just)` Creates a Text object, with lat/lon placement with XY offset.
`OMText(double lt, double ln, float offX, float offY, java.lang.String aString, int just)` Creates a Text object, with lat/lon placement with XY offset, and default SansSerif font.
`OMText(double lt, double ln, java.lang.String stuff, java.awt.Font font, int just)` Creates a text object, with Lat/Lon placement.
`OMText(double lt, double 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 java.awt.Polygon` | `computeBounds(java.awt.Polygon currentPolyBounds)` 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 occurrences of a character in a string.
`float` | `distance(double x, double y)` Return the shortest distance from the OMText to an XY-point.
`void` | `evaluateRotationAngle(Projection proj)` Set the renderRotationAngle based on the projection angle and OMText settings.
`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.
`double` | `getLat()` Get the latitude location of the string.
`int[]` | `getLineWidths()` Return a copy of the pixel lengths of the text line(s).
`double` | `getLon()` Return the longitude.
`java.awt.geom.Point2D` | `getMapLocation()` Not for the faint hearted.
`java.lang.Integer` | `getMaxLineWidth()` Get the pixel width of the longest line.
`java.awt.Polygon` | `getPolyBounds()` Get the text bounds.
`double` | `getRotationAngle()` Get the current rotation of the text.
`java.awt.Color` | `getTextMatteColor()` Returns the color used to matte the actual text of this class.
`java.awt.Stroke` | `getTextMatteStroke()` Returns the stroke used to paint the outline of the characters in this text.
`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.
`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, double x, double y)`
`void` | `restore(OMGeometry source)` Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.
`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(double l)` Set the latitude.
`void` | `setLon(double l)` Set the longitude.
`void` | `setMapLocation(java.awt.geom.Point2D 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` | `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` | `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.OMGraphicAdapter
`clone, deselect, getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, readTextureMask, regenerate, renderLabel, renderShape, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill, writeStroke, writeTextureMask`

Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry
`_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, 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.OMGraphic
`clone, deselect, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, select, setDeclutterType, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, shouldRenderFill`

Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
`clearAttributes, contains, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, 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 transient java.awt.Font DEFAULT_FONT

### DEFAULT_TEXT_MATTE_STROKE

    public static final transient 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.geom.Point2D 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 double lat

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

### lon

    protected double 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

### renderRotationAngle

    protected java.lang.Double renderRotationAngle

  The rotation angle used at render time, depending on rotate-ability. Radians. If null, no rotation should be applied at render time.

### 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 transient 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.

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(double lt,
                  double 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(double lt,
                  double 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(double lt,
                  double ln,
                  float offX,
                  float 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(double lt,
                  double ln,
                  float offX,
                  float 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 `currentPolyBounds` . 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 double 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(double l)

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

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

### getLon

    public double 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(double 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.geom.Point2D 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.geom.Point2D 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 actual 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 `currentPolyBounds`. 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 `currentPolyBounds`.

  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 `currentPolyBounds`.

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

### setUseMaxWidthForBounds

    public void setUseMaxWidthForBounds(boolean value)

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

  Parameters:
    `value` - if true, bounds for multi-line text will be rectangular 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.

### 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 `currentPolyBounds`.

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

### evaluateRotationAngle

    public void evaluateRotationAngle(Projection proj)

  Set the renderRotationAngle based on the projection angle and OMText settings.

  Parameters:
    `proj` - the current projection.

### 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 occurrences of a character in a string.

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

### 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`.

  Specified by:
    `render` in interface `OMGeometry`
  Overrides:
    `render` in class `OMGraphicAdapter`
  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,
                                double x,
                                double y)

### computeBounds

    protected java.awt.Polygon computeBounds(java.awt.Polygon currentPolyBounds)

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

  Parameters:
    `currentPolyBounds` - the current polygon bounds, new ones will be created if it's null
  Returns:
    new poly bounds if needed, or the current polygon bounds if already set.
  See Also:
    `polyBounds`

### distance

    public float distance(double x,
                          double 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 `OMGraphicAdapter`
  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

    public boolean hasLineTypeChoice()

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

  Specified by:
    `hasLineTypeChoice` in interface `OMGraphic`
  Overrides:
    `hasLineTypeChoice` in class `OMGraphicAdapter`

### getLineWidths

    public int[] getLineWidths()

  Return a copy of the pixel lengths of the text line(s).

  Returns:
    array of ints. Returns null if the widths haven't been calculated yet.

### getMaxLineWidth

    public java.lang.Integer getMaxLineWidth()

  Get the pixel width of the longest line.

  Returns:
    pixels, returns null if the widths haven't been calculated yet, zero minimum if they have.

### restore

    public void restore(OMGeometry source)

  Description copied from class: `OMGraphicAdapter`
  Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.

  Specified by:
    `restore` in interface `OMGeometry`
  Overrides:
    `restore` in class `OMGraphicAdapter`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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