Class CurvilinearCoords.Cell
- java.lang.Object
-
- uk.ac.rdg.resc.edal.util.CurvilinearCoords.Cell
-
- Enclosing class:
- CurvilinearCoords
public class CurvilinearCoords.Cell extends Object
A cell within this curvilinear grid.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double lon, double lat)
Returns true if this cell'sboundary
contains the given longitude-latitude point.boolean
equals(Object obj)
double
findDistanceSq(double lon, double lat)
Finds the square of the distance between the centre of this cell and the given HorizontalPositiondouble
getArea()
Returns the area of this cell in square degrees.Path2D
getBoundaryPath()
Gets a Path2D object representing the boundary of this cell, formed by joining itscorners
by straight lines in longitude-latitude space.HorizontalPosition
getCentre()
Gets the centre point of this cell.List<CurvilinearCoords.Cell>
getCornerNeighbours()
Gets the neighbours of this cell (up to four) that join this cell at a corner.List<Point2D>
getCorners()
Returns a list of the (four) corners of this cell.List<CurvilinearCoords.Cell>
getEdgeNeighbours()
Gets the neighbours of this cell (up to four) that join this cell along an edge.int
getI()
int
getJ()
BoundingBox
getMinimumBoundingRectangle()
List<CurvilinearCoords.Cell>
getNeighbours()
Gets the neighbours of this cell (up to eight) that join this cell at an edge or corner.int
hashCode()
String
toString()
-
-
-
Method Detail
-
getI
public int getI()
-
getJ
public int getJ()
-
getCentre
public HorizontalPosition getCentre()
Gets the centre point of this cell. Note that in some grid formulations, the point could be represented by NaNs (in this case the cell cannot be used or plotted: it exists in the grid simply for structural convenience).
-
getCorners
public List<Point2D> getCorners()
Returns a list of the (four) corners of this cell. The longitude coordinate (given by
Point2D.getX()
) of all the corners will be as close to thecentre
of the cell as possible. That is to say, if the centre of the cell is at a longitude of 179 degrees then a corner of the cell would be given with a longitude of 181 degrees, rather than -179 degrees. This helps with the plotting of the cell on a plane. This method returns a new List containing new Points with each invocation.Note that in some grid formulations, the corners could be represented by NaNs (in this case the cell cannot be used or plotted: it exists in the grid simply for structural convenience).
-
getEdgeNeighbours
public List<CurvilinearCoords.Cell> getEdgeNeighbours()
Gets the neighbours of this cell (up to four) that join this cell along an edge. The order of the cells in the list is such that the centres of the cells can be joined to form a polygon in which the edges do not cross.
-
getCornerNeighbours
public List<CurvilinearCoords.Cell> getCornerNeighbours()
Gets the neighbours of this cell (up to four) that join this cell at a corner. The order of the cells in the list is such that the centres of the cells can be joined to form a polygon in which the edges do not cross.
-
getNeighbours
public List<CurvilinearCoords.Cell> getNeighbours()
Gets the neighbours of this cell (up to eight) that join this cell at an edge or corner.
-
getArea
public double getArea()
Returns the area of this cell in square degrees.
Note that in some grid formulations, the area could be NaN (in this case the cell cannot be used or plotted: it exists in the grid simply for structural convenience).
-
getBoundaryPath
public Path2D getBoundaryPath()
Gets a Path2D object representing the boundary of this cell, formed by joining itscorners
by straight lines in longitude-latitude space. This returns a new Path2D object with each invocation.
-
getMinimumBoundingRectangle
public BoundingBox getMinimumBoundingRectangle()
-
findDistanceSq
public double findDistanceSq(double lon, double lat)
Finds the square of the distance between the centre of this cell and the given HorizontalPosition
-
contains
public boolean contains(double lon, double lat)
Returns true if this cell'sboundary
contains the given longitude-latitude point. TODO what happens if this cell is represented by NaNs?
-
-