com.bbn.openmap.omGraphics
Class OMArc

java.lang.Object
  extended bycom.bbn.openmap.omGraphics.geom.BasicGeometry
      extended bycom.bbn.openmap.omGraphics.OMGraphic
          extended bycom.bbn.openmap.omGraphics.OMArc
All Implemented Interfaces:
java.lang.Cloneable, OMGeometry, OMGraphicConstants, java.io.Serializable
Direct Known Subclasses:
OMCircle

public class OMArc
extends OMGraphic
implements java.io.Serializable

Graphic object that represents an arc.

NOTE:

See the RESTRICTIONS on Lat/Lon polygons/polylines which apply to arcs as well. Not following the guidelines listed may result in ambiguous/undefined shapes! Similar assumptions apply to the other vector graphics that we define: polys, rects, lines.

These assumptions are virtually the same as those on the more generic OMPoly graphic type.

See Also:
OMPoly, Serialized Form

Field Summary
protected  int arcType
          For Arcs, how the arc should be closed when rendered.
protected  LatLonPoint center
          Center point.
protected  float extent
          The angular extent of the arc in decimal degrees.
protected  int height
          The pixel vertical diameter of the arc.
protected  int nverts
          Number of vertices to draw for lat/lon poly-arcs.
protected  int off_x
          Horizontal pixel offset.
protected  int off_y
          Vertical pixel offset.
protected  float radius
          Radius of arc in radians.
protected  double rotationAngle
          The angle by which the circle/ellipse is to be rotated, in radians
protected  float start
          The starting angle of the arc in decimal degrees.
protected  int width
          The pixel horizontal diameter of the arc.
protected  int x1
          Horizontal pixel location of the center.
protected  int y1
          Vertical pixel location of the center.
 
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
OMArc()
          The simplest constructor for an OMArc, and it expects that all fields will be filled in later.
OMArc(float latPoint, float lonPoint, float radius, float s, float e)
          Creates an OMArc with a Lat-lon center and a lat-lon axis.
OMArc(float latPoint, float lonPoint, float radius, Length units, float s, float e)
          Create an OMArc with a lat/lon center and a physical distance radius.
OMArc(float latPoint, float lonPoint, float radius, Length units, int nverts, float s, float e)
          Create an OMArc with a lat/lon center and a physical distance radius.
OMArc(float latPoint, float lonPoint, int w, int h, float s, float e)
          Create an OMArc, positioned with a lat-lon center and x-y axis.
OMArc(float latPoint, float lonPoint, int offset_x1, int offset_y1, int w, int h, float s, float e)
          Create a OMArc, positioned at a Lat-lon location, x-y offset, x-y axis.
OMArc(int x1, int y1, int w, int h, float s, float e)
          Create a OMArc, positioned with a x-y center with x-y axis.
OMArc(LatLonPoint center, float radius, Length units, int nverts, float s, float e)
          Create an OMArc with a lat/lon center and a physical distance radius.
 
Method Summary
protected  java.awt.Shape createArcShape(float x, float y, float fwidth, float fheight)
          An internal method designed to fetch the Shape to be used for an XY or OFFSET OMArc.
 boolean generate(Projection proj)
          Prepare the arc for rendering.
 int getArcType()
          Get the ArcType.
 LatLonPoint getCenter()
          Get the center LatLonPoint.
protected  java.util.ArrayList getCoordLists(Projection proj, LatLonPoint center, float radius, int nverts)
          An internal method designed to fetch the ArrayList for LATLON OMArcs.
 float getExtentAngle()
          Get the extent angle of the arc.
 int getHeight()
          Get the vertical pixel diameter of the arc.
 LatLonPoint getLatLon()
          Get the center LatLonPoint.
 int getNumVerts()
          Get the number of vertices of the lat/lon arc.
 int getOffX()
          Get the x offset from the center.
 int getOffY()
          Get the y position of the center.
 boolean getPolarCorrection()
          Get the polar-fill-correction-flag.
 java.awt.geom.GeneralPath getPolarShapeLine()
          Return the java.awt.Shape (GeneralPath) that reflects a arc that encompases a pole.
 float getRadius()
          Get the radius.
 double getRotationAngle()
          Get the current rotation of the arc.
 float getStartAngle()
          Get the starting angle of the arc.
 int getWidth()
          Get the horizontal pixel diameter of the arc.
 int getX()
          Get the x position of the center.
 int getY()
          Get the y position of the center.
 void render(java.awt.Graphics g)
          Paint the arc.
 void setArcType(int type)
          Set the ArcType, either Arc2D.OPEN (default), Arc2D.PIE or Arc2D.CHORD.
 void setCenter(LatLonPoint p)
          Set the latitude and longitude of the center point.
 void setExtent(float value)
          Set the angular extent of the arc.
 void setHeight(int value)
          Set the vertical pixel diameter of the arc.
 void setLatLon(float lat, float lon)
          Set the latitude and longitude of the center point.
 void setNeedToRegenerate(boolean value)
          Sets the regenerate flag for the graphic.
 void setNumVerts(int nverts)
          Set the number of vertices of the lat/lon arc.
 void setOffX(int value)
          Set the x offset from the center.
 void setOffY(int value)
          Set the y offset from the center.
 void setPolarCorrection(boolean value)
          Set the polar-fill-correction-flag.
 void setRadius(float radius)
          Set the radius.
 void setRadius(float radius, Length units)
          Set the radius with units.
 void setRotationAngle(double angle)
          Set the angle by which the arc is to rotated.
 void setStart(float value)
          Set the starting angle the arc.
 void setWidth(int value)
          Set the horizontal pixel diameter of the arc.
 void setX(int value)
          Set the x position of the center.
 void setY(int value)
          Set the y position of the center.
protected  boolean shouldCenterBeInShape()
          Helper function that helps the generate method figure out if the center point should be in the generate shape - if it's not, the code knows that there is a problem with the poles, and the polar correction code needs to be run.
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphic
clone, deselect, distance, 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, 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, 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, getShape, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setVisible
 

Field Detail

x1

protected int x1
Horizontal pixel location of the center.


y1

protected int y1
Vertical pixel location of the center.


off_x

protected int off_x
Horizontal pixel offset.


off_y

protected int off_y
Vertical pixel offset.


center

protected LatLonPoint center
Center point.


radius

protected float radius
Radius of arc in radians. For LATLON arc. Note that the methods for this class use Decimal Degrees, or ask for a Length object to use for units. The radius is converted to radians for internal use.


width

protected int width
The pixel horizontal diameter of the arc. For XY and OFFSET arcs.


height

protected int height
The pixel vertical diameter of the arc. For XY and OFFSET arcs.


start

protected float start
The starting angle of the arc in decimal degrees. This is defined in decimal degrees because the java.awt.geom.Arc object wants it in decimal degrees. 0 is North?


extent

protected float extent
The angular extent of the arc in decimal degrees.


arcType

protected int arcType
For Arcs, how the arc should be closed when rendered. Arc2D.OPEN is the default, Arc2D.PIE and Arc2D.CHORD are options.

See Also:
Arc2D

nverts

protected int nverts
Number of vertices to draw for lat/lon poly-arcs.


rotationAngle

protected double rotationAngle
The angle by which the circle/ellipse is to be rotated, in radians

Constructor Detail

OMArc

public OMArc()
The simplest constructor for an OMArc, and it expects that all fields will be filled in later. Rendertype is RENDERTYPE_UNKNOWN.


OMArc

public OMArc(float latPoint,
             float lonPoint,
             int w,
             int h,
             float s,
             float e)
Create an OMArc, positioned with a lat-lon center and x-y axis. Rendertype is RENDERTYPE_OFFSET.

Parameters:
latPoint - latitude of center point, decimal degrees
lonPoint - longitude of center point, decimal degrees
w - horizontal diameter of arc, pixels
h - vertical diameter of arc, pixels
s - starting angle of arc, decimal degrees
e - angular extent of arc, decimal degrees

OMArc

public OMArc(int x1,
             int y1,
             int w,
             int h,
             float s,
             float e)
Create a OMArc, positioned with a x-y center with x-y axis. Rendertype is RENDERTYPE_XY.

Parameters:
x1 - window position of center point from left of window, in pixels
y1 - window position of center point from top of window, in pixels
w - horizontal diameter of arc, pixels
h - vertical diameter of arc, pixels
s - starting angle of arc, decimal degrees
e - angular extent of arc, decimal degrees. For XY rendertype arcs, positive extents go in the counter-clockwise direction, matching the java.awt.geom.Arc2D convention.

OMArc

public OMArc(float latPoint,
             float lonPoint,
             int offset_x1,
             int offset_y1,
             int w,
             int h,
             float s,
             float e)
Create a OMArc, positioned at a Lat-lon location, x-y offset, x-y axis. Rendertype is RENDERTYPE_OFFSET.

Parameters:
latPoint - latitude of center of arc.
lonPoint - longitude of center of arc.
offset_x1 - # pixels to the right the center will be moved from lonPoint.
offset_y1 - # pixels down that the center will be moved from latPoint.
w - horizontal diameter of arc, pixels.
h - vertical diameter of arc, pixels.
s - starting angle of arc, decimal degrees.
e - angular extent of arc, decimal degrees. For Offset rendertype arcs, positive extents go in the counter-clockwise direction, matching the java.awt.geom.Arc2D convention.

OMArc

public OMArc(float latPoint,
             float lonPoint,
             float radius,
             float s,
             float e)
Creates an OMArc 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).
s - starting angle of arc, decimal degrees
e - angular extent of arc, decimal degrees. For LATLON rendertype arcs, positive extents go in the clockwise direction, matching the OpenMap convention in coordinate space.

OMArc

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

Parameters:
latPoint - latitude of center of arc in decimal degrees
lonPoint - longitude of center of arc in decimal degrees
radius - distance
units - com.bbn.openmap.proj.Length object.
s - starting angle of arc, decimal degrees.
e - angular extent of arc, decimal degrees. For LATLON rendertype arcs, positive extents go in the clockwise direction, matching the OpenMap convention in coordinate space.

OMArc

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

Parameters:
latPoint - latitude of center of arc in decimal degrees
lonPoint - longitude of center of arc in decimal degrees
radius - distance
units - com.bbn.openmap.proj.Length object specifying units.
nverts - number of vertices for the poly-arc (if < 3, value is generated internally)
s - starting angle of arc, decimal degrees.
e - angular extent of arc, decimal degrees. For LATLON rendertype arcs, positive extents go in the clockwise direction, matching the OpenMap convention in coordinate space.

OMArc

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

Parameters:
center - LatLon center of arc
radius - distance
units - com.bbn.openmap.proj.Length object specifying units for distance.
nverts - number of vertices for the poly-arc(if < 3, value is generated internally)
s - starting angle of arc, decimal degrees.
e - angular extent of arc, decimal degrees. For LATLON rendertype arcs, positive extents go in the clockwise direction, matching the OpenMap convention in coordinate space.
Method Detail

getX

public int getX()
Get the x position of the center. This is always meaningful only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET, and meaningful after generation if the RENDERTYPE_LATLON.

Returns:
x position of center.

getY

public int getY()
Get the y position of the center. This is always meaningful only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET, and meaningful after generation if the RENDERTYPE_LATLON.

Returns:
y position of center.

getOffX

public int getOffX()
Get the x offset from the center. This is meaningful only if the render type is RENDERTYPE_OFFSET.

Returns:
x offset from center.

getOffY

public int getOffY()
Get the y position of the center. This is meaningful only if the render type is RENDERTYPE_OFFSET.

Returns:
y offset from center.

getLatLon

public LatLonPoint getLatLon()
Get the center LatLonPoint. This is meaningful only if the rendertype is RENDERTYPE_LATLON or RENDERTYPE_OFFSET.

Returns:
LatLonPoint position of center.

getRadius

public float getRadius()
Get the radius. This is meaningful only if the render type is RENDERTYPE_LATLON.

Returns:
float radius in decimal degrees

getWidth

public int getWidth()
Get the horizontal pixel diameter of the arc. This is meaningful only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET.

Returns:
the horizontal pixel diameter of the arc.

getHeight

public int getHeight()
Get the vertical pixel diameter of the arc. This is meaningful only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET.

Returns:
the vertical pixel diameter of the arc.

getStartAngle

public float getStartAngle()
Get the starting angle of the arc.

Returns:
the starting angle of the arc in decimal degrees.

getExtentAngle

public float getExtentAngle()
Get the extent angle of the arc.

Returns:
the angular extent of the arc in decimal degrees. For LATLON rendertype arcs, positive extents go in the clockwise direction, matching the OpenMap convention in coordinate space. For XY and OFFSET rendertype arcs, positive extents go in the clockwise direction, matching the java.awt.geom.Arc2D convention.

getNumVerts

public int getNumVerts()
Get the number of vertices of the lat/lon arc. This will be meaningful only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET and for LINETYPE_GREATARC or LINETYPE_RHUMB line types.

Returns:
int number of segment points

setX

public void setX(int value)
Set the x position of the center. This will be meaningful only if the render type is RENDERTYPE_XY.

Parameters:
value - the x position of center.

setY

public void setY(int value)
Set the y position of the center. This will be meaningful only if the render type is RENDERTYPE_XY.

Parameters:
value - the y position of center.

setOffX

public void setOffX(int value)
Set the x offset from the center. This will be meaningful only if the render type is RENDERTYPE_OFFSET.

Parameters:
value - the x position of center.

setOffY

public void setOffY(int value)
Set the y offset from the center. This will be meaningful only if the render type is RENDERTYPE_OFFSET.

Parameters:
value - the y position of center.

setLatLon

public void setLatLon(float lat,
                      float lon)
Set the latitude and longitude of the center point. This is meaningful only if the rendertype is RENDERTYPE_LATLON or RENDERTYPE_OFFSET.

Parameters:
lat - latitude in decimal degrees
lon - longitude in decimal degrees

setCenter

public void setCenter(LatLonPoint p)
Set the latitude and longitude of the center point. This is meaningful only if the rendertype is RENDERTYPE_LATLON or RENDERTYPE_OFFSET.

Parameters:
p - LatLonPoint of center.

getCenter

public LatLonPoint getCenter()
Get the center LatLonPoint.


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.

setWidth

public void setWidth(int value)
Set the horizontal pixel diameter of the arc. This is meaningful only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET.

Parameters:
value - the horizontial pixel diamter of the arc.

setHeight

public void setHeight(int value)
Set the vertical pixel diameter of the arc. This is meaningful only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET.

Parameters:
value - the vertical pixel diameter of the arc.

setStart

public void setStart(float value)
Set the starting angle the arc.

Parameters:
value - the starting angle of the arc in decimal degrees.

setExtent

public void setExtent(float value)
Set the angular extent of the arc.

Parameters:
value - the angular extent of the arc in decimal degrees. For LATLON rendertype arcs, positive extents go in the clockwise direction, matching the OpenMap convention in coordinate space. For XY and OFFSET rendertype arcs, positive extents go in the clockwise direction, matching the java.awt.geom.Arc2D convention.

setNumVerts

public void setNumVerts(int nverts)
Set the number of vertices of the lat/lon arc. This is meaningful only if the render type is RENDERTYPE_LATLON and for LINETYPE_GREATARC or LINETYPE_RHUMB line types. If < 1, this value is generated internally.

Parameters:
nverts - number of segment points

setArcType

public void setArcType(int type)
Set the ArcType, either Arc2D.OPEN (default), Arc2D.PIE or Arc2D.CHORD.

See Also:
Arc2D

getArcType

public int getArcType()
Get the ArcType.

See Also:
Arc2D

setRotationAngle

public void setRotationAngle(double angle)
Set the angle by which the arc is to rotated.

Parameters:
angle - the number of radians the arc is to be rotated. Measured clockwise from horizontal. Positive numbers move the positive x axis toward the positive y axis.

getRotationAngle

public double getRotationAngle()
Get the current rotation of the arc.

Returns:
the arc rotation.

setNeedToRegenerate

public void setNeedToRegenerate(boolean value)
Description copied from interface: OMGeometry
Sets the regenerate flag for the graphic. This flag is used to determine if extra work needs to be done to prepare the object for rendering.

Specified by:
setNeedToRegenerate in interface OMGeometry
Overrides:
setNeedToRegenerate in class BasicGeometry
Parameters:
value - boolean

getPolarCorrection

public boolean getPolarCorrection()
Get the polar-fill-correction-flag.

Returns:
boolean
See Also:
setPolarCorrection(boolean)

setPolarCorrection

public void setPolarCorrection(boolean value)
Set the polar-fill-correction-flag. We don't correctly render *filled* arcs/polygons which encompass a pole in Cylindrical projections. This method will toggle support for correcting this problem. You should only set this on arcs that encompass a pole and are drawn with a fill color. You do not need to set this if you're only drawing the arc outline.

Parameters:
value - boolean
See Also:
OMGraphic.setLineColor(java.awt.Color), OMGraphic.setFillColor(java.awt.Color)

shouldCenterBeInShape

protected boolean shouldCenterBeInShape()
Helper function that helps the generate method figure out if the center point should be in the generate shape - if it's not, the code knows that there is a problem with the poles, and the polar correction code needs to be run.


generate

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

Specified by:
generate in interface OMGeometry
Specified by:
generate in class OMGraphic
Parameters:
proj - Projection
Returns:
true if generate was successful
See Also:
OMGraphic.regenerate(com.bbn.openmap.proj.Projection)

createArcShape

protected java.awt.Shape createArcShape(float x,
                                        float y,
                                        float fwidth,
                                        float fheight)
An internal method designed to fetch the Shape to be used for an XY or OFFSET OMArc. This method is smart enough to take the calculated position information and make a call to Arc2D.Float with start, extent and arcType information.


getCoordLists

protected java.util.ArrayList getCoordLists(Projection proj,
                                            LatLonPoint center,
                                            float radius,
                                            int nverts)
An internal method designed to fetch the ArrayList for LATLON OMArcs. This method is smart enough to take the calculated position information and make a call to Projection.forwardArc() with start, extent and arcType information.


getPolarShapeLine

public java.awt.geom.GeneralPath getPolarShapeLine()
Return the java.awt.Shape (GeneralPath) that reflects a arc that encompases a pole. Used when the projection is Cylindrical.

Returns:
a GeneralPath object, or null if it's not needed (which is probably most of the time, if the arc doesn't include a pole or the projection isn't Cylindrical).

render

public void render(java.awt.Graphics g)
Paint the arc.

Overrides:
render in class OMGraphic
Parameters:
g - Graphics context to render into


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