com.bbn.openmap.geo
Class GeoArray.Adapter

java.lang.Object
  extended by com.bbn.openmap.geo.GeoArray.Adapter
All Implemented Interfaces:
GeoArray
Direct Known Subclasses:
GeoArray.Double, GeoArray.Float
Enclosing interface:
GeoArray

public abstract static class GeoArray.Adapter
extends java.lang.Object
implements GeoArray

An abstract parent implementation class of GeoArray that handles common methods.

Author:
dietrick

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bbn.openmap.geo.GeoArray
GeoArray.Adapter, GeoArray.Double, GeoArray.Float, GeoArray.Mutable
 
Constructor Summary
GeoArray.Adapter()
           
 
Method Summary
 double area()
          Computes the area of a polygon on the surface of a unit sphere.
 double distance(Geo pnt, Geo closestPoint)
          Returns the perpendicular distance to the closest point on the edge of the polygon.
 double[] toLLDegrees()
          Convert the GeoArray to an array of decimal degree values, alternating lat, lon, lat, lon.
 double[] toLLRadians()
          Convert the GeoArray to an array of radian values, alternating lat, lon, lat, lon.
 Geo[] toPointArray()
          Convert the GeoArray to an array of Geos.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bbn.openmap.geo.GeoArray
closeArray, equals, get, get, getSize, removeDups
 

Constructor Detail

GeoArray.Adapter

public GeoArray.Adapter()
Method Detail

toPointArray

public Geo[] toPointArray()
Convert the GeoArray to an array of Geos.

Specified by:
toPointArray in interface GeoArray
Returns:
Geo[]

toLLDegrees

public double[] toLLDegrees()
Convert the GeoArray to an array of decimal degree values, alternating lat, lon, lat, lon.

Specified by:
toLLDegrees in interface GeoArray
Returns:
lat/lon double[] of decimal degrees

toLLRadians

public double[] toLLRadians()
Convert the GeoArray to an array of radian values, alternating lat, lon, lat, lon.

Specified by:
toLLRadians in interface GeoArray
Returns:
lat/lon double[] of radians

area

public double area()
Computes the area of a polygon on the surface of a unit sphere. For a non unit sphere, multiply this by the radius of sphere squared. The value might be negative based on the counter-clockwise order of the coordinates, but the absolute value is valid. This method will test for closed polygon coordinates and handle that situation.

Specified by:
area in interface GeoArray
Returns:
area value.

distance

public double distance(Geo pnt,
                       Geo closestPoint)
Returns the perpendicular distance to the closest point on the edge of the polygon.

Specified by:
distance in interface GeoArray
Parameters:
pnt - the point to test against the poly
closestPoint - if not null, will be set with the location of the point on the poly closest to pnt, you can read this object after this method call to get coordinates.
Returns:
the distance in radians, or Double.POSITIVE_INFINITY if something weird happens.


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