org.opengts.util
Class GeoBounds

java.lang.Object
  extended by org.opengts.util.GeoBounds
All Implemented Interfaces:
java.lang.Cloneable

public class GeoBounds
extends java.lang.Object
implements java.lang.Cloneable

Represents a set of rectangular latitude/longitude bounds


Constructor Summary
GeoBounds()
          Constructor
GeoBounds(java.util.Collection<GeoPointProvider> gppList)
          Constructor
GeoBounds(double radiusM, GeoPointProvider... gpp)
          Constructor
GeoBounds(GeoBounds gb)
          Copy constructor
GeoBounds(GeoPointProvider... gpp)
          Constructor
GeoBounds(GeoPolygon gp)
          Constructor
GeoBounds(java.lang.String gbs, char sep)
          Constructor
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this GeoBounds
 void extendByCircle(double radiusM, double lat, double lon)
          Extend the bounds by the specified point/radius circle
 void extendByCircle(double radiusM, GeoPointProvider... gpp)
          Extend the bounds by the specified point/radius circle
 void extendByCircle(double radiusM, GeoPointProvider gpp)
          Extend the bounds by the specified point/radius circle
 void extendByPoint(java.util.Collection<GeoPointProvider> gppList)
          Extend the bounds by the specified GeoPoint
 void extendByPoint(GeoPointProvider... gpp)
          Extend the bounds by the specified GeoPoint
 void extendByPoint(GeoPointProvider gpp)
          Extend the bounds by the specified GeoPoint
 boolean extendByRadius(double radiusM)
          Extend the bounds of the current valid GeoBounds by the specified radius meters
 double getBottom()
          Gets the minimum latitude
 GeoPoint getCenter()
          Returns the average center of the bounds
 double getDeltaLatitude()
          Gets the height of the bounds
 double getDeltaLatitudeMeters()
          Gets the width of the bounds (in delta meters)
 double getDeltaLongitude()
          Gets the width of the bounds
 double getDeltaLongitudeMeters()
          Gets the width of the bounds (in delta meters)
 double getDiagonalMeters()
          Gets the diagonal distance of the bounds (in meters)
 double getLeft()
          Gets the minimum longitude
 double getMaxLatitude()
          Gets the maximum latitude
 double getMaxLongitude()
          Gets the maximum longitude
 double getMaxX()
          Gets the maximum longitude
 double getMaxY()
          Gets the maximum latitude
 double getMetersPerPixel(int W, int H)
          Calculate/return the best meters-per-pixel
 double getMinLatitude()
          Gets the minimum latitude
 double getMinLongitude()
          Gets the minimum longitude
 double getMinX()
          Gets the minimum longitude
 double getMinY()
          Gets the minimum latitude
 PixelPoint getPixelLocation(GeoPoint gp, int W, int H)
          Return the pixel location of the specified GeoPoint within the specified dimensions
 double getRight()
          Gets the maximum longitude
 double getTop()
          Gets the maximum latitude
 boolean isValid()
          Returns true if this bounds is valid
static void main(java.lang.String[] argv)
          Main entry point for testing/debugging
 void reset()
          Reset bounds
 void setMaxLatitude(double maxLat)
          Sets the maximum latitude
 void setMaxLongitude(double maxLon)
          Sets the maximum longitude
 void setMinLatitude(double minLat)
          Sets the minimum latitude
 void setMinLongitude(double minLon)
          Sets the minimum longitude
 java.lang.String toString()
          Return a String representation of this GeoBounds
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeoBounds

public GeoBounds()
Constructor


GeoBounds

public GeoBounds(GeoPointProvider... gpp)
Constructor

Parameters:
gpp - An array points

GeoBounds

public GeoBounds(GeoPolygon gp)
Constructor

Parameters:
gp - A GeoPolygon

GeoBounds

public GeoBounds(java.util.Collection<GeoPointProvider> gppList)
Constructor

Parameters:
gppList - A list points

GeoBounds

public GeoBounds(double radiusM,
                 GeoPointProvider... gpp)
Constructor

Parameters:
radiusM - The circle radius
gpp - An array circle center points

GeoBounds

public GeoBounds(java.lang.String gbs,
                 char sep)
Constructor

Parameters:
gbs - The GeoBounds in String format (MinLat/MaxLat/MinLon/MaxLon)
sep - The GeoBounds separator

GeoBounds

public GeoBounds(GeoBounds gb)
Copy constructor

Parameters:
gb - The other GeoBounds to copy
Method Detail

reset

public void reset()
Reset bounds


clone

public java.lang.Object clone()
Returns a copy of this GeoBounds

Overrides:
clone in class java.lang.Object
Returns:
a copy of this GeoBounds

setMaxLatitude

public void setMaxLatitude(double maxLat)
Sets the maximum latitude

Parameters:
maxLat - The maximum latitude

getMaxLatitude

public double getMaxLatitude()
Gets the maximum latitude

Returns:
The maximum latitude

getMaxY

public double getMaxY()
Gets the maximum latitude

Returns:
The maximum latitude

getTop

public double getTop()
Gets the maximum latitude

Returns:
The maximum latitude

setMinLatitude

public void setMinLatitude(double minLat)
Sets the minimum latitude

Parameters:
minLat - The minimum latitude

getMinLatitude

public double getMinLatitude()
Gets the minimum latitude

Returns:
The minimum latitude

getMinY

public double getMinY()
Gets the minimum latitude

Returns:
The minimum latitude

getBottom

public double getBottom()
Gets the minimum latitude

Returns:
The minimum latitude

setMaxLongitude

public void setMaxLongitude(double maxLon)
Sets the maximum longitude

Parameters:
maxLon - The maximum longitude

getMaxLongitude

public double getMaxLongitude()
Gets the maximum longitude

Returns:
The maximum longitude

getMaxX

public double getMaxX()
Gets the maximum longitude

Returns:
The maximum longitude

getRight

public double getRight()
Gets the maximum longitude

Returns:
The maximum longitude

setMinLongitude

public void setMinLongitude(double minLon)
Sets the minimum longitude

Parameters:
minLon - The minimum longitude

getMinLongitude

public double getMinLongitude()
Gets the minimum longitude

Returns:
The minimum longitude

getMinX

public double getMinX()
Gets the minimum longitude

Returns:
The minimum longitude

getLeft

public double getLeft()
Gets the minimum longitude

Returns:
The minimum longitude

isValid

public boolean isValid()
Returns true if this bounds is valid

Returns:
True if this bounds is valid

extendByPoint

public void extendByPoint(GeoPointProvider gpp)
Extend the bounds by the specified GeoPoint

Parameters:
gpp - The point added to the bounds

extendByPoint

public void extendByPoint(GeoPointProvider... gpp)
Extend the bounds by the specified GeoPoint

Parameters:
gpp - The point(s) added to the bounds

extendByPoint

public void extendByPoint(java.util.Collection<GeoPointProvider> gppList)
Extend the bounds by the specified GeoPoint

Parameters:
gppList - The point(s) added to the bounds

extendByCircle

public void extendByCircle(double radiusM,
                           double lat,
                           double lon)
Extend the bounds by the specified point/radius circle

Parameters:
radiusM - The radius in meters
lat - The center latitude
lon - The center longitude

extendByCircle

public void extendByCircle(double radiusM,
                           GeoPointProvider gpp)
Extend the bounds by the specified point/radius circle

Parameters:
radiusM - The radius in meters
gpp - The center points of the circles

extendByCircle

public void extendByCircle(double radiusM,
                           GeoPointProvider... gpp)
Extend the bounds by the specified point/radius circle

Parameters:
radiusM - The radius in meters
gpp - The center points of the circles

extendByRadius

public boolean extendByRadius(double radiusM)
Extend the bounds of the current valid GeoBounds by the specified radius meters

Parameters:
radiusM - The radius in meters

getCenter

public GeoPoint getCenter()
Returns the average center of the bounds

Returns:
The GepPoint representing the center of the bounds

getDeltaLongitudeMeters

public double getDeltaLongitudeMeters()
Gets the width of the bounds (in delta meters)

Returns:
The bounds width (ie. delta meters)

getDeltaLatitudeMeters

public double getDeltaLatitudeMeters()
Gets the width of the bounds (in delta meters)

Returns:
The bounds width (ie. delta meters)

getDiagonalMeters

public double getDiagonalMeters()
Gets the diagonal distance of the bounds (in meters)

Returns:
The diagonal distance (ie. meters)

getMetersPerPixel

public double getMetersPerPixel(int W,
                                int H)
Calculate/return the best meters-per-pixel

Parameters:
W - The map pixel width
H - The map pixel height
Returns:
The best meters-per-pixel zoom level

getPixelLocation

public PixelPoint getPixelLocation(GeoPoint gp,
                                   int W,
                                   int H)
Return the pixel location of the specified GeoPoint within the specified dimensions

Parameters:
gp - The GeoPoint
W - The pixel width
H - The pixel height
Returns:
The PixPoint location, or null if the point falls outside the bounds

getDeltaLatitude

public double getDeltaLatitude()
Gets the height of the bounds

Returns:
The bounds height (ie. delta latitude)

getDeltaLongitude

public double getDeltaLongitude()
Gets the width of the bounds

Returns:
The bounds width (ie. delta longitude)

toString

public java.lang.String toString()
Return a String representation of this GeoBounds

Overrides:
toString in class java.lang.Object
Returns:
A String representation

main

public static void main(java.lang.String[] argv)
Main entry point for testing/debugging

Parameters:
argv - Comand-line arguments