## com.bbn.openmap.omGraphics
Class OMTextLabeler

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

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

public class OMTextLabeler
extends OMText
implements OMLabeler

A default implementation of OMLabeler that extends from OMText.

Author:
  dietrick
See Also:
  Serialized Form

Field Summary
`protected int` `anchor`
`static int` `ANCHOR_BOTTOM`
`static int` `ANCHOR_BOTTOMLEFT`
`static int` `ANCHOR_BOTTOMRIGHT`
`static int` `ANCHOR_CENTER`
`static int` `ANCHOR_LEFT`
`static int` `ANCHOR_RIGHT`
`static int` `ANCHOR_TOP`
`static int` `ANCHOR_TOPLEFT`
`static int` `ANCHOR_TOPRIGHT`

Fields inherited from class com.bbn.openmap.omGraphics.OMText
`ASCENT, ASCENT_DESCENT, ASCENT_LEADING, baseline, BASELINE_BOTTOM, BASELINE_MIDDLE, BASELINE_TOP, data, DEFAULT_FONT, DEFAULT_TEXT_MATTE_STROKE, f, fm, fmHeight, fontSizer, hackProj, HEIGHT, justify, JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, lat, lon, parsedData, point, polyBounds, pt, rotationAngle, textMatteColor, textMatteStroke, useMaxWidthForBounds, 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
`OMTextLabeler(java.lang.String stuff)`
`OMTextLabeler(java.lang.String stuff, java.awt.Font font, int just)`
`OMTextLabeler(java.lang.String stuff, java.awt.Font font, int just, int loc)`
`OMTextLabeler(java.lang.String stuff, int just)`
`OMTextLabeler(java.lang.String stuff, int just, int loc)`

Method Summary
`protected static double` `calculateProjectedArea(int[] xpts, int[] ypts)` Calculate the projected area of the poly.
`int` `getAnchor()`
`protected static java.awt.Point` `getCenter(int[] xpts, int[] ypts)` Get the calculated center where the label string is drawn.
`void` `setAnchor(int anchor)`
`void` `setLocation(java.awt.geom.GeneralPath gp)` The OMLabeler should be able to determine its pixel location based on the GeneralPath of the OMGraphic.
`void` `setLocation(int[] xpoints, int[] ypoints)` The OMLabeler should be able to determine its pixel location based on a set of x and y pixel coordinates common in OMGraphics.
`void` `setLocation(java.awt.Point p)` The OMLabeler should be able to set its pixel location directly.

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

`computeBounds, computeStringWidths, countChar, distance, fontToXFont, generate, getBaseline, getData, getFMHeight, getFont, getFontSizer, getJustify, getLat, getLon, getMapLocation, getPolyBounds, getRotationAngle, getShowBounds, getTextMatteColor, getTextMatteStroke, getTheta, getUseMaxWidthForBounds, getX, getY, hasLineTypeChoice, parseData, prepareForRender, rebuildFont, render, renderString, setBaseline, setData, setFMHeight, setFont, setFont, setFontSizer, setJustify, setLat, setLon, setMapLocation, setRotationAngle, setScaledFont, setShowBounds, setTextMatteColor, setTextMatteStroke, setTheta, setUseMaxWidthForBounds, setX, setY`

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.OMLabeler
`distance, render`

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

### ANCHOR_TOPLEFT

    public static final int ANCHOR_TOPLEFT

See Also:
  Constant Field Values

### ANCHOR_TOP

    public static final int ANCHOR_TOP

See Also:
  Constant Field Values

### ANCHOR_TOPRIGHT

    public static final int ANCHOR_TOPRIGHT

See Also:
  Constant Field Values

### ANCHOR_LEFT

    public static final int ANCHOR_LEFT

See Also:
  Constant Field Values

### ANCHOR_CENTER

    public static final int ANCHOR_CENTER

See Also:
  Constant Field Values

### ANCHOR_RIGHT

    public static final int ANCHOR_RIGHT

See Also:
  Constant Field Values

### ANCHOR_BOTTOMLEFT

    public static final int ANCHOR_BOTTOMLEFT

See Also:
  Constant Field Values

### ANCHOR_BOTTOM

    public static final int ANCHOR_BOTTOM

See Also:
  Constant Field Values

### ANCHOR_BOTTOMRIGHT

    public static final int ANCHOR_BOTTOMRIGHT

See Also:
  Constant Field Values

### anchor

    protected int anchor

Constructor Detail

### OMTextLabeler

    public OMTextLabeler(java.lang.String stuff)

### OMTextLabeler

    public OMTextLabeler(java.lang.String stuff,
                         int just)

Parameters:
  `stuff` -
  `just` -

### OMTextLabeler

    public OMTextLabeler(java.lang.String stuff,
                         int just,
                         int loc)

### OMTextLabeler

    public OMTextLabeler(java.lang.String stuff,
                         java.awt.Font font,
                         int just)

Parameters:
  `stuff` -
  `font` -
  `just` -

### OMTextLabeler

    public OMTextLabeler(java.lang.String stuff,
                         java.awt.Font font,
                         int just,
                         int loc)

Method Detail

### setLocation

    public void setLocation(java.awt.geom.GeneralPath gp)

  Description copied from interface: `OMLabeler`
  The OMLabeler should be able to determine its pixel location based on the GeneralPath of the OMGraphic. This will generally cause the label to be placed in the center of the bounds of the shape.

  Specified by:
    `setLocation` in interface `OMLabeler`
  Parameters:
    `gp` -

### setLocation

    public void setLocation(java.awt.Point p)

  Description copied from interface: `OMLabeler`
  The OMLabeler should be able to set its pixel location directly.

  Specified by:
    `setLocation` in interface `OMLabeler`
  Parameters:
    `p` -

### setLocation

    public void setLocation(int[] xpoints,
                            int[] ypoints)

  Description copied from interface: `OMLabeler`
  The OMLabeler should be able to determine its pixel location based on a set of x and y pixel coordinates common in OMGraphics.

  Specified by:
    `setLocation` in interface `OMLabeler`
  Parameters:
    `xpoints` -
    `ypoints` -

### calculateProjectedArea

    protected static double calculateProjectedArea(int[] xpts,
                                                   int[] ypts)

  Calculate the projected area of the poly. Algorithm used is from some australian astronomy website =) http://astronomy.swin.edu.au/~pbourke/geometry/polyarea

### getCenter

    protected static java.awt.Point getCenter(int[] xpts,
                                              int[] ypts)

  Get the calculated center where the label string is drawn. Algorithm used is from some australian astronomy website =) http://astronomy.swin.edu.au/~pbourke/geometry/polyarea

### getAnchor

    public int getAnchor()

### setAnchor

    public void setAnchor(int anchor)

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