com.bbn.openmap.omGraphics
Class OMDistance

java.lang.Object
  extended by com.bbn.openmap.omGraphics.geom.BasicGeometry
      extended by com.bbn.openmap.omGraphics.OMGraphicAdapter
          extended by com.bbn.openmap.omGraphics.OMAbstractLine
              extended by com.bbn.openmap.omGraphics.OMPoly
                  extended by com.bbn.openmap.omGraphics.OMDistance
All Implemented Interfaces:
OMGeometry, OMGraphic, OMGraphicConstants, java.io.Serializable, java.lang.Cloneable

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  java.awt.Font labelFont
          Font used for labels
protected  java.awt.Paint labelPaint
          Paint used for labels
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
arrowhead, nsegs, xpoints, ypoints
 
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
OMDistance()
          Construct a default OMDistance.
OMDistance(double[] llPoints, int units, int lType, int nsegs, Length distanceUnits)
          Create an OMDistance from a list of float lat/lon pairs.
OMDistance(double[] 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, double dist, double 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.
 double 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.
 java.awt.Font getFont()
           
 java.awt.Paint getLabelPaint()
           
 void render(java.awt.Graphics g)
          Paint the poly.
protected  void renderLabels(java.awt.Graphics g)
          render labels
protected  void renderPoints(java.awt.Graphics g)
          render points
 void restore(OMGeometry source)
          Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.
 void setDistUnits(Length distanceUnits)
          Set the Length object used to represent distances.
 void setFont(java.awt.Font font)
           
 void setLabelPaint(java.awt.Paint lPaint)
          Set paint used for labels
 void setLocation(double[] 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, getIndexOfFirstNodeOfSegIntersect, getLat, getLatLonArray, getLatLonArrayCopy, getLon, getNumSegs, getRawllpts, getShape, getUnits, getXs, getYs, insertRadians, isGeometryClosed, isPolygon, main, 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, restore, setArrowHead
 
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, hasLineTypeChoice, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, readTextureMask, regenerate, renderLabel, renderShape, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, 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, 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, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, select, setDeclutterType, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge
 
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry
clearAttributes, contains, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible
 

Field Detail

labels

protected OMGraphicList labels

points

protected OMGraphicList points

distUnits

protected Length distUnits

df

public java.text.DecimalFormat df

labelPaint

protected java.awt.Paint labelPaint
Paint used for labels


labelFont

protected java.awt.Font labelFont
Font used for labels


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

NOTES:

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

NOTES:

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(double[] llPoints,
                        int units)
Description copied from class: OMPoly
Set an OMPoly from a list of float lat/lon pairs.

NOTES:

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,
                          double dist,
                          double 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 double getDist(Geo g1,
                      Geo g2)
Return the distance between that lat/lons defined in radians. The returned value is in radians and LINETYPE is taken into consideration. LINETYPE_STRAIGHT returns same as LINETYPE_GREATCIRCLE, the ground distance between all nodes and not the degree distance of the lines.


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
See Also:
OMGraphicAdapter.regenerate(com.bbn.openmap.proj.Projection)

render

public void render(java.awt.Graphics g)
Paint the poly. This works if generate() has been successful.

Specified by:
render in interface OMGeometry
Overrides:
render in class OMPoly
Parameters:
g - java.awt.Graphics to paint the poly onto.

renderPoints

protected void renderPoints(java.awt.Graphics g)
render points


renderLabels

protected void renderLabels(java.awt.Graphics g)
render labels


setLabelPaint

public void setLabelPaint(java.awt.Paint lPaint)
Set paint used for labels

Parameters:
lPaint - paint used for labels

getLabelPaint

public java.awt.Paint getLabelPaint()
Returns:
normal paint used for labels

setFont

public void setFont(java.awt.Font font)
Parameters:
font - font used for labels

getFont

public java.awt.Font getFont()
Returns:
font used for labels

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 OMPoly


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