| java.lang.Object org.geotools.coverage.grid.GeneralGridGeometry
All known Subclasses: org.geotools.coverage.grid.GridGeometry2D,
GeneralGridGeometry | public class GeneralGridGeometry implements GridGeometry,Serializable(Code) | | Describes the valid range of grid coordinates and the math transform to transform grid
coordinates to real world coordinates. Grid geometries contains:
- An optional
, usually inferred from the
size.
- An optional "grid to CRS"
, which may be inferred
from the grid range and the envelope.
- An optional
, which may be inferred from the grid range
and the "grid to CRS" transform.
- An optional
to be
given to the envelope.
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
, but
GridCoverage2D do. Consequently, the later may infer the
by itself.
By default, any request for an undefined attribute will thrown an
InvalidGridGeometryException . In order to check if an attribute is defined,
use
GeneralGridGeometry.isDefined .
since: 2.1 version: $Id: GeneralGridGeometry.java 26984 2007-09-14 18:13:49Z desruisseaux $ author: Martin Desruisseaux author: Alessio Fabiani |
Field Summary | |
final public static int | CRS A bitmask to specify the validity of the
. | final public static int | ENVELOPE A bitmask to specify the validity of the
. | final public static int | GRID_RANGE A bitmask to specify the validity of the
. | final public static int | GRID_TO_CRS A bitmask to specify the validity of the
transform. | final GeneralEnvelope | envelope The envelope, which is usually the
to real world coordinates. | final protected GridRange | gridRange The valid coordinate range of a grid coverage, or
null if none. | final protected MathTransform | gridToCRS The math transform (usually an affine transform), or
null if none. |
Constructor Summary | |
| GeneralGridGeometry(GeneralGridGeometry gm, CoordinateReferenceSystem crs) Constructs a new grid geometry identical to the specified one except for the CRS.
Note that this constructor just defines the CRS; it does not reproject
the envelope. | public | GeneralGridGeometry(GridRange gridRange, MathTransform gridToCRS, CoordinateReferenceSystem crs) Constructs a new grid geometry from a
mapping
. | public | GeneralGridGeometry(GridRange gridRange, Envelope userRange) Constructs a new grid geometry from an
. | public | GeneralGridGeometry(GridRange gridRange, Envelope userRange, boolean[] reverse, boolean swapXY) Constructs a new grid geometry from an
. | | GeneralGridGeometry(GridRange gridRange, Envelope userRange, boolean[] reverse, boolean swapXY, boolean automatic) Implementation of heuristic constructors. |
GRID_RANGE | final public static int GRID_RANGE(Code) | | A bitmask to specify the validity of the
.
This is given as an argument to the
GeneralGridGeometry.isDefined method.
since: 2.2 |
GRID_TO_CRS | final public static int GRID_TO_CRS(Code) | | A bitmask to specify the validity of the
transform. This is given as an argument to the
GeneralGridGeometry.isDefined method.
since: 2.2 |
envelope | final GeneralEnvelope envelope(Code) | | The envelope, which is usually the
to real world coordinates. This
envelope contains the
of "real world" coordinates.
This field should be considered as private because envelopes are mutable, and we want to make
sure that envelopes are cloned before to be returned to the user. Only
GridGeometry2D and
GridCoverage2D access directly to this field (read only) for performance reason.
since: 2.2 |
gridRange | final protected GridRange gridRange(Code) | | The valid coordinate range of a grid coverage, or
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.
See Also: RenderedImage.getMinX See Also: RenderedImage.getMinY See Also: RenderedImage.getWidth See Also: RenderedImage.getHeight |
gridToCRS | final protected MathTransform gridToCRS(Code) | | The math transform (usually an affine transform), or
null if none.
This math transform maps
to "real world" coordinate using the following line:
gridToCRS.transform(pixels, point);
|
GeneralGridGeometry | GeneralGridGeometry(GeneralGridGeometry gm, CoordinateReferenceSystem crs)(Code) | | Constructs a new grid geometry identical to the specified one except for the CRS.
Note that this constructor just defines the CRS; it does not reproject
the envelope. For this reason, this constructor should not be public. It is for internal
use by
GridCoverageFactory only.
|
GeneralGridGeometry | public GeneralGridGeometry(GridRange gridRange, MathTransform gridToCRS, CoordinateReferenceSystem crs) throws MismatchedDimensionException, IllegalArgumentException(Code) | | Constructs a new grid geometry from a
mapping
. This is the most general
constructor, the one that gives the maximal control over the grid geometry to be created.
Parameters: gridRange - The valid coordinate range of a grid coverage, or null if none. Parameters: gridToCRS - The math transform which allows for the transformations from gridcoordinates (pixel's center) to real world earth coordinates.May be null , but this is not recommanded. Parameters: crs - The coordinate reference system for the "real world" coordinates, or null if unknown. This CRS is given to the. throws: MismatchedDimensionException - if the math transform or the CRS doesn't haveconsistent dimensions. throws: IllegalArgumentException - if the math transform can't transform coordinatesin the domain of the specified grid range. since: 2.2 |
GeneralGridGeometry | public GeneralGridGeometry(GridRange gridRange, Envelope userRange) throws MismatchedDimensionException(Code) | | Constructs a new grid geometry from an
. An
will be computed automatically from the specified
envelope using heuristic rules described in
GridToEnvelopeMapper javadoc.
More specifically, heuristic rules are applied for:
Parameters: gridRange - The valid coordinate range of a grid coverage. Parameters: userRange - The corresponding coordinate range in user coordinate. This rectangle mustcontains entirely all pixels, i.e. the rectangle's upper left corner mustcoincide with the upper left corner of the first pixel and the rectangle'slower right corner must coincide with the lower right corner of the lastpixel. throws: MismatchedDimensionException - if the grid range and the envelope doesn't haveconsistent dimensions. since: 2.2 |
GeneralGridGeometry | public GeneralGridGeometry(GridRange gridRange, Envelope userRange, boolean[] reverse, boolean swapXY) throws MismatchedDimensionException(Code) | | Constructs a new grid geometry from an
. This convenience
constructor delegates the work to
GridToEnvelopeMapper ; see its javadoc for details.
If this convenience constructor do not provides suffisient control on axis order or reversal,
then an affine transform shall be created explicitly and the grid geometry shall be created
using the
argument.
Parameters: gridRange - The valid coordinate range of a grid coverage. Parameters: userRange - The corresponding coordinate range in user coordinate. This envelope mustcontains entirely all pixels, i.e. the envelope's upper left corner mustcoincide with the upper left corner of the first pixel and the envelope'slower right corner must coincide with the lower right corner of the lastpixel. Parameters: reverse - Tells for each axis in user space whatever or not its directionshould be reversed. A null value reverse no axis. Callers willtypically set reverse[1] to true in order to reverse they axis direction. Parameters: swapXY - If true , then the two first axis will be interchanged. Callers willtypically set this argument to true when the geographic coordinatesystem has axis in the (y,x) order. The reverse parameter then apply to axis after the swap. throws: MismatchedDimensionException - if the grid range and the envelope doesn't haveconsistent dimensions. since: 2.2 |
GeneralGridGeometry | GeneralGridGeometry(GridRange gridRange, Envelope userRange, boolean[] reverse, boolean swapXY, boolean automatic) throws MismatchedDimensionException(Code) | | Implementation of heuristic constructors.
|
equals | public boolean equals(Object object)(Code) | | Compares the specified object with this grid geometry for equality.
|
getDimension | public int getDimension()(Code) | | Returns the number of dimensions.
|
getGridRange | public GridRange getGridRange() throws InvalidGridGeometryException(Code) | | Returns the valid coordinate range of a grid coverage. 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.
The grid range (never null ). throws: InvalidGridGeometryException - if this grid geometry has no grid range (i.e.() returned false ). See Also: GridGeometry2D.getGridRange2D |
getGridToCRS | public MathTransform getGridToCRS() throws InvalidGridGeometryException(Code) | | Returns the transform from grid coordinates to real world earth coordinates.
The transform is often an affine transform. The coordinate reference system of the
real world coordinates is given by
org.opengis.coverage.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.
The transform (never null ). throws: InvalidGridGeometryException - if this grid geometry has no transform (i.e.() returned false ). See Also: GridGeometry2D.getGridToCRS2D since: 2.3 |
getGridToCRS | public MathTransform getGridToCRS(PixelInCell halfPixel) throws InvalidGridGeometryException(Code) | | Returns the transform from grid coordinates to real world earth coordinates.
This is similar to
GeneralGridGeometry.getGridToCRS() except that the transform may maps
other parts than
.
Parameters: halfPixel - The pixel part to map. The transform (never null ). throws: InvalidGridGeometryException - if this grid geometry has no transform (i.e.() returned false ). since: 2.3 |
hashCode | public int hashCode()(Code) | | Returns a hash value for this grid geometry. This value need not remain
consistent between different implementations of the same class.
|
toString | public String toString()(Code) | | Returns a string representation of this grid geometry. The returned string
is implementation dependent. It is usually provided for debugging purposes.
|
|
|