|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.coverage.grid.GeneralGridRange
Defines a range of grid coverage coordinates.
Constructor Summary | |
GeneralGridRange(org.opengis.spatialschema.geometry.Envelope envelope)
Cast the specified envelope into a grid range. |
|
GeneralGridRange(int[] lower,
int[] upper)
Constructs a new grid range. |
|
GeneralGridRange(int lower,
int upper)
Constructs one-dimensional grid range. |
|
GeneralGridRange(java.awt.image.Raster raster)
Constructs two-dimensional range defined by a Raster . |
|
GeneralGridRange(java.awt.Rectangle rect)
Constructs two-dimensional range defined by a Rectangle . |
|
GeneralGridRange(java.awt.image.RenderedImage image)
Constructs two-dimensional range defined by a RenderedImage . |
Method Summary | |
boolean |
equals(java.lang.Object object)
Compares the specified object with this grid range for equality. |
int |
getDimension()
Returns the number of dimensions. |
int |
getLength(int dimension)
Returns the number of integer grid coordinates along the specified dimension. |
int |
getLower(int dimension)
Returns the valid minimum inclusive grid coordinate along the specified dimension. |
int[] |
getLowers()
Returns the valid minimum inclusive grid coordinates along all dimensions. |
GeneralGridRange |
getSubGridRange(int lower,
int upper)
Returns a new grid range that encompass only some dimensions of this grid range. |
int |
getUpper(int dimension)
Returns the valid maximum exclusive grid coordinate along the specified dimension. |
int[] |
getUppers()
Returns the valid maximum exclusive grid coordinates along all dimensions. |
int |
hashCode()
Returns a hash value for this grid range. |
java.awt.Rectangle |
toRectangle()
Returns a Rectangle with the same bounds as this .
|
java.lang.String |
toString()
Returns a string repr?sentation of this grid range. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
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(java.awt.Rectangle rect)
Rectangle
.
public GeneralGridRange(java.awt.image.Raster raster)
Raster
.
public GeneralGridRange(java.awt.image.RenderedImage image)
RenderedImage
.
public GeneralGridRange(org.opengis.spatialschema.geometry.Envelope envelope)
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 all
the envelope (something similar to what Java2D does when casting
Rectangle2D
to Rectangle
). But this approach has an undesirable
side effect: it may changes the image width or
height. For example the range
would be casted to , which leads to unexpected result 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.
Method Detail |
public int getDimension()
getDimension
in interface org.opengis.coverage.grid.GridRange
public int getLower(int dimension)
getLower
in interface org.opengis.coverage.grid.GridRange
getLowers()
public int getUpper(int dimension)
getUpper
in interface org.opengis.coverage.grid.GridRange
getUppers()
public int getLength(int dimension)
getLength
in interface org.opengis.coverage.grid.GridRange
public int[] getLowers()
getLowers
in interface org.opengis.coverage.grid.GridRange
public int[] getUppers()
getUppers
in interface org.opengis.coverage.grid.GridRange
public GeneralGridRange getSubGridRange(int lower, int upper)
lower
- The first dimension to copy, inclusive.upper
- The last dimension to copy, exclusive.
java.lang.IndexOutOfBoundsException
- if an index is out of bounds.public java.awt.Rectangle toRectangle() throws java.lang.IllegalStateException
Rectangle
with the same bounds as this .
This is a convenience method for interoperability with Java2D.
java.lang.IllegalStateException
- if this grid range is not two-dimensional.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 |