public class EarthArea
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Iterable<int[]>
Modifier and Type | Class and Description |
---|---|
class |
EarthArea.EarthAreaIterator
The earth area iterator is used to loop over all grid squares in
an earth area.
|
Constructor and Description |
---|
EarthArea()
Creates an empty earth area with no locations.
|
EarthArea(EarthTransform trans,
DataLocation min,
DataLocation max)
Creates a new earth area from the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
add(EarthLocation loc)
Adds an earth location to this area.
|
void |
addAll()
Adds all earth locations to this area.
|
java.lang.Object |
clone()
Creates an independent copy of this area.
|
boolean |
contains(EarthLocation loc)
Determines if an earth location is contained in this area.
|
boolean |
contains(int[] square)
Determines if a grid square is contained in this area.
|
boolean |
equals(java.lang.Object o)
Returns true if this area exactly equals another area.
|
void |
expand()
Expands the current area by 1 degree in all directions.
|
void |
explore(EarthTransform trans,
DataLocation min,
DataLocation max,
EarthLocation start)
Explores within data location boundaries using an earth transform
to find all locations within an area.
|
int[] |
getExtremes()
Gets the geographic extremes in this area.
|
int |
getIndex(EarthLocation loc)
Computes a square index based on an earth location.
|
int |
getIndex(int lat,
int lon)
Computes a square index based on a grid square.
|
java.util.Iterator<int[]> |
getIterator()
Returns an iterator over the grid square elements.
|
EarthArea |
intersection(EarthArea area)
Computes the intersection between this area and another.
|
boolean |
isEmpty()
Returns true if this earth area contains no grid squares.
|
java.util.Iterator<int[]> |
iterator() |
void |
remove(EarthLocation loc)
Removes an earth location from this area.
|
public EarthArea()
public EarthArea(EarthTransform trans, DataLocation min, DataLocation max)
trans
- an earth transform to use for exploration.min
- the minimum data location to explore.max
- the maximum data location to explore.public EarthArea intersection(EarthArea area)
area
- the other earth area to compute the intersection.public boolean isEmpty()
public java.util.Iterator<int[]> getIterator()
int[]
coordinates of the grid square as [lat, lon].public java.util.Iterator<int[]> iterator()
iterator
in interface java.lang.Iterable<int[]>
public boolean contains(EarthLocation loc)
loc
- the earth location to search for.public boolean contains(int[] square)
square
- the grid square lower-left corner as [lat, lon].public void add(EarthLocation loc)
loc
- the earth location to add.public void addAll()
public void remove(EarthLocation loc)
loc
- the earth location to remove.public int getIndex(int lat, int lon)
lat
- the grid square lower-left corner latitude in the range [-90,89].lon
- the grid square lower-left corner longitude in the range [-180,179].public int getIndex(EarthLocation loc)
loc
- the earth location to convert.public void expand()
. . . . . . . . . . . . . . * * . . . * * . . . . . * . . . . . . . . . . . . . . .then the expanded area includes the boundary points:
. . . . . . . x x x x . x x * * x . x * * x x . x x * x . . . x x x . . . . . . . .
public void explore(EarthTransform trans, DataLocation min, DataLocation max, EarthLocation start)
trans
- an earth transform to use for exploration.min
- the minimum data location to explore.max
- the maximum data location to explore.start
- the starting earth location for exploration.public int[] getExtremes()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object