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
 
Fields inherited from class com.bbn.openmap.omGraphics.OMText
ASCENT, ASCENT_DESCENT, ASCENT_LEADING, baseline, BASELINE_BOTTOM, BASELINE_MIDDLE, BASELINE_TOP, data, DEFAULT_FONT, f, fm, fmHeight, fontSizer, hackProj, HEIGHT, justify, JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, lat, lon, parsedData, point, polyBounds, pt, rotationAngle, 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, 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_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, 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, int just)
           
 
Method Summary
protected  double calculateProjectedArea(int[] xpts, int[] ypts)
          Calculate the projected area of the poly.
protected  java.awt.Point getCenter(int[] xpts, int[] ypts)
          Get the calculated center where the label string is drawn.
 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, getTheta, getUseMaxWidthForBounds, getX, getY, hasLineTypeChoice, parseData, prepareForRender, rebuildFont, render, setBaseline, setData, setFMHeight, setFont, setFont, setFontSizer, setJustify, setLat, setLon, setMapLocation, setRotationAngle, setScaledFont, setShowBounds, 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
 

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,
                     java.awt.Font font,
                     int just)
Parameters:
stuff -
font -
just -
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 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 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



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