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 aRectilinearGridusingDoubles.- Author:
- Guy Griffiths
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ReferenceableAxis<Double>xAxisprotected ReferenceableAxis<Double>yAxis-
Fields inherited from class uk.ac.rdg.resc.edal.grid.AbstractHorizontalGrid
crs
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRectilinearGridImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs)Single-argument constructor for subclasses who would rather create their axes from constructor arguments (seeRegularGridImplfor 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 booleancontains(HorizontalPosition position)booleanequals(Object obj)GridCoordinates2DfindIndexOf(HorizontalPosition position)Finds the index of the specified position within this domainBoundingBoxgetBoundingBox()Returns the bounding box of the domain in the domain's own coordinate reference system.org.opengis.referencing.crs.CoordinateReferenceSystemgetCoordinateReferenceSystem()Returns the co-ordinate reference system of this domainArray2D<GridCell2D>getDomainObjects()Returns anArrayof domain objects that comprise this domain.org.opengis.metadata.extent.GeographicBoundingBoxgetGeographicBoundingBox()Returns the bounding box of the domain in WGS84 latitude-longitude coordinates.ReferenceableAxis<Double>getXAxis()Gets the x axis of the grid.intgetXSize()ReferenceableAxis<Double>getYAxis()Gets the y axis of the grid.intgetYSize()inthashCode()longsize()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 (seeRegularGridImplfor 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:DiscreteDomainReturns anArrayof domain objects that comprise this domain.- Specified by:
getDomainObjectsin interfaceDiscreteDomain<HorizontalPosition,GridCell2D>- Specified by:
getDomainObjectsin interfaceHorizontalGrid
-
contains
public boolean contains(HorizontalPosition position)
- Specified by:
containsin interfaceDomain<HorizontalPosition>- Returns:
- true if the given position is contained within this domain.
-
getBoundingBox
public BoundingBox getBoundingBox()
Description copied from interface:HorizontalDomainReturns 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 aBoundingBoxin a different CRS. Consequently thisBoundingBoxis not guaranteed to be a tight bound around the domain.- Specified by:
getBoundingBoxin interfaceHorizontalDomain
-
getGeographicBoundingBox
public org.opengis.metadata.extent.GeographicBoundingBox getGeographicBoundingBox()
Description copied from interface:HorizontalDomainReturns the bounding box of the domain in WGS84 latitude-longitude coordinates.- Specified by:
getGeographicBoundingBoxin interfaceHorizontalDomain
-
getXAxis
public ReferenceableAxis<Double> getXAxis()
Description copied from interface:RectilinearGridGets the x axis of the grid.- Specified by:
getXAxisin interfaceRectilinearGrid
-
getYAxis
public ReferenceableAxis<Double> getYAxis()
Description copied from interface:RectilinearGridGets the y axis of the grid.- Specified by:
getYAxisin interfaceRectilinearGrid
-
getCoordinateReferenceSystem
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Description copied from interface:HorizontalDomainReturns the co-ordinate reference system of this domain- Specified by:
getCoordinateReferenceSystemin interfaceHorizontalDomain- Overrides:
getCoordinateReferenceSystemin classAbstractHorizontalGrid
-
size
public long size()
Description copied from interface:HorizontalGridReturns the size of this domain. Equivalent togetXSize() * getYSize()- Specified by:
sizein interfaceDiscreteHorizontalDomain<GridCell2D>- Specified by:
sizein interfaceHorizontalGrid
-
findIndexOf
public GridCoordinates2D findIndexOf(HorizontalPosition position)
Description copied from interface:HorizontalGridFinds the index of the specified position within this domain- Specified by:
findIndexOfin interfaceHorizontalGrid- Parameters:
position- The position to find the index of- Returns:
- A
GridCoordinates2Dobject representing the index of the position within the domain, ornullif the position is outside the domain.
-
getXSize
public int getXSize()
- Specified by:
getXSizein interfaceHorizontalGrid- Returns:
- The size of the x-axis
-
getYSize
public int getYSize()
- Specified by:
getYSizein interfaceHorizontalGrid- Returns:
- The size of the y-axis
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceHorizontalGrid- Overrides:
hashCodein classAbstractHorizontalGrid
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceHorizontalGrid- Overrides:
equalsin classAbstractHorizontalGrid
-
-