|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.coverage.grid.GeneralGridGeometry
Describes the valid range of grid coordinates and the math transform to transform 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 range 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)
.
Field Summary | |
static int |
CRS
A bitmask to specify the validity of the coordinate reference system. |
static int |
ENVELOPE
A bitmask to specify the validity of the envelope. |
static int |
GRID_RANGE
A bitmask to specify the validity of the grid range. |
static int |
GRID_TO_CRS
A bitmask to specify the validity of the grid to CRS transform. |
protected org.opengis.coverage.grid.GridRange |
gridRange
The valid coordinate range of a grid coverage, or if none. |
protected org.opengis.referencing.operation.MathTransform |
gridToCRS
The math transform (usually an affine transform), or if none. |
Constructor Summary | |
GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange,
org.opengis.spatialschema.geometry.Envelope userRange)
Constructs a new grid geometry from an envelope. |
|
GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange,
org.opengis.spatialschema.geometry.Envelope userRange,
boolean[] reverse)
Deprecated. Replaced by . Users just need to append the argument value, so this constructor will be removed in a future version in order to keep the API lighter. |
|
GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange,
org.opengis.spatialschema.geometry.Envelope userRange,
boolean[] reverse,
boolean swapXY)
Constructs a new grid geometry from an envelope. |
|
GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange,
org.opengis.referencing.operation.MathTransform gridToCRS)
Deprecated. Replaced by GeneralGridGeometry(gridRange, gridToCRS, null) . |
|
GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange,
org.opengis.referencing.operation.MathTransform gridToCRS,
org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Constructs a new grid geometry from a math transform. |
Method Summary | |
boolean |
equals(java.lang.Object object)
Compares the specified object with this grid geometry for equality. |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the "real world" coordinate reference system. |
int |
getDimension()
Returns the number of dimensions. |
org.opengis.spatialschema.geometry.Envelope |
getEnvelope()
Returns the bounding box of "real world" coordinates for this grid geometry. |
org.opengis.coverage.grid.GridRange |
getGridRange()
Returns the valid coordinate range of a grid coverage. |
org.opengis.referencing.operation.MathTransform |
getGridToCoordinateSystem()
Returns the math transform which allows for the transformations from grid coordinates to real world earth coordinates. |
int |
hashCode()
Returns a hash value for this grid geometry. |
boolean |
isDefined(int bitmask)
Returns if all the parameters specified by the argument are set. |
java.lang.String |
toString()
Returns a string repr?sentation of this grid geometry. |
Methods inherited from class java.lang.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 GRID_RANGE
isDefined(int)
method.
public static final int GRID_TO_CRS
isDefined(int)
method.
protected final org.opengis.coverage.grid.GridRange gridRange
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.
RenderedImage.getMinX()
,
RenderedImage.getMinY()
,
RenderedImage.getWidth()
,
RenderedImage.getHeight()
protected final org.opengis.referencing.operation.MathTransform gridToCRS
gridToCRS.transform(pixels, point);
Constructor Detail |
public GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange, org.opengis.referencing.operation.MathTransform gridToCRS)
GeneralGridGeometry(gridRange, gridToCRS, null)
.
gridRange
- The valid coordinate range of a grid coverage, or if none.gridToCRS
- The math transform which allows for the transformations from grid
coordinates (pixel's center) to real world earth coordinates.public GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange, org.opengis.referencing.operation.MathTransform gridToCRS, org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws org.opengis.spatialschema.geometry.MismatchedDimensionException, java.lang.IllegalArgumentException
gridRange
- The valid coordinate range of a grid coverage, or if none.gridToCRS
- The math transform which allows for the transformations from
grid coordinates (pixel's center) to real world earth coordinates.
May be (but this is not recommanded).crs
- The coordinate reference system for the "real world" coordinates, or
if unknown. This CRS is given to the envelope.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the math transform or the CRS doesn't have
consistent dimensions.
java.lang.IllegalArgumentException
- if the math transform can't transform coordinates
in the domain of the specified grid range.public GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange, org.opengis.spatialschema.geometry.Envelope userRange) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
This convenience constructor assumes that axis order in the supplied argument matches exactly axis order in the supplied argument. In other words, if axis order in the underlying image is (column, row) (which is the case for a majority of images), then the envelope given to this constructor should probably have a (longitude, latitude) or (easting, northing) axis order.
An exception to the above rule applies for CRS using exactly the following axis order:
(NORTH
|SOUTH
,
EAST
|WEST
).
An example of such CRS is . This convenience constructor will
interchange automatically the (y,x) axis for such CRS.
gridRange
- The valid coordinate range of a grid coverage.userRange
- The corresponding coordinate range in user coordinate. 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.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the grid range and the CRS doesn't have
consistent dimensions.public GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange, org.opengis.spatialschema.geometry.Envelope userRange, boolean[] reverse)
public GeneralGridGeometry(org.opengis.coverage.grid.GridRange gridRange, org.opengis.spatialschema.geometry.Envelope userRange, boolean[] reverse, boolean swapXY) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
This constructor is convenient when the following conditions are meet:
Pixels coordinates (usually (x,y) integer values inside
the rectangle specified by the argument) are expressed in some
coordinate reference system known at compile
time. This is often the case; for example the CRS attached to BufferedImage
has always (column,
row) axis, with the origin (0,0) in the upper
left corner, and row values increasing down.
"Real world" coordinates (inside the envelope specified by the argument) are expressed in arbitrary horizontal coordinate reference system. Axis directions may be (North, West), or (East, North), etc..
In such case (and assuming that the image's CRS has the same characteristics than the
BufferedImage
's CRS described above):
shall be set to if the "real world" axis order is (North, East) instead of (East, North). This axis swapping is necessary for mapping the (column, row) axis order associated to the image CRS.
In addition, the "real world" axis directions shall be reversed (by setting
to ) if their direction is
WEST
(x axis) or
NORTH
(y axis), in order to get them oriented
toward the EAST
or SOUTH
direction respectively. The later may seems unatural, but it reflects the fact
that row values are increasing down in an BufferedImage
's CRS.
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 constructor expecting a math transform argument.
gridRange
- The valid coordinate range of a grid coverage.userRange
- The corresponding coordinate range in user coordinate. This envelope must
contains entirely all pixels, i.e. the envelope's upper left corner must
coincide with the upper left corner of the first pixel and the envelope's
lower right corner must coincide with the lower right corner of the last
pixel.reverse
- Tells for each axis in user space whatever or not its direction
should be reversed. A value reverse no axis. Callers will
typically set to in order to reverse the
y axis direction.swapXY
- If , then the two first axis will be interchanged. Callers will
typically set this argument to when the geographic coordinate
system has axis in the (y,x) order. The
parameter then apply to axis after the swap.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the grid range and the CRS doesn't have
consistent dimensions.Method Detail |
public int getDimension()
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem() throws InvalidGridGeometryException
InvalidGridGeometryException
- if this grid geometry has no CRS (i.e.
isDefined(CRS)
returned ).GridGeometry2D.getCoordinateReferenceSystem2D()
public org.opengis.spatialschema.geometry.Envelope getEnvelope() throws InvalidGridGeometryException
InvalidGridGeometryException
- if this grid geometry has no envelope (i.e.
isDefined(ENVELOPE)
returned ).GridGeometry2D.getEnvelope2D()
public org.opengis.coverage.grid.GridRange getGridRange() 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.
getGridRange
in interface org.opengis.coverage.grid.GridGeometry
InvalidGridGeometryException
- if this grid geometry has no grid range (i.e.
isDefined(GRID_RANGE)
returned ).GridGeometry2D.getGridRange2D()
public org.opengis.referencing.operation.MathTransform getGridToCoordinateSystem() 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.
getGridToCoordinateSystem
in interface org.opengis.coverage.grid.GridGeometry
InvalidGridGeometryException
- if this grid geometry has no transform (i.e.
isDefined(GRID_TO_CRS)
returned ).GridGeometry2D.getGridToCoordinateSystem2D()
public boolean isDefined(int bitmask) throws java.lang.IllegalArgumentException
bitmask
- Any combinaison of CRS
, ENVELOPE
, GRID_RANGE
and GRID_TO_CRS
.
InvalidGridGeometryException
).
java.lang.IllegalArgumentException
- if the specified bitmask is not a combinaison of known
masks.public int hashCode()
public boolean equals(java.lang.Object object)
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |