org.geotools.coverage.grid
Class GridEnvelope2D

Object
  extended by RectangularShape
      extended by Rectangle2D
          extended by Rectangle
              extended by GridEnvelope2D
All Implemented Interfaces:
Shape, Serializable, Cloneable, GridEnvelope

public class GridEnvelope2D
extends Rectangle
implements GridEnvelope, Cloneable

Defines a range of two-dimensional grid coverage coordinates. This implementation extends Rectangle for interoperability with Java2D. Note that at the opposite of GeneralGridEnvelope, this class is mutable.

CAUTION: ISO 19123 defines high coordinates as inclusive. We follow this specification for all getters methods, but keep in mind that this is the opposite of Java2D usage where Rectangle maximal values are exclusive.

Since:
2.5
Author:
Martin Desruisseaux
See Also:
GeneralGridEnvelope, Serialized Form
Module:
modules/library/coverage (gt-coverage.jar)

Nested Class Summary
 
Nested classes/interfaces inherited from class Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
 
Field Summary
 
Fields inherited from class Rectangle
height, width, x, y
 
Fields inherited from class Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
GridEnvelope2D()
          Creates an initially empty grid envelope.
GridEnvelope2D(int x, int y, int width, int height)
          Creates a grid envelope initialized to the specified rectangle.
GridEnvelope2D(Rectangle rectangle)
          Creates a grid envelope initialized to the specified rectangle.
 
Method Summary
 GridEnvelope2D clone()
          Returns a clone of this grid envelope.
 int getDimension()
          Returns the number of dimensions, which is always 2.
 GridCoordinates2D getHigh()
          Returns the valid maximum inclusive grid coordinates.
 int getHigh(int dimension)
          Returns the valid maximum inclusive grid coordinate along the specified dimension.
 GridCoordinates2D getLow()
          Returns the valid minimum inclusive grid coordinates.
 int getLow(int dimension)
          Returns the valid minimum inclusive grid coordinate along the specified dimension.
 int getSpan(int dimension)
          Returns the number of integer grid coordinates along the specified dimension.
 String toString()
          Returns a string représentation of this grid envelope.
 
Methods inherited from class Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union
 
Methods inherited from class Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class RectangularShape
contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Constructor Detail

GridEnvelope2D

public GridEnvelope2D()
Creates an initially empty grid envelope.


GridEnvelope2D

public GridEnvelope2D(Rectangle rectangle)
Creates a grid envelope initialized to the specified rectangle.

Parameters:
rectangle - The rectangle to use for initializing this grid envelope.

GridEnvelope2D

public GridEnvelope2D(int x,
                      int y,
                      int width,
                      int height)
Creates a grid envelope initialized to the specified rectangle.

Parameters:
x - The minimal x ordinate.
y - The minimal y ordinate.
width - The number of valid ordinates along the x axis.
height - The number of valid ordinates along the y axis.
Method Detail

getDimension

public final int getDimension()
Returns the number of dimensions, which is always 2.

Specified by:
getDimension in interface GridEnvelope

getLow

public GridCoordinates2D getLow()
Returns the valid minimum inclusive grid coordinates. The sequence contains a minimum value for each dimension of the grid coverage.

Specified by:
getLow in interface GridEnvelope

getHigh

public GridCoordinates2D getHigh()
Returns the valid maximum inclusive grid coordinates. The sequence contains a maximum value for each dimension of the grid coverage.

Specified by:
getHigh in interface GridEnvelope

getLow

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

Specified by:
getLow in interface GridEnvelope
See Also:
getLow()

getHigh

public int getHigh(int dimension)
Returns the valid maximum inclusive grid coordinate along the specified dimension.

Specified by:
getHigh in interface GridEnvelope
See Also:
getHigh()

getSpan

public int getSpan(int dimension)
Returns the number of integer grid coordinates along the specified dimension. This is equals to getHigh(dimension) - getLow(dimension).

Specified by:
getSpan in interface GridEnvelope

toString

public String toString()
Returns a string représentation of this grid envelope. The returned string is implementation dependent. It is usually provided for debugging purposes.

Overrides:
toString in class Rectangle

clone

public GridEnvelope2D clone()
Returns a clone of this grid envelope.

Overrides:
clone in class RectangularShape
Returns:
A clone of this grid envelope.


Copyright © 1996-2009 Geotools. All Rights Reserved.