|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectGeneralGridEnvelope
GeneralGridRange
GeneralGridEnvelope
. Be aware that in the later, high
coordinate values are inclusive rather than exclusive.
@Deprecated public class GeneralGridRange
Defines a range of grid coverage coordinates.
GridRange2D
,
Serialized Form
Constructor Summary | |
---|---|
GeneralGridRange(Envelope envelope)
Deprecated. Replaced by new GeneralGridRange(envelope, PixelInCell.CELL_CORNER) . |
|
GeneralGridRange(Envelope envelope,
PixelInCell anchor)
Deprecated. Casts the specified envelope into a grid range. |
|
GeneralGridRange(int[] lower,
int[] upper)
Deprecated. Constructs a new grid range. |
|
GeneralGridRange(int lower,
int upper)
Deprecated. Constructs one-dimensional grid range. |
|
GeneralGridRange(Raster raster)
Deprecated. Constructs two-dimensional range defined by a Raster . |
|
GeneralGridRange(Raster raster,
int dimension)
Deprecated. Constructs multi-dimensional range defined by a Raster . |
|
GeneralGridRange(Rectangle rect)
Deprecated. Constructs two-dimensional range defined by a Rectangle . |
|
GeneralGridRange(Rectangle rect,
int dimension)
Deprecated. Constructs multi-dimensional range defined by a Rectangle . |
|
GeneralGridRange(RenderedImage image)
Deprecated. Constructs two-dimensional range defined by a RenderedImage . |
|
GeneralGridRange(RenderedImage image,
int dimension)
Deprecated. Constructs multi-dimensional range defined by a RenderedImage . |
Method Summary | |
---|---|
int |
getLength(int dimension)
Deprecated. Returns the number of integer grid coordinates along the specified dimension. |
GridCoordinates |
getLower()
Deprecated. Returns the valid minimum inclusive grid coordinate. |
int |
getLower(int dimension)
Deprecated. Returns the valid minimum inclusive grid coordinate along the specified dimension. |
GeneralGridRange |
getSubGridRange(int lower,
int upper)
Deprecated. Returns a new grid range that encompass only some dimensions of this grid range. |
GridCoordinates |
getUpper()
Deprecated. Returns the valid maximum exclusive grid coordinate. |
int |
getUpper(int dimension)
Deprecated. Returns the valid maximum exclusive grid coordinate along the specified dimension. |
Methods inherited from class GeneralGridEnvelope |
---|
equals, getDimension, getHigh, getHigh, getLow, getLow, getSpan, getSubGridEnvelope, hashCode, toRectangle, toString |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface GridEnvelope |
---|
getDimension, getHigh, getHigh, getLow, getLow, getSpan |
Constructor Detail |
---|
public GeneralGridRange(int lower, int upper)
lower
- The minimal inclusive value.upper
- The maximal exclusive value.public GeneralGridRange(int[] lower, int[] upper)
lower
- The valid minimum inclusive grid coordinate.
The array contains a minimum value for each
dimension of the grid coverage. The lowest
valid grid coordinate is zero.upper
- The valid maximum exclusive grid coordinate.
The array contains a maximum value for each
dimension of the grid coverage.#getLowers
,
#getUppers
public GeneralGridRange(Rectangle rect)
Rectangle
.
public GeneralGridRange(Rectangle rect, int dimension)
Rectangle
.
The two first dimensions are set to the
[x .. x+width] and
[y .. x+height]
ranges respectively. Extra dimensions (if any) are set to the [0..1] range.
rect
- The rectangle.dimension
- Number of dimensions for this grid range. Must be equals or greater than 2.public GeneralGridRange(Raster raster)
Raster
.
public GeneralGridRange(Raster raster, int dimension)
Raster
.
The two first dimensions are set to the
[x .. x+width] and
[y .. x+height]
ranges respectively. Extra dimensions (if any) are set to the [0..1] range.
raster
- The raster.dimension
- Number of dimensions for this grid range. Must be equals or greater than 2.public GeneralGridRange(RenderedImage image)
RenderedImage
.
public GeneralGridRange(RenderedImage image, int dimension)
RenderedImage
.
The two first dimensions are set to the
[x .. x+width] and
[y .. x+height]
ranges respectively. Extra dimensions (if any) are set to the [0..1] range.
image
- The image.dimension
- Number of dimensions for this grid range. Must be equals or greater than 2.@Deprecated public GeneralGridRange(Envelope envelope)
new GeneralGridRange(envelope, PixelInCell.CELL_CORNER)
.
public GeneralGridRange(Envelope envelope, PixelInCell anchor) throws IllegalArgumentException
Note about rounding mode
It would have been possible to round the minimal value
toward floor and the maximal value
toward ceil in order to make sure that the grid range encompass fully
the envelope - like what Java2D does when converting Rectangle2D
to
Rectangle
). But this approach may increase by 1 or 2 units the image
width or height. For
example the range [-0.25 ... 99.75]
(which is exactly 100 units wide) would be casted
to [-1 ... 100]
, which is 101 units wide. This leads to unexpected results when using
grid range with image operations like "Affine
".
For avoiding such changes in size, it is necessary to use the same rounding mode for both
minimal and maximal values. The selected rounding mode is nearest
integer in this implementation.
Grid type
According OpenGIS specification, grid
geometry maps pixel's center. But envelopes typically encompass all pixels. This means
that grid coordinates (0,0) has an envelope starting at (-0.5, -0.5). In order to revert
back such envelope to a grid range, it is necessary to add 0.5 to every coordinates
(including the maximum value since it is exclusive in a grid range). This offset is applied
only if anchor
is PixelInCell.CELL_CENTER
. Users who don't want such
offset should specify PixelInCell.CELL_CORNER
.
The convention is specified as a PixelInCell
code instead than the more detailed
PixelOrientation
because the latter is restricted to
the two-dimensional case while the former can be used for any number of dimensions.
envelope
- The envelope to use for initializing this grid range.anchor
- Whatever envelope coordinates map to pixel center or pixel corner. Should be
PixelInCell.CELL_CENTER
if an offset of 0.5 should be added to every
envelope coordinate values, or PixelInCell.CELL_CORNER
if no offset
should be applied.
IllegalArgumentException
- If anchor
is not valid.org.geotools.referencing.GeneralEnvelope#GeneralEnvelope(GridRange, PixelInCell,
org.opengis.referencing.operation.MathTransform,
org.opengis.referencing.crs.CoordinateReferenceSystem)
Method Detail |
---|
public int getLower(int dimension)
getLower
in interface GridRange
#getLowers
public int getUpper(int dimension)
getUpper
in interface GridRange
#getUppers
public int getLength(int dimension)
getUpper(dimension)-getLower(dimension)
.
getLength
in interface GridRange
public GridCoordinates getLower()
getLower
in interface GridRange
public GridCoordinates getUpper()
getUpper
in interface GridRange
public GeneralGridRange getSubGridRange(int lower, int upper)
lower
and extending to dimension upper-1
.
Thus the dimension of the subgrid range is upper-lower
.
lower
- The first dimension to copy, inclusive.upper
- The last dimension to copy, exclusive.
IndexOutOfBoundsException
- if an index is out of bounds.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |