OMTextLabeler (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 OMTextLabeler

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

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

    public class OMTextLabeler

extends OMText
implements OMLabeler

A default implementation of OMLabeler that extends from OMText. One thing going on with OMTextLabelers is that they are set to be non-rotating by default, which means they preserve their set orientation even when the map rotates. If you want them to rotate with the map, unset the OMGraphicConstants.NO_ROTATE attribute, or set it to Boolean.FALSE.

     Usage:

      OMTextLabeler label = new OMTextLabeler(labelString, OMText.JUSTIFY_CENTER);
      omgraphic.putAttribute(OMGraphicConstants.LABEL, label);

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, HEIGHT, justify, JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, lat, lon, parsedData, point, polyBounds, pt, renderRotationAngle, rotationAngle, textMatteColor, textMatteStroke, useMaxWidthForBounds, 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
`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` | `restore(OMGeometry source)` Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.
`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.geom.Point2D 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, evaluateRotationAngle, fontToXFont, generate, getBaseline, getData, getFMHeight, getFont, getFontSizer, getJustify, getLat, getLineWidths, getLon, getMapLocation, getMaxLineWidth, getPolyBounds, getRotationAngle, getTextMatteColor, getTextMatteStroke, getUseMaxWidthForBounds, getX, getY, hasLineTypeChoice, parseData, prepareForRender, rebuildFont, render, renderString, setBaseline, setData, setFMHeight, setFont, setFont, setFontSizer, setJustify, setLat, setLon, setMapLocation, setRotationAngle, setScaledFont, setTextMatteColor, setTextMatteStroke, setUseMaxWidthForBounds, setX, setY`

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

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

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

### setLocation

    public void setLocation(java.awt.geom.Point2D p)

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

  Specified by:
    `setLocation` in interface `OMLabeler`

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

### 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)

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

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