Package uk.ac.rdg.resc.edal.grid
Class GridCell2DImpl
- java.lang.Object
-
- uk.ac.rdg.resc.edal.grid.GridCell2DImpl
-
- All Implemented Interfaces:
Domain<HorizontalPosition>
,GridCell2D
,HorizontalCell
public final class GridCell2DImpl extends Object implements GridCell2D
Simple immutable implementation of a GridCell2D.- Author:
- Jon, Guy
-
-
Constructor Summary
Constructors Constructor Description GridCell2DImpl(GridCoordinates2D gridCoords, HorizontalPosition centre, Polygon footprint, HorizontalGrid parentGrid)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(HorizontalPosition position)
HorizontalPosition
getCentre()
Polygon
getFootprint()
GridCoordinates2D
getGridCoordinates()
HorizontalGrid
getParentDomain()
String
toString()
-
-
-
Constructor Detail
-
GridCell2DImpl
public GridCell2DImpl(GridCoordinates2D gridCoords, HorizontalPosition centre, Polygon footprint, HorizontalGrid parentGrid)
- Parameters:
gridCoords
- The indices of this cell within its parent gridcentre
- The centreHorizontalPosition
of this grid cellfootprint
- APolygon
representing the bounding box of this grid cell. Does not necessarily have to be a tight-bound around the cellparentGrid
- TheHorizontalGrid
which thisGridCell2D
is part of
-
-
Method Detail
-
getGridCoordinates
public GridCoordinates2D getGridCoordinates()
- Specified by:
getGridCoordinates
in interfaceGridCell2D
- Returns:
- the coordinates within the parent
HorizontalGrid
-
getCentre
public HorizontalPosition getCentre()
- Specified by:
getCentre
in interfaceHorizontalCell
- Returns:
- the centre of the cell in horizontal space
-
getFootprint
public Polygon getFootprint()
- Specified by:
getFootprint
in interfaceHorizontalCell
- Returns:
- the footprint of this cell in horizontal space.
-
contains
public boolean contains(HorizontalPosition position)
- Specified by:
contains
in interfaceDomain<HorizontalPosition>
- Returns:
- true if the given position is contained within this domain.
-
getParentDomain
public HorizontalGrid getParentDomain()
- Specified by:
getParentDomain
in interfaceGridCell2D
- Specified by:
getParentDomain
in interfaceHorizontalCell
- Returns:
- the grid of which this cell is a part
-
-