OMPoly (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.omGraphics
Class OMPoly

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

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

Direct Known Subclasses:
  EsriPolygon, EsriPolyline, LabeledOMPoly, OMDistance, OMSpline

    public class OMPoly

extends OMAbstractLine
implements java.io.Serializable

Graphic object that represents a polygon or polyline (multi-line-segment-object).

The differentiators 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.

### NOTES:

- See the RESTRICTIONS on Lat/Lon polygons/polylines. Not following the guidelines listed may result in ambiguous/undefined shapes! Similar assumptions apply to the other vector graphics that we define: circles, ellipses, rects, lines.
- LatLon OMPolys store latlon coordinates internally in radian format for efficiency in projecting. Subclasses should follow this model.
- Holes in the poly are not supported.

### TODO:

- Polar filled-polygon correction for Cylindrical projections (like OMCircle).

See Also:
  `OMCircle`, `OMRect`, `OMLine`, Serialized Form

Field 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 double` | `lat` For RENDERTYPE_OFFSET, the latitude of the starting point of the poly.
`protected double` | `lon` For RENDERTYPE_OFFSET, the longitude of the starting point of the poly.
`protected double[]` | `rawllpts` raw float lats and lons stored internally in radians.
`protected int` | `units` Radians or decimal degrees.
`protected int[]` | `xs` The x array of ints, representing pixels, used for x/y or offset polys.
`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.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
`OMPoly()` Construct a default OMPoly.
`OMPoly(double[] llPoints, int units, int lType)` Create an OMPoly from a list of float lat/lon pairs.
`OMPoly(double[] llPoints, int units, int lType, int nsegs)` Create an OMPoly from a list of float lat/lon pairs.
`OMPoly(double latPoint, double lonPoint, int[] xypoints, int cMode)` Create an x/y OMPoly at an offset from lat/lon.
`OMPoly(double latPoint, double 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(float[][] xpoints2, float[][] ypoints2)` Return true if the xpoints and ypoints are not null and contain coordinates.
`protected java.awt.geom.GeneralPath` | `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(double x, double 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()`
`int` | `getIndexOfFirstNodeOfSegIntersect(double x, double y, double maxDist)` Get the index of the leading node of an edge that is intersecting the given location.
`double` | `getLat()` Get the latitude of the offset point, in decimal degrees.
`double[]` | `getLatLonArray()` Return the rawllpts array.
`double[]` | `getLatLonArrayCopy()` Use this if you want to play around with the values without messing with the OMPoly.
`double` | `getLon()` Get the longitude of the offset point, in decimal degrees.
`int` | `getNumSegs()` Get the number of subsegments for each segment in the poly.
`double[]` | `getRawllpts()` For XMLEncoder
`java.awt.geom.GeneralPath` | `getShape()` Get the array of java.awt.Shape objects that represent the projected graphic.
`int` | `getUnits()` For XMLEncoder
`int[]` | `getXs()` Get the array of x points.
`int[]` | `getYs()` Get the array of y points.
`void` | `insertRadians(double[] latlons, int coordPairIndex, boolean replaceEndsOfInsertedAtJoin)` Convenience function for adding some coordinates to the polygon, for lat/lon polygons.
`protected boolean` | `isGeometryClosed()` Is the geometry closed ?
`boolean` | `isPolygon()` Check if this is a polygon or a polyline.
`static void` | `main(java.lang.String[] argv)`
`void` | `render(java.awt.Graphics g)` Paint the poly.
`void` | `restore(OMGeometry source)` Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.
`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(double lat)` Set the latitude of the offset point, in decimal degrees.
`void` | `setLocation(double[] llPoints, int units)` Set an OMPoly from a list of float lat/lon pairs.
`void` | `setLocation(double latPoint, double lonPoint, int units, int[] xypoints)` Set the location based on a latitude, longitude, and some xy points.
`void` | `setLocation(double latPoint, double 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(double 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.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

### COORDMODE_ORIGIN

    public static final int COORDMODE_ORIGIN

  Translation offsets. For RENDERTYPE_OFFSET, the xy points are relative to the position of fixed latlon point.

  See Also:
    Constant Field Values

### COORDMODE_PREVIOUS

    public static final int COORDMODE_PREVIOUS

  Delta offsets. For RENDERTYPE_OFFSET, each xy point in the array is relative to the previous point, and the first point is relative to the fixed latlon point.

  See Also:
    Constant Field Values

### units

    protected int units

  Radians or decimal degrees. After construction and conversion, this should always be radians.

### lat

    protected double lat

  For RENDERTYPE_OFFSET, the latitude of the starting point of the poly. Stored as radians!

### lon

    protected double lon

  For RENDERTYPE_OFFSET, the longitude of the starting point of the poly. Stored as radians!

### coordMode

    protected int coordMode

  For RENDERTYPE_OFFSET, type of offset.

  See Also:
    `COORDMODE_ORIGIN`, `COORDMODE_PREVIOUS`

### xs

    protected int[] xs

  The x array of ints, representing pixels, used for x/y or offset polys.

### ys

    protected int[] ys

  The y array of ints, representing pixels, used for x/y or offset polys.

### isPolygon

    protected boolean isPolygon

  Poly is a polygon or a polyline. This is true if the fillColor is not clear, false if it is.

### rawllpts

    protected double[] rawllpts

  raw float lats and lons stored internally in radians.

### doShapes

    protected boolean doShapes

  Flag for telling the OMPoly to use the Shape objects to represent itself internally. See intro for more info.

### geometryClosed

    protected boolean geometryClosed

Constructor Detail

### OMPoly

    public OMPoly()

  Construct a default OMPoly.

### OMPoly

    public OMPoly(double[] llPoints,
                  int units,
                  int lType)

  Create 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! 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.

### OMPoly

    public OMPoly(double[] llPoints,
                  int units,
                  int lType,
                  int nsegs)

  Create 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! 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)

### OMPoly

    public OMPoly(int[] xypoints)

  Create an OMPoly from a list of xy pairs. If you want the poly to be connected, you need to ensure that the first and last coordinate pairs are the same.

  Parameters:
    `xypoints` - array of x/y points, arranged x, y, x, y, etc.

### OMPoly

    public OMPoly(int[] xPoints,
                  int[] yPoints)

  Create an x/y OMPoly. If you want the poly to be connected, you need to ensure that the first and last coordinate pairs are the same.

  Parameters:
    `xPoints` - float[] of x coordinates
    `yPoints` - float[] of y coordinates

### OMPoly

    public OMPoly(double latPoint,
                  double lonPoint,
                  int[] xypoints,
                  int cMode)

  Create an x/y OMPoly at an offset from lat/lon. If you want the poly to be connected, you need to ensure that the first and last coordinate pairs are the same.

  Parameters:
    `latPoint` - latitude in decimal degrees
    `lonPoint` - longitude in decimal degrees
    `xypoints` - float[] of x,y pairs
    `cMode` - offset coordinate mode

### OMPoly

    public OMPoly(double latPoint,
                  double lonPoint,
                  int[] xPoints,
                  int[] yPoints,
                  int cMode)

  Create an x/y OMPoly at an offset from lat/lon. If you want the poly to be connected, you need to ensure that the first and last coordinate pairs are the same.

  Parameters:
    `latPoint` - latitude in decimal degrees
    `lonPoint` - longitude in decimal degrees
    `xPoints` - float[] of x coordinates
    `yPoints` - float[] of y coordinates
    `cMode` - offset coordinate mode

Method Detail

### setLocation

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

  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.

  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

### setLocation

    public void setLocation(int[] xypoints)

  Set an OMPoly from a list of xy pixel pairs. If you want the poly to be connected, you need to ensure that the first and last coordinate pairs are the same. This is for RENDERTYPE_XY polys.

  Parameters:
    `xypoints` - array of x/y points, arranged x, y, x, y, etc.

### setLocation

    public void setLocation(int[] xPoints,
                            int[] yPoints)

  Set an OMPoly from a x/y coordinates. If you want the poly to be connected, you need to ensure that the first and last coordinate pairs are the same. This is for RENDERTYPE_XY polys.

  Parameters:
    `xPoints` - float[] of x coordinates
    `yPoints` - float[] of y coordinates

### setLocation

    public void setLocation(double latPoint,
                            double lonPoint,
                            int units,
                            int[] xypoints)

  Set the location based on a latitude, longitude, and some xy points. The coordinate mode and the polygon setting are the same as in the constructor used. This is for RENDERTYPE_OFFSET polys.

  Parameters:
    `latPoint` - latitude in decimal degrees
    `lonPoint` - longitude in decimal degrees
    `units` - radians or decimal degrees. Use OMGraphic.RADIANS or OMGraphic.DECIMAL_DEGREES
    `xypoints` - array of x/y points, arranged x, y, x, y, etc.

### setLocation

    public void setLocation(double latPoint,
                            double lonPoint,
                            int units,
                            int[] xPoints,
                            int[] yPoints)

  Set the location based on a latitude, longitude, and some xy points. The coordinate mode and the polygon setting are the same as in the constructor used. This is for RENDERTYPE_OFFSET polys.

  Parameters:
    `latPoint` - latitude in decimal degrees
    `lonPoint` - longitude in decimal degrees
    `units` - radians or decimal degrees. Use OMGraphic.RADIANS or OMGraphic.DECIMAL_DEGREES
    `xPoints` - float[] of x coordinates
    `yPoints` - float[] of y coordinates

### getLatLonArray

    public double[] getLatLonArray()

  Return the rawllpts array. NOTE: this is an unsafe method to access the rawllpts array. Use with caution. These are RADIANS! For RENDERTYPE_LATLON polys.

  Returns:
    double[] rawllpts of lat, lon, lat, lon

### getLatLonArrayCopy

    public double[] getLatLonArrayCopy()

  Use this if you want to play around with the values without messing with the OMPoly. This is safe to mess with, allocates new double[], in radians. If you want decimal degrees, use ProjMath.arrayRadToDeg with the returned array. For RENDERTYPE_LATLON polys

  Returns:
    copy of lat/lons, in lat/lon/lat/lon order. RADIANS!

### setLat

    public void setLat(double lat)

  Set the latitude of the offset point, in decimal degrees. For RENDERTYPE_OFFSET Polygons.

### getLat

    public double getLat()

  Get the latitude of the offset point, in decimal degrees. For RENDERTYPE_OFFSET Polygons.

### setLon

    public void setLon(double lon)

  Set the longitude of the offset point, in decimal degrees. For RENDERTYPE_OFFSET Polygons.

### getLon

    public double getLon()

  Get the longitude of the offset point, in decimal degrees. For RENDERTYPE_OFFSET Polygons.

### setXs

    public void setXs(int[] x)

  Set the array of x points. For RENDERTYPE_OFFSET, RENDERTYPE_XY polys.

### getXs

    public int[] getXs()

  Get the array of x points. For RENDERTYPE_OFFSET, RENDERTYPE_XY polys.

### setYs

    public void setYs(int[] y)

  Set the array of y points. For RENDERTYPE_OFFSET, RENDERTYPE_XY polys.

### getYs

    public int[] getYs()

  Get the array of y points. For RENDERTYPE_OFFSET, RENDERTYPE_XY polys.

### setFillPaint

    public void setFillPaint(java.awt.Paint paint)

  Set the fill Paint of the poly. If the color value is non-clear, then the poly is a polygon (connected and filled), otherwise it's a polyline (non-filled).

  Specified by:
    `setFillPaint` in interface `OMGraphic`
  Overrides:
    `setFillPaint` in class `OMGraphicAdapter`
  Parameters:
    `paint` - value Color

### isPolygon

    public boolean isPolygon()

  Check if this is a polygon or a polyline. A polygon is a multi-segment line that has a non-clear fill color. A polyline is a multi-segment line that has no fill color.

  Returns:
    true if polygon false if polyline

### setIsPolygon

    public void setIsPolygon(boolean set)

  Set the Polyline/Polygon setting, if you know better. If the fillPaint is set after this method is called, then the fillPaint isPolygon rules apply. If the fillPaint is opaque, then it is assumed to be a Polygon and isPolygon will be set to true. If this is set to be false, the fillPaint will be set to clear.

### setNumSegs

    public void setNumSegs(int nsegs)

  Set the number of subsegments for each segment in the poly. (This is only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB line types, and if < 1, this value is generated internally).

  Parameters:
    `nsegs` - number of segment points

### getNumSegs

    public int getNumSegs()

  Get the number of subsegments for each segment in the poly. (This is only for LINETYPE_GREATCIRCLE or LINETYPE_RHUMB line types).

  Returns:
    int number of segment points

### setCoordMode

    public void setCoordMode(int coordMode)

  For RENDERTYPE_OFFSET, type of offset.

  See Also:
    `COORDMODE_ORIGIN`, `COORDMODE_PREVIOUS`

### getCoordMode

    public int getCoordMode()

  For RENDERTYPE_OFFSET, type of offset.

  See Also:
    `COORDMODE_ORIGIN`, `COORDMODE_PREVIOUS`

### setDoShapes

    public void setDoShapes(boolean set)

### getDoShapes

    public boolean getDoShapes()

### generate

    public boolean generate(Projection proj)

  Prepare the poly for rendering.

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

### checkPoints

    protected boolean checkPoints(float[][] xpoints2,
                                  float[][] ypoints2)

  Return true if the xpoints and ypoints are not null and contain coordinates.

  Parameters:
    `xpoints2` -
    `ypoints2` -

### shouldRenderFill

    public boolean shouldRenderFill()

  Return true of the fill color/paint should be rendered (not clear).

  Specified by:
    `shouldRenderFill` in interface `OMGraphic`
  Overrides:
    `shouldRenderFill` in class `OMGraphicAdapter`

### 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 `OMGraphicAdapter`
  Parameters:
    `g` - java.awt.Graphics to paint the poly onto.

### distance

    public float distance(double x,
                          double y)

  Return the shortest distance from the graphic to an XY-point. This works if generate() has been successful.

  Specified by:
    `distance` in interface `OMGeometry`
  Overrides:
    `distance` in class `OMGraphicAdapter`
  Parameters:
    `x` - horizontal pixel location.
    `y` - vertical pixel location.
  Returns:
    the distance of the object to the location given.

### getShape

    public java.awt.geom.GeneralPath getShape()

  Get the array of java.awt.Shape objects that represent the projected graphic. The array will contain more than one Shape object of the object wraps around the earth and needs to show up in more than one place on the map.

  The java.awt.Shape object gives you the ability to do a little spatial analysis on the graphics.

  Specified by:
    `getShape` in interface `OMGeometry`
  Overrides:
    `getShape` in class `BasicGeometry`
  Returns:
    java.awt.geom.GeneralPath (Shape), or null if the graphic needs to be generated with the current map projection, or null if the OMGeometry hasn't been updated to use Shape objects for its internal representation.

### createShape

    protected java.awt.geom.GeneralPath createShape()

  Since OMPoly has the option to not create a Shape, this method is here to create it if it is asked for. The OMPoly needs to be generated.

### isGeometryClosed

    protected boolean isGeometryClosed()

  Is the geometry closed ?

  Returns:
    boolean

### getRawllpts

    public double[] getRawllpts()

  For XMLEncoder

### getUnits

    public int getUnits()

  For XMLEncoder

### insertRadians

    public void insertRadians(double[] latlons,
                              int coordPairIndex,
                              boolean replaceEndsOfInsertedAtJoin)

  Convenience function for adding some coordinates to the polygon, for lat/lon polygons. Might be tricky for closed polygons, you might want to consider the index and not make them the starting or end point to preserve closed property.

  Parameters:
    `latlons` - the set of coordinates to add, in radians. Use ProjMath.arrayDegToRad() if you need to convert decimal degrees.
    `coordPairIndex` - index of the coordinate pair to insert coordinates. 0 is the start of the polygon, 1 means the latlons will be inserted after the first original coordinate pair, etc.
    `replaceEndsOfInsertedAtJoin` - flad to indicate whether the coordinates at the end of the inserted latlons array should be removed before insertion. If the coordinate list is being added to the start or end of the polygon, only the coordinate pair connecting to the original poly will be removed.

### getIndexOfFirstNodeOfSegIntersect

    public int getIndexOfFirstNodeOfSegIntersect(double x,
                                                 double y,
                                                 double maxDist)

  Get the index of the leading node of an edge that is intersecting the given location. Coordinates should be in pixels from upper left corner of map for RENDERTYPE_XY/RENDERTYPE_OFFSET, and in decimal degrees for RENDERTYPE_LATLON.

  Parameters:
    `x` - horizontal coordinate
    `y` - vertical coordinate
    `maxDist` - maximum pixel distance from segment to be considered an intersect.
  Returns:
    index of first node of intersecting segment, or -1 if not intersecting.

### main

    public static void main(java.lang.String[] argv)

### 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 `OMGraphicAdapter`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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