|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.omGraphics.util.RibbonMaker
public class RibbonMaker
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));
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 |
---|
protected GeoArray geoCoords
protected GeoArray geoCoords_reversed
protected static final int STRAIGHT
protected static final int BENDS_LEFT
protected static final int BENDS_RIGHT
protected double bufferLimit
Constructor Detail |
---|
protected RibbonMaker(GeoArray gCoords)
Method Detail |
---|
public static RibbonMaker createFromDecimalDegrees(double[] coords)
coords
- lat,lon,lat,lon in decimal degrees.
public static RibbonMaker createFromRadians(double[] coords)
coords
- lat,lon,lat,lon in radians.
public OMAreaList getOuterRing(double dist)
dist
- distance of buffer area, in radians. Use Length to convert.
protected void handlePointsForOuterRing(Geo g1, Geo g2, Geo g3, double dist, OMAreaList ret)
g1
- point 1g2
- point 2g3
- point 3dist
- buffer distance in radiansret
- OMAreaList to add OMGraphics to.protected int bends(Geo g1, Geo g2, Geo g3)
g1
- g2
- g3
-
protected boolean tooClose(Geo pnt, double distance)
pnt
- distance
-
protected OMGraphic getPushbackPoly(OMPoly omp, double dist)
omp
- the buffer poly to be added laterdist
- the distance all points should be from the original
protected void addShortLegPolyForIntersection(Geo g1, Geo g2, Geo g3, int ribbonSide, double dist, OMAreaList ret)
g1
- point 1g2
- point 2, the cornerg3
- point 3ribbonSide
- which side of the ribbon should be calculated.dist
- the distance the buffer should be from the legsret
- the OMGraphicList to add the resulting poly to.protected Geo getPolyIntersection(OMPoly poly1, OMPoly poly2)
poly1
- poly2
-
protected OMPoly getOMPolyFromGeos(java.util.List<Geo> geos)
geos
- a set of coordinates
protected void addPolyForIntersection(OMPoly poly1, OMPoly poly2, double dist, OMAreaList ret)
poly1
- poly2
- ret
- protected OMPoly getHalfPoly(RibbonIterator rIterator, int side, boolean first)
rIterator
- RibbonIterator for one of the legs of cornerside
- which RibbonIterator sidefirst
- which half you want, true for first part
protected OMPoly getPoly(RibbonIterator rIterator, int side)
rIterator
- RibbonIterator for one of the legs of cornerside
- which RibbonIterator side
public OMGraphic getArc(Geo gc, OMPoly poly1, OMPoly poly2)
gc
- pointpoly1
- polyline where the last end point is usedpoly2
- polyline where the first end point is used.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |