|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bbn.openmap.omGraphics.geom.BasicGeometry | +--com.bbn.openmap.omGraphics.OMGraphic | +--com.bbn.openmap.omGraphics.OMPoly
Graphic object that represents a polygon or polyline (multi-line-segment-object).
The differentiator between polygons and polylines is the fill color. If the fillPaint is equal to OMColor.clear, then the poly will be considered a polyline. There are methods to override this in the OMPoly class, but they do play around with the fillPaint, depending on the order in which the methods are called. If you know it's a polyline, call setIsPolygon(false) if you think that the fillPaint could be set to anything other than the default, OMColor.clear.
All of the OMGraphics are moving to having their internal representation as java.awt.Shape objects. Unfortunately, this has the side effect of slowing OMPolys down, because the way that the projection classes handle transformations cause more objects to be allocated and more loops to be run through. So, by default, the OMPoly does NOT use Shape objects internally, to keep layers that throw down many, many polys running quickly. If you want to do some spatial analysis on an OMPoly, call setDoShapes(true) on it, then generate(Projection), and then call getShapes() to get the java.awt.Shape objects for the poly. You can then run the different Shape spatial analysis methods on the Shape objects.
OMCircle
,
OMRect
,
OMLine
,
Serialized FormField Summary | |
protected int |
coordMode
For RENDERTYPE_OFFSET, type of offset. |
static int |
COORDMODE_ORIGIN
Translation offsets. |
static int |
COORDMODE_PREVIOUS
Delta offsets. |
protected boolean |
doShapes
Flag for telling the OMPoly to use the Shape objects to represent itself internally. |
protected boolean |
geometryClosed
|
protected boolean |
isPolygon
Poly is a polygon or a polyline. |
protected float |
lat
For RENDERTYPE_OFFSET, the latitude of the starting point of the poly. |
protected float |
lon
For RENDERTYPE_OFFSET, the longitude of the starting point of the poly. |
protected int |
nsegs
Number of segments to draw (used only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB lines). |
protected float[] |
rawllpts
raw float lats and lons stored internally in radians. |
protected int |
units
Radians or decimal degrees. |
protected int[][] |
xpoints
Internal array of projected x coordinate arrays. |
protected int[] |
xs
The x array of ints, representing pixels, used for x/y or offset polys. |
protected int[][] |
ypoints
Internal array of projected y coordinate arrays. |
protected int[] |
ys
The y array of ints, representing pixels, used for x/y or offset polys. |
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 |
Constructor Summary | |
OMPoly()
Construct a default OMPoly. |
|
OMPoly(float[] llPoints,
int units,
int lType)
Create an OMPoly from a list of float lat/lon pairs. |
|
OMPoly(float[] llPoints,
int units,
int lType,
int nsegs)
Create an OMPoly from a list of float lat/lon pairs. |
|
OMPoly(float latPoint,
float lonPoint,
int[] xypoints,
int cMode)
Create an x/y OMPoly at an offset from lat/lon. |
|
OMPoly(float latPoint,
float lonPoint,
int[] xPoints,
int[] yPoints,
int cMode)
Create an x/y OMPoly at an offset from lat/lon. |
|
OMPoly(int[] xypoints)
Create an OMPoly from a list of xy pairs. |
|
OMPoly(int[] xPoints,
int[] yPoints)
Create an x/y OMPoly. |
Method Summary | |
protected boolean |
checkPoints(int[][] xpoints2,
int[][] ypoints2)
Return true if the xpoints and ypoints are not null and contain coordinates. |
protected void |
createShape()
Since OMPoly has the option to not create a Shape, this method is here to create it if it is asked for. |
float |
distance(int x,
int y)
Return the shortest distance from the graphic to an XY-point. |
boolean |
generate(Projection proj)
Prepare the poly for rendering. |
int |
getCoordMode()
For RENDERTYPE_OFFSET, type of offset. |
boolean |
getDoShapes()
|
float |
getLat()
Get the latitude of the offset point, in decimal degrees. |
float[] |
getLatLonArray()
Return the rawllpts array. |
float |
getLon()
Get the longitude of the offset point, in decimal degrees. |
int |
getNumSegs()
Get the number of subsegments for each segment in the poly. |
java.awt.geom.GeneralPath |
getShape()
Get the array of java.awt.Shape objects that represent the projected graphic. |
int[] |
getXs()
Get the array of x points. |
int[] |
getYs()
Get the array of y points. |
protected boolean |
isGeometryClosed()
Is the geometry closed ? |
boolean |
isPolygon()
Check if this is a polygon or a polyline. |
void |
render(java.awt.Graphics g)
Paint the poly. |
void |
setCoordMode(int coordMode)
For RENDERTYPE_OFFSET, type of offset. |
void |
setDoShapes(boolean set)
|
void |
setFillPaint(java.awt.Paint paint)
Set the fill Paint of the poly. |
void |
setIsPolygon(boolean set)
Set the Polyline/Polygon setting, if you know better. |
void |
setLat(float lat)
Set the latitude of the offset point, in decimal degrees. |
void |
setLocation(float[] llPoints,
int units)
Set an OMPoly from a list of float lat/lon pairs. |
void |
setLocation(float latPoint,
float lonPoint,
int units,
int[] xypoints)
Set the location based on a latitude, longitude, and some xy points. |
void |
setLocation(float latPoint,
float lonPoint,
int units,
int[] xPoints,
int[] yPoints)
Set the location based on a latitude, longitude, and some xy points. |
void |
setLocation(int[] xypoints)
Set an OMPoly from a list of xy pixel pairs. |
void |
setLocation(int[] xPoints,
int[] yPoints)
Set an OMPoly from a x/y coordinates. |
void |
setLon(float lon)
Set the longitude of the offset point, in decimal degrees. |
void |
setNumSegs(int nsegs)
Set the number of subsegments for each segment in the poly. |
void |
setXs(int[] x)
Set the array of x points. |
void |
setYs(int[] y)
Set the array of y points. |
boolean |
shouldRenderFill()
Return true of the fill color/paint should be rendered (not clear). |
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 |
public static final int COORDMODE_ORIGIN
public static final int COORDMODE_PREVIOUS
protected int units
protected int[][] xpoints
protected int[][] ypoints
protected float lat
protected float lon
protected int coordMode
COORDMODE_ORIGIN
,
COORDMODE_PREVIOUS
protected int[] xs
protected int[] ys
protected boolean isPolygon
protected float[] rawllpts
protected int nsegs
protected boolean doShapes
protected boolean geometryClosed
Constructor Detail |
public OMPoly()
public OMPoly(float[] llPoints, int units, int lType)
NOTES:
llPoints
- array of lat/lon points, arranged lat, lon,
lat, lon, etc.units
- radians or decimal degrees. Use OMGraphic.RADIANS
or OMGraphic.DECIMAL_DEGREESlType
- line type, from a list defined in OMGraphic.public OMPoly(float[] llPoints, int units, int lType, int nsegs)
NOTES:
llPoints
- array of lat/lon points, arranged lat, lon,
lat, lon, etc.units
- radians or decimal degrees. Use OMGraphic.RADIANS
or OMGraphic.DECIMAL_DEGREESlType
- 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)public OMPoly(int[] xypoints)
xypoints
- array of x/y points, arranged x, y, x, y, etc.public OMPoly(int[] xPoints, int[] yPoints)
xPoints
- int[] of x coordinatesyPoints
- int[] of y coordinatespublic OMPoly(float latPoint, float lonPoint, int[] xypoints, int cMode)
latPoint
- latitude in decimal degreeslonPoint
- longitude in decimal degreesxypoints
- int[] of x,y pairscMode
- offset coordinate modepublic OMPoly(float latPoint, float lonPoint, int[] xPoints, int[] yPoints, int cMode)
latPoint
- latitude in decimal degreeslonPoint
- longitude in decimal degreesxPoints
- int[] of x coordinatesyPoints
- int[] of y coordinatescMode
- offset coordinate modeMethod Detail |
public void setLocation(float[] llPoints, int units)
NOTES:
llPoints
- array of lat/lon points, arranged lat, lon,
lat, lon, etc.units
- radians or decimal degrees. Use OMGraphic.RADIANS
or OMGraphic.DECIMAL_DEGREESpublic void setLocation(int[] xypoints)
xypoints
- array of x/y points, arranged x, y, x, y, etc.public void setLocation(int[] xPoints, int[] yPoints)
xPoints
- int[] of x coordinatesyPoints
- int[] of y coordinatespublic void setLocation(float latPoint, float lonPoint, int units, int[] xypoints)
latPoint
- latitude in decimal degreeslonPoint
- longitude in decimal degreesunits
- radians or decimal degrees. Use OMGraphic.RADIANS
or OMGraphic.DECIMAL_DEGREESxypoints
- array of x/y points, arranged x, y, x, y, etc.public void setLocation(float latPoint, float lonPoint, int units, int[] xPoints, int[] yPoints)
latPoint
- latitude in decimal degreeslonPoint
- longitude in decimal degreesunits
- radians or decimal degrees. Use OMGraphic.RADIANS
or OMGraphic.DECIMAL_DEGREESxPoints
- int[] of x coordinatesyPoints
- int[] of y coordinatespublic float[] getLatLonArray()
public void setLat(float lat)
public float getLat()
public void setLon(float lon)
public float getLon()
public void setXs(int[] x)
public int[] getXs()
public void setYs(int[] y)
public int[] getYs()
public void setFillPaint(java.awt.Paint paint)
setFillPaint
in class OMGraphic
paint
- value Colorpublic boolean isPolygon()
public void setIsPolygon(boolean set)
public void setNumSegs(int nsegs)
nsegs
- number of segment pointspublic int getNumSegs()
public void setCoordMode(int coordMode)
COORDMODE_ORIGIN
,
COORDMODE_PREVIOUS
public int getCoordMode()
COORDMODE_ORIGIN
,
COORDMODE_PREVIOUS
public void setDoShapes(boolean set)
public boolean getDoShapes()
public boolean generate(Projection proj)
generate
in interface OMGeometry
generate
in class OMGraphic
proj
- Projection
OMGraphic.regenerate(com.bbn.openmap.proj.Projection)
protected boolean checkPoints(int[][] xpoints2, int[][] ypoints2)
xpoints2
- ypoints2
-
public boolean shouldRenderFill()
shouldRenderFill
in class OMGraphic
public void render(java.awt.Graphics g)
render
in class OMGraphic
g
- java.awt.Graphics to paint the poly onto.public float distance(int x, int y)
distance
in interface OMGeometry
distance
in class OMGraphic
x
- horizontal pixel location.y
- vertical pixel location.
public java.awt.geom.GeneralPath getShape()
The java.awt.Shape object gives you the ability to do a little spatial analysis on the graphics.
getShape
in interface OMGeometry
getShape
in class BasicGeometry
protected void createShape()
protected boolean isGeometryClosed()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |