uk.me.parabola.imgfmt.app
Class Area

java.lang.Object
  extended by uk.me.parabola.imgfmt.app.Area

public class Area
extends java.lang.Object

A map area in map units. There is a constructor available for creating in lat/long form.

Author:
Steve Ratcliffe

Constructor Summary
Area(double minLat, double minLong, double maxLat, double maxLong)
           
Area(int minLat, int minLong, int maxLat, int maxLong)
          Create an area from the given coordinates.
 
Method Summary
 boolean allInsideBoundary(java.util.List<Coord> coords)
           
 boolean contains(Coord co)
           
 boolean equals(java.lang.Object o)
           
 Coord getCenter()
           
 int getHeight()
           
 int getMaxDimention()
          Get the largest dimension.
 int getMaxLat()
           
 int getMaxLong()
           
 int getMinLat()
           
 int getMinLong()
           
 int getWidth()
           
 int hashCode()
           
 boolean insideBoundary(Coord co)
           
 boolean intersects(Area bbox)
          Checks if this area intersects the given bounding box at least in one point.
 boolean isEmpty()
           
 boolean onBoundary(Coord co)
           
 Area[] split(int xsplit, int ysplit)
          Split this area up into a number of smaller areas.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Area

public Area(int minLat,
            int minLong,
            int maxLat,
            int maxLong)
Create an area from the given coordinates. We ensure that no dimension is zero.

Parameters:
minLat - The western latitude.
minLong - The southern longitude.
maxLat - The eastern lat.
maxLong - The northern long.

Area

public Area(double minLat,
            double minLong,
            double maxLat,
            double maxLong)
Method Detail

getMinLat

public int getMinLat()

getMinLong

public int getMinLong()

getMaxLat

public int getMaxLat()

getMaxLong

public int getMaxLong()

getWidth

public int getWidth()

getHeight

public int getHeight()

getCenter

public Coord getCenter()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

split

public Area[] split(int xsplit,
                    int ysplit)
Split this area up into a number of smaller areas.

Parameters:
xsplit - The number of pieces to split this area into in the x direction.
ysplit - The number of pieces to split this area into in the y direction.
Returns:
An area containing xsplit*ysplit areas.

getMaxDimention

public int getMaxDimention()
Get the largest dimension. So either the width or height, depending on which is larger.

Returns:
The largest dimension in map units.

contains

public final boolean contains(Coord co)

insideBoundary

public final boolean insideBoundary(Coord co)

onBoundary

public final boolean onBoundary(Coord co)

intersects

public final boolean intersects(Area bbox)
Checks if this area intersects the given bounding box at least in one point.

Parameters:
bbox - an area
Returns:
true if this area intersects the bbox; false else

isEmpty

public boolean isEmpty()

allInsideBoundary

public boolean allInsideBoundary(java.util.List<Coord> coords)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object