RibbonMaker (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.util
Class RibbonMaker

    java.lang.Object
      com.bbn.openmap.omGraphics.util.RibbonMaker

    public class RibbonMaker

extends java.lang.Object

The RibbonMaker class takes polygon coordinates and creates another polygon from it, a buffer region based on ground distance, around the original poly. It assumes that the polygon coordinates are going in a clockwise direction. The returned polygon is actually an OMAreaList made up of OMPolys, OMArcs and OMLines, depending on the shape of the original polygon.

The RibbonMaker is created from one of the factory methods that designates whether the coordinates are radians or decimal degrees. FYI - OMPoly coordinates retrieved from the getLatLonArray method are in radians. After the RibbonMaker is created, call the method that creates the appropriate shape. For now, getOuterRing is your only option. To use:

     llPoints = new double[] { 40.0f, -92.0f, 42.0f, -87.0f, 38.57, -90.825, 37.0f, -89.0f, 35.0f, -94.0f, 40.0f,
                    -92.0f };

     OMGraphic omg = RibbonMaker.createFromDecimalDegrees(llPoints).getOuterRing(Length.MILE.toRadians(100));

Author:
  ddietrick

Field Summary
`protected static int` | `BENDS_LEFT`
`protected static int` | `BENDS_RIGHT`
`protected double` | `bufferLimit`
`protected GeoArray` | `geoCoords`
`protected GeoArray` | `geoCoords_reversed`
`protected static int` | `STRAIGHT`

Constructor Summary
`protected` | `RibbonMaker(GeoArray gCoords)`

Method Summary
`protected void` | `addPolyForIntersection(OMPoly poly1, OMPoly poly2, double dist, OMAreaList ret)` Called to handle BENDS_LEFT, concave corners.
`protected void` | `addShortLegPolyForIntersection(Geo g1, Geo g2, Geo g3, int ribbonSide, double dist, OMAreaList ret)` Called when it's known that one of the legs between the corner is smaller than the buffer depth.
`protected int` | `bends(Geo g1, Geo g2, Geo g3)` Method that determines which way the angle between the three points bends.
`static RibbonMaker` | `createFromDecimalDegrees(double[] coords)` Create a RibbonMaker from decimal degree coordinates.
`static RibbonMaker` | `createFromRadians(double[] coords)` Create a RibbonMaker from radian coordinates.
`OMGraphic` | `getArc(Geo gc, OMPoly poly1, OMPoly poly2)` Given two polylines, with the end point of poly1 being the same distance from a point as the starting point of poly2, create an arc that connects them.
`protected OMPoly` | `getHalfPoly(RibbonIterator rIterator, int side, boolean first)` Given a RibbonIterator created from two Geos, create a poly from half of that buffer path.
`protected OMPoly` | `getOMPolyFromGeos(java.util.List<Geo> geos)` Converts Vector of Geos to an OMPoly with linetype great_circle.
`OMAreaList` | `getOuterRing(double dist)` Assumes coords represent a polygon, returns an OMAreaList representing buffer zone around the outside of a polygon.
`protected OMPoly` | `getPoly(RibbonIterator rIterator, int side)` Given a RibbonIterator created from two Geos, create a poly from that buffer path.
`protected Geo` | `getPolyIntersection(OMPoly poly1, OMPoly poly2)` Just return the point where the two polygons cross.
`protected OMGraphic` | `getPushbackPoly(OMPoly omp, double dist)` Takes a poly that's going to be added to the buffer and removes any points that may be too close to the original poly.
`protected void` | `handlePointsForOuterRing(Geo g1, Geo g2, Geo g3, double dist, OMAreaList ret)` Takes a corner represented by the three geos, and adds OMGraphics to the OMAreaList depending on which way the corner bends - for right turns, it'll add an OMLine, OMArc and OMLine.
`protected boolean` | `tooClose(Geo pnt, double distance)` Checks to see if a point is too close to any side of the original polygon.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### geoCoords

    protected GeoArray geoCoords

### geoCoords_reversed

    protected GeoArray geoCoords_reversed

### STRAIGHT

    protected static final int STRAIGHT

See Also:
  Constant Field Values

### BENDS_LEFT

    protected static final int BENDS_LEFT

See Also:
  Constant Field Values

### BENDS_RIGHT

    protected static final int BENDS_RIGHT

See Also:
  Constant Field Values

### bufferLimit

    protected double bufferLimit

Constructor Detail

### RibbonMaker

    protected RibbonMaker(GeoArray gCoords)

Method Detail

### createFromDecimalDegrees

    public static RibbonMaker createFromDecimalDegrees(double[] coords)

  Create a RibbonMaker from decimal degree coordinates.

  Parameters:
    `coords` - lat,lon,lat,lon in decimal degrees.
  Returns:
    RibbonMaker

### createFromRadians

    public static RibbonMaker createFromRadians(double[] coords)

  Create a RibbonMaker from radian coordinates.

  Parameters:
    `coords` - lat,lon,lat,lon in radians.
  Returns:
    RibbonMaker

### getOuterRing

    public OMAreaList getOuterRing(double dist)

  Assumes coords represent a polygon, returns an OMAreaList representing buffer zone around the outside of a polygon.

  Parameters:
    `dist` - distance of buffer area, in radians. Use Length to convert.
  Returns:
    OMAreaList of a polygon that is a distance away from the coordinate polygon's edges.

### handlePointsForOuterRing

    protected void handlePointsForOuterRing(Geo g1,
                                            Geo g2,
                                            Geo g3,
                                            double dist,
                                            OMAreaList ret)

  Takes a corner represented by the three geos, and adds OMGraphics to the OMAreaList depending on which way the corner bends - for right turns, it'll add an OMLine, OMArc and OMLine. The OMLines will go from half the distance of the legs to the rounded corner. The left turn will have a polygon added.

  Parameters:
    `g1` - point 1
    `g2` - point 2
    `g3` - point 3
    `dist` - buffer distance in radians
    `ret` - OMAreaList to add OMGraphics to.

### bends

    protected int bends(Geo g1,
                        Geo g2,
                        Geo g3)

  Method that determines which way the angle between the three points bends.

  Parameters:
    `g1` -
    `g2` -
    `g3` -
  Returns:
    STRAIGHT if no bend, BENDS_LEFT if bends less than PI, BENDS_RIGHT if bends more than PI.

### tooClose

    protected boolean tooClose(Geo pnt,
                               double distance)

  Checks to see if a point is too close to any side of the original polygon.

  Parameters:
    `pnt` -
    `distance` -
  Returns:
    true if is too close and should not be added to the buffer polygon.

### getPushbackPoly

    protected OMGraphic getPushbackPoly(OMPoly omp,
                                        double dist)

  Takes a poly that's going to be added to the buffer and removes any points that may be too close to the original poly.

  Parameters:
    `omp` - the buffer poly to be added later
    `dist` - the distance all points should be from the original
  Returns:
    the OMGraphic with good points.

### addShortLegPolyForIntersection

    protected void addShortLegPolyForIntersection(Geo g1,
                                                  Geo g2,
                                                  Geo g3,
                                                  int ribbonSide,
                                                  double dist,
                                                  OMAreaList ret)

  Called when it's known that one of the legs between the corner is smaller than the buffer depth. Does some extra work to figure out what points should be added to the buffer.

  Parameters:
    `g1` - point 1
    `g2` - point 2, the corner
    `g3` - point 3
    `ribbonSide` - which side of the ribbon should be calculated.
    `dist` - the distance the buffer should be from the legs
    `ret` - the OMGraphicList to add the resulting poly to.

### getPolyIntersection

    protected Geo getPolyIntersection(OMPoly poly1,
                                      OMPoly poly2)

  Just return the point where the two polygons cross.

  Parameters:
    `poly1` -
    `poly2` -
  Returns:
    null if no point found.

### getOMPolyFromGeos

    protected OMPoly getOMPolyFromGeos(java.util.List<Geo> geos)

  Converts Vector of Geos to an OMPoly with linetype great_circle. Assumes that the List has valid coordinates on it. Does not do a closeness check to the original poly, expected that's been done.

  Parameters:
    `geos` - a set of coordinates
  Returns:
    OMPoly

### addPolyForIntersection

    protected void addPolyForIntersection(OMPoly poly1,
                                          OMPoly poly2,
                                          double dist,
                                          OMAreaList ret)

  Called to handle BENDS_LEFT, concave corners. RuntimeException is thrown when one of the legs is much shorter than the other and the mid-point is still in the buffer of one of the legs. In that special case, the intersection point is not found.

  Parameters:
    `poly1` -
    `poly2` -
    `ret` -

### getHalfPoly

    protected OMPoly getHalfPoly(RibbonIterator rIterator,
                                 int side,
                                 boolean first)

  Given a RibbonIterator created from two Geos, create a poly from half of that buffer path. Points are not checked for closeness to original poly.

  Parameters:
    `rIterator` - RibbonIterator for one of the legs of corner
    `side` - which RibbonIterator side
    `first` - which half you want, true for first part
  Returns:
    OMPoly that represents half of the buffered path.

### getPoly

    protected OMPoly getPoly(RibbonIterator rIterator,
                             int side)

  Given a RibbonIterator created from two Geos, create a poly from that buffer path.

  Parameters:
    `rIterator` - RibbonIterator for one of the legs of corner
    `side` - which RibbonIterator side
  Returns:
    OMPoly that represents buffered path between geos.

### getArc

    public OMGraphic getArc(Geo gc,
                            OMPoly poly1,
                            OMPoly poly2)

  Given two polylines, with the end point of poly1 being the same distance from a point as the starting point of poly2, create an arc that connects them.

  Parameters:
    `gc` - point
    `poly1` - polyline where the last end point is used
    `poly2` - polyline where the first end point is used.
  Returns:
    OMArc

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