com.bbn.openmap.omGraphics
Class OMRangeRings

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

public class OMRangeRings
extends OMCircle

An object that manages a series of range circles. It is really an OMCircle that manages a set of inner circles and an OMPOint. The location of these inner circles depend on two new variables, the interval and intervalUnits. If the intervalUnits are null, then the interval represents the number of inner circles, not including the outer ring and the innermost point, that are spaced evenly between them. If the intervalUnits are not null, then the interval represents the number of intervalUnits where inner circles are placed. For example, if the intervalUnits is Length.MILE, and the interval is 5, then inner circles will be placed every 5 miles. If the intervalUnits is null, then there will be 5 inner circles drawn between the center point and the outer ring.

See Also:
OMCircle, Serialized Form

Field Summary
protected  OMPoint centerPoint
          The center point of the range rings.
static java.text.DecimalFormat DEFAULT_FORMAT
          The default format.
static int DEFAULT_INTERVAL
          By default, there are 3 inner rings, 4 total.
protected  DrawingAttributes drawingAttributes
          The DrawingAttributes object used to reflect the outer circle properties to the inner circles.
protected  boolean drawLabels
           
protected  java.text.NumberFormat form
          Formatting for the labels with units.
protected  int interval
          The number of rings, or the unit interval, depending on whether intervalUnits is null or not.
protected  Length intervalUnits
          The unit object specifying the interval meaning.
protected  OMText[] labels
          The labels for the circles.
protected  OMCircle[] subCircles
          The inner ring of circles.
 
Fields inherited from class com.bbn.openmap.omGraphics.OMArc
arcType, center, extent, height, nverts, off_x, off_y, radius, rotationAngle, start, width, x1, y1
 
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
OMRangeRings()
          Used for UndoEvents.
OMRangeRings(double latPoint, double lonPoint, double radius)
          Creates an OMRangeRings with a Lat-lon center and a lat-lon axis.
OMRangeRings(double latPoint, double lonPoint, double radius, Length units)
          Create an OMRangeRings with a lat/lon center and a physical distance radius.
OMRangeRings(double latPoint, double lonPoint, double radius, Length units, int nverts)
          Create an OMRangeRings with a lat/lon center and a physical distance radius.
OMRangeRings(LatLonPoint center, double radius, Length units, int nverts)
          Create an OMRangeRings with a lat/lon center and a physical distance radius.
 
Method Summary
protected  OMPoint createCenterPoint()
           
 OMCircle[] createCircles()
          Take the interval and intervalUnits, and then create the proper inner circles.
 float distance(double x, double y)
          Return the shortest distance from the circle to an XY-point.
 boolean generate(Projection proj)
          Prepare the circles for rendering.
 boolean getDrawLabels()
           
 java.text.NumberFormat getFormat()
          Get the format used for the labeling of unit rings.
 int getInterval()
          Get the interval number.
 Length getIntervalUnits()
          Get the interval units.
 void render(java.awt.Graphics g)
          Paint the circles.
 void restore(OMGeometry source)
          Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.
 void setDrawLabels(boolean dl)
          Flag for whether the rings should be labeled.
 void setFormat(java.text.NumberFormat nf)
          Set the format for the number labels.
 void setInterval(int interval)
          Set the interval.
 void setInterval(int interval, Length units)
          Convenience method to set both at one time.
 void setIntervalUnits(Length units)
          Set the interval units.
 void setRadius(float radius)
          Set the radius.
 void setRadius(float radius, Length units)
          Set the radius with units.
 
Methods inherited from class com.bbn.openmap.omGraphics.OMCircle
createArcShape, getCoordLists, hasLineTypeChoice, shouldCenterBeInShape
 
Methods inherited from class com.bbn.openmap.omGraphics.OMArc
clone, createArcShape, getArcType, getCenter, getCoordLists, getExtentAngle, getHeight, getLatLon, getNumVerts, getOffX, getOffY, getPolarCorrection, getPolarShapeLine, getRadius, getRotationAngle, getStartAngle, getWidth, getX, getY, setArcType, setCenter, setExtent, setHeight, setLatLon, setNeedToRegenerate, setNumVerts, setOffX, setOffY, setPolarCorrection, setRadius, setRadius, setRotationAngle, setStart, setWidth, setX, setY
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
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, 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
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, setShape, setVisible
 

Field Detail

subCircles

protected OMCircle[] subCircles
The inner ring of circles.


labels

protected OMText[] labels
The labels for the circles.


DEFAULT_INTERVAL

public static final int DEFAULT_INTERVAL
By default, there are 3 inner rings, 4 total.

See Also:
Constant Field Values

interval

protected int interval
The number of rings, or the unit interval, depending on whether intervalUnits is null or not.


intervalUnits

protected Length intervalUnits
The unit object specifying the interval meaning.


drawingAttributes

protected DrawingAttributes drawingAttributes
The DrawingAttributes object used to reflect the outer circle properties to the inner circles. Only used in render(), and allocated to save repeated allocation during render.


centerPoint

protected OMPoint centerPoint
The center point of the range rings.


DEFAULT_FORMAT

public static final java.text.DecimalFormat DEFAULT_FORMAT
The default format.


form

protected java.text.NumberFormat form
Formatting for the labels with units.


drawLabels

protected boolean drawLabels
Constructor Detail

OMRangeRings

public OMRangeRings()
Used for UndoEvents. Otherwise, don't use this unless you set all other parameters befitting an OMGraphic of such resplendent information.


OMRangeRings

public OMRangeRings(double latPoint,
                    double lonPoint,
                    double radius)
Creates an OMRangeRings with a Lat-lon center and a lat-lon axis. Rendertype is RENDERTYPE_LATLON.

Parameters:
latPoint - latitude of center point, decimal degrees
lonPoint - longitude of center point, decimal degrees
radius - distance in decimal degrees (converted to radians internally).

OMRangeRings

public OMRangeRings(double latPoint,
                    double lonPoint,
                    double radius,
                    Length units)
Create an OMRangeRings with a lat/lon center and a physical distance radius. Rendertype is RENDERTYPE_LATLON.

Parameters:
latPoint - latitude of center of circle in decimal degrees
lonPoint - longitude of center of circle in decimal degrees
radius - distance
units - com.bbn.openmap.proj.Length object.

OMRangeRings

public OMRangeRings(double latPoint,
                    double lonPoint,
                    double radius,
                    Length units,
                    int nverts)
Create an OMRangeRings with a lat/lon center and a physical distance radius. Rendertype is RENDERTYPE_LATLON.

Parameters:
latPoint - latitude of center of circle in decimal degrees
lonPoint - longitude of center of circle in decimal degrees
radius - distance
units - com.bbn.openmap.proj.Length object specifying units.
nverts - number of vertices for the poly-circle (if < 3, value is generated internally)

OMRangeRings

public OMRangeRings(LatLonPoint center,
                    double radius,
                    Length units,
                    int nverts)
Create an OMRangeRings with a lat/lon center and a physical distance radius. Rendertype is RENDERTYPE_LATLON.

Parameters:
center - LatLon center of circle
radius - distance
units - com.bbn.openmap.proj.Length object specifying units for distance.
nverts - number of vertices for the poly-circle(if < 3, value is generated internally)
Method Detail

createCenterPoint

protected OMPoint createCenterPoint()

setInterval

public void setInterval(int interval)
Set the interval. If the interval units are null, then this interval represents the number of circles within the external, defined circle. If the interval units are not null, then this interval represents the unit intervals where range rings are placed.


setInterval

public void setInterval(int interval,
                        Length units)
Convenience method to set both at one time.


getInterval

public int getInterval()
Get the interval number.


setIntervalUnits

public void setIntervalUnits(Length units)
Set the interval units. If this is null, then the interval value will represent the number of rings drawn within the defined outer ring. If this is not null, then it represents the units of the interval where the range rings are drawn.


getIntervalUnits

public Length getIntervalUnits()
Get the interval units.


setDrawLabels

public void setDrawLabels(boolean dl)
Flag for whether the rings should be labeled.


getDrawLabels

public boolean getDrawLabels()

setFormat

public void setFormat(java.text.NumberFormat nf)
Set the format for the number labels. If null, the default will be used. This only applies to the labels with units.


getFormat

public java.text.NumberFormat getFormat()
Get the format used for the labeling of unit rings.


setRadius

public void setRadius(float radius)
Set the radius. This is meaningful only if the render type is RENDERTYPE_LATLON. Note that while the radius is specified as decimal degrees, it only means the distance along the ground that that number of degrees represents at the equator, *NOT* a radius of a number of degrees around a certain location. There is a difference.

Parameters:
radius - float radius in decimal degrees

setRadius

public void setRadius(float radius,
                      Length units)
Set the radius with units. This is meaningful only if the render type is RENDERTYPE_LATLON.

Parameters:
radius - float radius
units - Length specifying unit type.

createCircles

public OMCircle[] createCircles()
Take the interval and intervalUnits, and then create the proper inner circles.


generate

public boolean generate(Projection proj)
Prepare the circles for rendering.

Specified by:
generate in interface OMGeometry
Overrides:
generate in class OMArc
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 circles.

Specified by:
render in interface OMGeometry
Overrides:
render in class OMArc
Parameters:
g - Graphics context to render into

distance

public float distance(double x,
                      double y)
Return the shortest distance from the circle to an XY-point.

Specified by:
distance in interface OMGeometry
Overrides:
distance in class OMGraphicAdapter
Parameters:
x - X coordinate of the point.
y - Y coordinate fo the point.
Returns:
float distance from circle to the point

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 OMArc


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