## com.bbn.openmap.omGraphics
Class OMDistance

    java.lang.Object
      com.bbn.openmap.omGraphics.geom.BasicGeometry
          com.bbn.openmap.omGraphics.OMGraphic
              com.bbn.openmap.omGraphics.OMAbstractLine
                  com.bbn.openmap.omGraphics.OMPoly
                      com.bbn.openmap.omGraphics.OMDistance

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

public class OMDistance
extends OMPoly

OMGraphic object that represents a polyline, labeled with distances.

See Also:
  Serialized Form

Field Summary
`java.text.DecimalFormat` `df`
`protected Length` `distUnits`
`protected OMGraphicList` `labels`
`protected boolean` `paintOnlyPoly` Flag used by the EditableOMDistance to do quick movement paints in a cleaner way.
`protected OMGraphicList` `points`

Fields inherited from class com.bbn.openmap.omGraphics.OMPoly
`coordMode, COORDMODE_ORIGIN, COORDMODE_PREVIOUS, doShapes, geometryClosed, isPolygon, lat, lon, rawllpts, units, xs, ys`

Fields inherited from class com.bbn.openmap.omGraphics.OMAbstractLine
`nsegs, xpoints, ypoints`

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
`OMDistance()` Construct a default OMDistance.
`OMDistance(float[] llPoints, int units, int lType, int nsegs, Length distanceUnits)` Create an OMDistance from a list of float lat/lon pairs.
`OMDistance(float[] llPoints, int units, int lType, Length distanceUnits)` Create an OMDistance from a list of float lat/lon pairs.

Method Summary
`OMText` `createLabel(Geo g1, Geo g2, float dist, float cumulativeDist, Length distanceUnits)` Get an OMText label for a segments between the given lat/lon points whose given distance and cumulative distance is specified.
`void` `createLabels()`
`boolean` `generate(Projection proj)` Prepare the poly for rendering.
`float` `getDist(Geo g1, Geo g2)` Return the distance between that lat/lons defined in radians.
`Length` `getDistUnits()` Get the Length object used to represent distances.
`void` `render(java.awt.Graphics g)` Paint the poly.
`void` `setDistUnits(Length distanceUnits)` Set the Length object used to represent distances.
`void` `setLocation(float[] llPoints, int units)` Set an OMPoly from a list of float lat/lon pairs.

Methods inherited from class com.bbn.openmap.omGraphics.OMPoly
`checkPoints, createShape, distance, getCoordMode, getDoShapes, getLat, getLatLonArray, getLon, getNumSegs, getRawllpts, getShape, getUnits, getXs, getYs, isGeometryClosed, isPolygon, setCoordMode, setDoShapes, setFillPaint, setIsPolygon, setLat, setLocation, setLocation, setLocation, setLocation, setLon, setNumSegs, setXs, setYs, shouldRenderFill`

Methods inherited from class com.bbn.openmap.omGraphics.OMAbstractLine
`addArrowHead, addArrowHead, addArrowHead, addArrowHead, createArrowHeads, getArrowDirectionType, getArrowHead, getArrowLocation, getWingLength, getWingTip, hasArrowHead, setArrowHead`

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, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShape, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge`

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, 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, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible`

Field Detail

### labels

    protected OMGraphicList labels

### points

    protected OMGraphicList points

### distUnits

    protected transient Length distUnits

### df

    public java.text.DecimalFormat df

### paintOnlyPoly

    protected boolean paintOnlyPoly

  Flag used by the EditableOMDistance to do quick movement paints in a cleaner way.

Constructor Detail

### OMDistance

    public OMDistance()

  Construct a default OMDistance.

### OMDistance

    public OMDistance(float[] llPoints,
                      int units,
                      int lType,
                      Length distanceUnits)

  Create an OMDistance from a list of float lat/lon pairs.

  NOTES:

  - llPoints array is converted into radians IN PLACE for more efficient handling internally if it's not already in radians! For even better performance, you should send us an array already in radians format!
  - If you want the poly to be connected (as a polygon), you need to ensure that the first and last coordinate pairs are the same.

Parameters:
  `llPoints` - array of lat/lon points, arranged lat, lon, lat, lon, etc.
  `units` - radians or decimal degrees. Use OMGraphic.RADIANS or OMGraphic.DECIMAL_DEGREES
  `lType` - line type, from a list defined in OMGraphic.

### OMDistance

    public OMDistance(float[] llPoints,
                      int units,
                      int lType,
                      int nsegs,
                      Length distanceUnits)

  Create an OMDistance from a list of float lat/lon pairs.

  NOTES:

  - llPoints array is converted into radians IN PLACE for more efficient handling internally if it's not already in radians! For even better performance, you should send us an array already in radians format!
  - If you want the poly to be connected (as a polygon), you need to ensure that the first and last coordinate pairs are the same.

Parameters:
  `llPoints` - array of lat/lon points, arranged lat, lon, lat, lon, etc.
  `units` - radians or decimal degrees. Use OMGraphic.RADIANS or OMGraphic.DECIMAL_DEGREES
  `lType` - line type, from a list defined in OMGraphic.
  `nsegs` - number of segment points (only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB line types, and if < 1, this value is generated internally)

Method Detail

### setDistUnits

    public void setDistUnits(Length distanceUnits)

  Set the Length object used to represent distances.

### getDistUnits

    public Length getDistUnits()

  Get the Length object used to represent distances.

### setLocation

    public void setLocation(float[] llPoints,
                            int units)

  Description copied from class: `OMPoly`
  Set an OMPoly from a list of float lat/lon pairs.

  NOTES:

  - llPoints array is converted into radians IN PLACE for more efficient handling internally if it's not already in radians! If you don't want the array to be changed, send in a copy.
  - If you want the poly to be connected (as a polygon), you need to ensure that the first and last coordinate pairs are the same.
  This is for RENDERTYPE_LATLON polys.

  Overrides:
    `setLocation` in class `OMPoly`
  Parameters:
    `llPoints` - array of lat/lon points, arranged lat, lon, lat, lon, etc.
    `units` - radians or decimal degrees. Use OMGraphic.RADIANS or OMGraphic.DECIMAL_DEGREES

### createLabels

    public void createLabels()

### createLabel

    public OMText createLabel(Geo g1,
                              Geo g2,
                              float dist,
                              float cumulativeDist,
                              Length distanceUnits)

  Get an OMText label for a segments between the given lat/lon points whose given distance and cumulative distance is specified.

### getDist

    public float getDist(Geo g1,
                         Geo g2)

  Return the distance between that lat/lons defined in radians. The returned value is in radians.

### generate

    public boolean generate(Projection proj)

  Prepare the poly for rendering.

  Specified by:
    `generate` in interface `OMGeometry`
  Overrides:
    `generate` in class `OMPoly`
  Parameters:
    `proj` - Projection
  Returns:
    true if generate was successful

### render

    public void render(java.awt.Graphics g)

  Paint the poly. This works if generate() has been successful.

  Overrides:
    `render` in class `OMPoly`
  Parameters:
    `g` - java.awt.Graphics to paint the poly onto.

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