Package uk.ac.rdg.resc.edal.grid
Class RectilinearGridImpl
- java.lang.Object
-
- uk.ac.rdg.resc.edal.grid.AbstractHorizontalGrid
-
- uk.ac.rdg.resc.edal.grid.RectilinearGridImpl
-
- All Implemented Interfaces:
Serializable
,DiscreteDomain<HorizontalPosition,GridCell2D>
,DiscreteHorizontalDomain<GridCell2D>
,Domain<HorizontalPosition>
,HorizontalDomain
,HorizontalGrid
,RectilinearGrid
- Direct Known Subclasses:
RegularGridImpl
public class RectilinearGridImpl extends AbstractHorizontalGrid implements RectilinearGrid, Serializable
Immutable implementation of aRectilinearGrid
usingDouble
s.- Author:
- Guy Griffiths
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ReferenceableAxis<Double>
xAxis
protected ReferenceableAxis<Double>
yAxis
-
Fields inherited from class uk.ac.rdg.resc.edal.grid.AbstractHorizontalGrid
crs
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RectilinearGridImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Single-argument constructor for subclasses who would rather create their axes from constructor arguments (seeRegularGridImpl
for an example)RectilinearGridImpl(ReferenceableAxis<Double> xAxis, ReferenceableAxis<Double> yAxis, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Instantiates a new rectilinear grid from the given axes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(HorizontalPosition position)
boolean
equals(Object obj)
GridCoordinates2D
findIndexOf(HorizontalPosition position)
Finds the index of the specified position within this domainBoundingBox
getBoundingBox()
Returns the bounding box of the domain in the domain's own coordinate reference system.org.opengis.referencing.crs.CoordinateReferenceSystem
getCoordinateReferenceSystem()
Returns the co-ordinate reference system of this domainArray2D<GridCell2D>
getDomainObjects()
Returns anArray
of domain objects that comprise this domain.org.opengis.metadata.extent.GeographicBoundingBox
getGeographicBoundingBox()
Returns the bounding box of the domain in WGS84 latitude-longitude coordinates.ReferenceableAxis<Double>
getXAxis()
Gets the x axis of the grid.int
getXSize()
ReferenceableAxis<Double>
getYAxis()
Gets the y axis of the grid.int
getYSize()
int
hashCode()
long
size()
Returns the size of this domain.
-
-
-
Field Detail
-
xAxis
protected ReferenceableAxis<Double> xAxis
-
yAxis
protected ReferenceableAxis<Double> yAxis
-
-
Constructor Detail
-
RectilinearGridImpl
protected RectilinearGridImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Single-argument constructor for subclasses who would rather create their axes from constructor arguments (seeRegularGridImpl
for an example)
-
RectilinearGridImpl
public RectilinearGridImpl(ReferenceableAxis<Double> xAxis, ReferenceableAxis<Double> yAxis, org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Instantiates a new rectilinear grid from the given axes- Parameters:
xAxis
- the x-axisyAxis
- the y-axiscrs
- theCoordinateReferenceSystem
-
-
Method Detail
-
getDomainObjects
public Array2D<GridCell2D> getDomainObjects()
Description copied from interface:DiscreteDomain
Returns anArray
of domain objects that comprise this domain.- Specified by:
getDomainObjects
in interfaceDiscreteDomain<HorizontalPosition,GridCell2D>
- Specified by:
getDomainObjects
in interfaceHorizontalGrid
-
contains
public boolean contains(HorizontalPosition position)
- Specified by:
contains
in interfaceDomain<HorizontalPosition>
- Returns:
- true if the given position is contained within this domain.
-
getBoundingBox
public BoundingBox getBoundingBox()
Description copied from interface:HorizontalDomain
Returns the bounding box of the domain in the domain's own coordinate reference system. For domains which do not have a native co-ordinate reference system this may return aBoundingBox
in a different CRS. Consequently thisBoundingBox
is not guaranteed to be a tight bound around the domain.- Specified by:
getBoundingBox
in interfaceHorizontalDomain
-
getGeographicBoundingBox
public org.opengis.metadata.extent.GeographicBoundingBox getGeographicBoundingBox()
Description copied from interface:HorizontalDomain
Returns the bounding box of the domain in WGS84 latitude-longitude coordinates.- Specified by:
getGeographicBoundingBox
in interfaceHorizontalDomain
-
getXAxis
public ReferenceableAxis<Double> getXAxis()
Description copied from interface:RectilinearGrid
Gets the x axis of the grid.- Specified by:
getXAxis
in interfaceRectilinearGrid
-
getYAxis
public ReferenceableAxis<Double> getYAxis()
Description copied from interface:RectilinearGrid
Gets the y axis of the grid.- Specified by:
getYAxis
in interfaceRectilinearGrid
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Description copied from interface:HorizontalDomain
Returns the co-ordinate reference system of this domain- Specified by:
getCoordinateReferenceSystem
in interfaceHorizontalDomain
- Overrides:
getCoordinateReferenceSystem
in classAbstractHorizontalGrid
-
size
public long size()
Description copied from interface:HorizontalGrid
Returns the size of this domain. Equivalent togetXSize() * getYSize()
- Specified by:
size
in interfaceDiscreteHorizontalDomain<GridCell2D>
- Specified by:
size
in interfaceHorizontalGrid
-
findIndexOf
public GridCoordinates2D findIndexOf(HorizontalPosition position)
Description copied from interface:HorizontalGrid
Finds the index of the specified position within this domain- Specified by:
findIndexOf
in interfaceHorizontalGrid
- Parameters:
position
- The position to find the index of- Returns:
- A
GridCoordinates2D
object representing the index of the position within the domain, ornull
if the position is outside the domain.
-
getXSize
public int getXSize()
- Specified by:
getXSize
in interfaceHorizontalGrid
- Returns:
- The size of the x-axis
-
getYSize
public int getYSize()
- Specified by:
getYSize
in interfaceHorizontalGrid
- Returns:
- The size of the y-axis
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceHorizontalGrid
- Overrides:
hashCode
in classAbstractHorizontalGrid
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceHorizontalGrid
- Overrides:
equals
in classAbstractHorizontalGrid
-
-