org.geotools.coverage.grid
Class GeneralGridRange

Object
  extended by GeneralGridEnvelope
      extended by GeneralGridRange
All Implemented Interfaces:
Serializable, GridEnvelope, GridRange

Deprecated. Replaced by GeneralGridEnvelope. Be aware that in the later, high coordinate values are inclusive rather than exclusive.

@Deprecated
public class GeneralGridRange
extends GeneralGridEnvelope
implements GridRange

Defines a range of grid coverage coordinates.

Since:
2.1
Author:
Martin Desruisseaux (IRD)
See Also:
GridRange2D, Serialized Form
Module:

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

GeneralGridRange

public GeneralGridRange(int lower,
                        int upper)
Deprecated. 
Constructs one-dimensional grid range.

Parameters:
lower - The minimal inclusive value.
upper - The maximal exclusive value.

GeneralGridRange

public GeneralGridRange(int[] lower,
                        int[] upper)
Deprecated. 
Constructs a new grid range.

Parameters:
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.
See Also:
#getLowers, #getUppers

GeneralGridRange

public GeneralGridRange(Rectangle rect)
Deprecated. 
Constructs two-dimensional range defined by a Rectangle.


GeneralGridRange

public GeneralGridRange(Rectangle rect,
                        int dimension)
Deprecated. 
Constructs multi-dimensional range defined by a 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.

Parameters:
rect - The rectangle.
dimension - Number of dimensions for this grid range. Must be equals or greater than 2.
Since:
2.5

GeneralGridRange

public GeneralGridRange(Raster raster)
Deprecated. 
Constructs two-dimensional range defined by a Raster.


GeneralGridRange

public GeneralGridRange(Raster raster,
                        int dimension)
Deprecated. 
Constructs multi-dimensional range defined by a 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.

Parameters:
raster - The raster.
dimension - Number of dimensions for this grid range. Must be equals or greater than 2.
Since:
2.5

GeneralGridRange

public GeneralGridRange(RenderedImage image)
Deprecated. 
Constructs two-dimensional range defined by a RenderedImage.


GeneralGridRange

public GeneralGridRange(RenderedImage image,
                        int dimension)
Deprecated. 
Constructs multi-dimensional range defined by a 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.

Parameters:
image - The image.
dimension - Number of dimensions for this grid range. Must be equals or greater than 2.
Since:
2.5

GeneralGridRange

@Deprecated
public GeneralGridRange(Envelope envelope)
Deprecated. Replaced by new GeneralGridRange(envelope, PixelInCell.CELL_CORNER).

Since:
2.2

GeneralGridRange

public GeneralGridRange(Envelope envelope,
                        PixelInCell anchor)
                 throws IllegalArgumentException
Deprecated. 
Casts the specified envelope into a grid range. This is sometime useful after an envelope has been transformed from "real world" coordinates to grid coordinates using the grid to CRS transform. The floating point values are rounded toward the nearest integers.

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.

Parameters:
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.
Throws:
IllegalArgumentException - If anchor is not valid.
Since:
2.5
See Also:
org.geotools.referencing.GeneralEnvelope#GeneralEnvelope(GridRange, PixelInCell, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.crs.CoordinateReferenceSystem)
Method Detail

getLower

public int getLower(int dimension)
Deprecated. 
Returns the valid minimum inclusive grid coordinate along the specified dimension.

Specified by:
getLower in interface GridRange
See Also:
#getLowers

getUpper

public int getUpper(int dimension)
Deprecated. 
Returns the valid maximum exclusive grid coordinate along the specified dimension.

Specified by:
getUpper in interface GridRange
See Also:
#getUppers

getLength

public int getLength(int dimension)
Deprecated. 
Returns the number of integer grid coordinates along the specified dimension. This is equals to getUpper(dimension)-getLower(dimension).

Specified by:
getLength in interface GridRange

getLower

public GridCoordinates getLower()
Deprecated. 
Returns the valid minimum inclusive grid coordinate. The sequence contains a minimum value for each dimension of the grid coverage.

Specified by:
getLower in interface GridRange
Since:
2.4

getUpper

public GridCoordinates getUpper()
Deprecated. 
Returns the valid maximum exclusive grid coordinate. The sequence contains a maximum value for each dimension of the grid coverage.

Specified by:
getUpper in interface GridRange
Since:
2.4

getSubGridRange

public GeneralGridRange getSubGridRange(int lower,
                                        int upper)
Deprecated. 
Returns a new grid range that encompass only some dimensions of this grid range. This method copy this grid range's index into a new grid range, beginning at dimension lower and extending to dimension upper-1. Thus the dimension of the subgrid range is upper-lower.

Parameters:
lower - The first dimension to copy, inclusive.
upper - The last dimension to copy, exclusive.
Returns:
The subgrid range.
Throws:
IndexOutOfBoundsException - if an index is out of bounds.


Copyright © 1996-2009 Geotools. All Rights Reserved.