|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectGeneralGridGeometry
@Immutable public class GeneralGridGeometry
Describes the valid range of grid coordinates and the transform from those grid coordinates to real world coordinates. Grid geometries contains:
All grid geometry attributes are optional because some of them may be inferred from a wider
context. For example a grid geometry know nothing about rendered
images, but GridCoverage2D do. Consequently, the later may infer the grid envelope by itself.
By default, any request for an undefined attribute will thrown an
InvalidGridGeometryException. In order to check if an attribute is defined,
use isDefined(int).
GridGeometry2D,
ImageGeometry,
Serialized Form
| coverage/geotk-coverage (download) | View source code for this class |
| Field Summary | |
|---|---|
static int |
CRS
A bitmask to specify the validity of the coordinate reference system. |
protected ImmutableEnvelope |
envelope
The geodetic envelope, or null if none. |
static int |
ENVELOPE
A bitmask to specify the validity of the geodetic envelope. |
protected GridEnvelope |
extent
The valid domain of a grid coverage, or null if none. |
static int |
EXTENT
A bitmask to specify the validity of the grid envelope. |
static int |
GRID_TO_CRS
A bitmask to specify the validity of the grid to CRS transform. |
protected MathTransform |
gridToCRS
The math transform from grid indices to "real world" coordinates, or null if none. |
| Constructor Summary | |
|---|---|
GeneralGridGeometry(GridEnvelope extent,
Envelope envelope)
Constructs a new grid geometry from an envelope. |
|
GeneralGridGeometry(GridEnvelope extent,
MathTransform gridToCRS,
CoordinateReferenceSystem crs)
Constructs a new grid geometry from a grid envelope and a math transform mapping pixel center. |
|
GeneralGridGeometry(GridEnvelope extent,
PixelInCell anchor,
MathTransform gridToCRS,
CoordinateReferenceSystem crs)
Constructs a new grid geometry from a grid envelope and a math transform mapping pixel center or corner. |
|
GeneralGridGeometry(GridGeometry other)
Creates a new grid geometry with the same values than the given grid geometry. |
|
GeneralGridGeometry(PixelInCell anchor,
MathTransform gridToCRS,
Envelope envelope)
Constructs a new grid geometry from an envelope and a math transform. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object object)
Compares the specified object with this grid geometry for equality. |
CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the "real world" coordinate reference system. |
int |
getDimension()
Returns the number of dimensions of the grid. |
Envelope |
getEnvelope()
Returns the bounding box of "real world" coordinates for this grid geometry. |
GridEnvelope |
getExtent()
Returns the valid coordinate range of a grid coverage. |
GridEnvelope |
getGridRange()
Deprecated. Renamed getExtent(). |
MathTransform |
getGridToCRS()
Returns the transform from grid coordinates to real world earth coordinates. |
MathTransform |
getGridToCRS(PixelInCell anchor)
Returns the transform from grid coordinates to real world earth coordinates. |
double[] |
getResolution()
Returns the grid resolution in units of the Coordinate Reference System axes, or null if it can't be computed. |
int |
hashCode()
Returns a hash value for this grid geometry. |
boolean |
isDefined(int bitmask)
Returns true if all the parameters specified by the argument are set. |
String |
toString()
Returns a string representation of this grid geometry. |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int CRS
isDefined(int)
method.
public static final int ENVELOPE
isDefined(int) method.
public static final int EXTENT
isDefined(int) method.
public static final int GRID_TO_CRS
isDefined(int) method.
protected final GridEnvelope extent
null if none. The lowest valid
grid coordinate is zero for BufferedImage, but may be non-zero for
arbitrary RenderedImage. A grid with 512 cells can have a minimum coordinate of 0
and maximum of 512, with 511 as the highest valid index.
Note:
This field name was gridRange in all Geotk versions prior 3.20. The
grid range name was defined in the legacy OGC 01-004 specification,
while extent is defined in the ISO 19123 specification. This field
has been renamed in order to avoid confusion with coverage range,
which has a totally different meaning in ISO 19123.
RenderedImage.getMinX(),
RenderedImage.getMinY(),
RenderedImage.getWidth(),
RenderedImage.getHeight()protected final ImmutableEnvelope envelope
null if none. If non-null, this envelope is usually the
grid envelope transformed to real world
coordinates. The coordinate reference system (CRS)
of this envelope defines the "real world" CRS of this grid geometry.
protected final MathTransform gridToCRS
null if none.
This math transform is usually affine. It maps pixel center
to "real world" coordinate using the following line:
DirectPosition aCellIndices = ...: DirectPosition aPixelCenter = gridToCRS.transform(pixels, aCellIndices);
| Constructor Detail |
|---|
public GeneralGridGeometry(GridGeometry other)
GeneralGridGeometry.
other - The other grid geometry to copy.
public GeneralGridGeometry(GridEnvelope extent,
MathTransform gridToCRS,
CoordinateReferenceSystem crs)
throws MismatchedDimensionException,
IllegalArgumentException
extent - The valid extent of grid coordinates, or null if none.gridToCRS - The math transform which allows for the transformations from grid coordinates
(pixel center) to real world earth coordinates. May be null,
but this is not recommended.crs - The coordinate reference system for the "real world" coordinates, or null
if unknown. This CRS is given to the envelope.
MismatchedDimensionException - if the math transform and the CRS don't have consistent dimensions.
IllegalArgumentException - if the math transform can't transform coordinates in the domain of the
specified grid envelope.
public GeneralGridGeometry(GridEnvelope extent,
PixelInCell anchor,
MathTransform gridToCRS,
CoordinateReferenceSystem crs)
throws MismatchedDimensionException,
IllegalArgumentException
extent - The valid extent of grid coordinates, or null if none.anchor - CELL_CENTER for OGC conventions or
CELL_CORNER for Java2D/JAI conventions.gridToCRS - The math transform which allows for the transformations from grid coordinates to
real world earth coordinates. May be null, but this is not recommended.crs - The coordinate reference system for the "real world" coordinates, or null
if unknown. This CRS is given to the envelope.
MismatchedDimensionException - if the math transform and the CRS don't have consistent dimensions.
IllegalArgumentException - if the math transform can't transform coordinates in the domain of the
specified grid envelope.
public GeneralGridGeometry(PixelInCell anchor,
MathTransform gridToCRS,
Envelope envelope)
throws MismatchedDimensionException,
IllegalArgumentException
anchor argument.
anchor - CELL_CENTER for OGC conventions or
CELL_CORNER for Java2D/JAI conventions.gridToCRS - The math transform which allows for the transformations from grid coordinates to
real world earth coordinates. May be null, but this is not recommended.envelope - The envelope (including CRS) of a grid coverage, or null if none.
MismatchedDimensionException - if the math transform and the envelope doesn't have consistent dimensions.
IllegalArgumentException - if the math transform can't transform coordinates in the domain of the grid envelope.
public GeneralGridGeometry(GridEnvelope extent,
Envelope envelope)
throws MismatchedDimensionException
GridToEnvelopeMapper javadoc.
More specifically, heuristic rules are applied for:
extent - The valid extent of grid coordinates, or null if none.envelope - The corresponding domain in "real world" coordinates. This rectangle must contains
entirely all pixels, i.e. the rectangle's upper left corner must coincide with the
upper left corner of the first pixel and the rectangle's lower right corner must
coincide with the lower right corner of the last pixel.
MismatchedDimensionException - if the grid envelope and the georeferenced envelope doesn't have consistent dimensions.| Method Detail |
|---|
public int getDimension()
public CoordinateReferenceSystem getCoordinateReferenceSystem()
throws InvalidGridGeometryException
null).
InvalidGridGeometryException - if this grid geometry has no CRS (i.e.
isDefined(CRS)
returned false).GridGeometry2D.getCoordinateReferenceSystem2D()
public Envelope getEnvelope()
throws InvalidGridGeometryException
null).
InvalidGridGeometryException - if this grid geometry has no envelope (i.e.
isDefined(ENVELOPE)
returned false).GridGeometry2D.getEnvelope2D()
public GridEnvelope getExtent()
throws InvalidGridGeometryException
BufferedImage, but may be non-zero for arbitrary
RenderedImage. A grid with 512 cells can have a minimum coordinate of 0 and
maximum of 512, with 511 as the highest valid index.
getExtent in interface GridGeometrynull).
InvalidGridGeometryException - if this grid geometry has no extent (i.e.
isDefined(EXTENT)
returned false).GridGeometry2D#getGridRange2D()
@Deprecated
public GridEnvelope getGridRange()
throws InvalidGridGeometryException
getExtent().
getGridRange in interface GridGeometryInvalidGridGeometryException
public MathTransform getGridToCRS()
throws InvalidGridGeometryException
Coverage.getCoordinateReferenceSystem().
Note: OpenGIS requires that the transform maps pixel centers to real world coordinates. This is different from some other systems that map pixel's upper left corner.
getGridToCRS in interface GridGeometrynull).
InvalidGridGeometryException - if this grid geometry has no transform (i.e.
isDefined(GRID_TO_CRS)
returned false).GridGeometry2D.getGridToCRS2D()
public MathTransform getGridToCRS(PixelInCell anchor)
throws InvalidGridGeometryException
getGridToCRS() except that the transform may maps
other parts than pixel center.
anchor - The pixel part to map.
null).
InvalidGridGeometryException - if this grid geometry has no transform (i.e.
isDefined(GRID_TO_CRS)
returned false).GridGeometry2D.getGridToCRS(PixelOrientation),
DiscreteReferencingFactory.getAffineTransform(GridGeometry, PixelInCell),
PixelTranslationpublic double[] getResolution()
null if it can't be computed. If non-null,
the length of the returned array is the number of CRS dimension.
null if unknown.
public boolean isDefined(int bitmask)
throws IllegalArgumentException
true if all the parameters specified by the argument are set.
bitmask - Any combination of CRS, ENVELOPE, EXTENT
and GRID_TO_CRS.
true if all specified attributes are defined (i.e. invoking the
corresponding method will not thrown an InvalidGridGeometryException).
IllegalArgumentException - if the specified bitmask is not a combination of known
masks.ImageLayout.isValid(int)public int hashCode()
hashCode in class Objectpublic boolean equals(Object object)
equals in class Objectobject - The object to compare with.
true if the given object is equals to this grid geometry.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||