org.geotools.coverage.grid
Class GridEnvelope2D

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.Rectangle
              extended by org.geotools.coverage.grid.GridEnvelope2D
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, org.opengis.coverage.grid.GridEnvelope

public class GridEnvelope2D
extends java.awt.Rectangle
implements org.opengis.coverage.grid.GridEnvelope, org.opengis.util.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
Version:
$Id: GridEnvelope2D.java 30776 2008-06-20 17:00:11Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
GeneralGridEnvelope, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
 
Field Summary
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Fields inherited from class java.awt.geom.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(java.awt.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.
 java.lang.String toString()
          Returns a string représentation of this grid envelope.
 
Methods inherited from class java.awt.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 java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Constructor Detail

GridEnvelope2D

public GridEnvelope2D()
Creates an initially empty grid envelope.


GridEnvelope2D

public GridEnvelope2D(java.awt.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 org.opengis.coverage.grid.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 org.opengis.coverage.grid.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 org.opengis.coverage.grid.GridEnvelope

getLow

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

Specified by:
getLow in interface org.opengis.coverage.grid.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 org.opengis.coverage.grid.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 org.opengis.coverage.grid.GridEnvelope

toString

public java.lang.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 java.awt.Rectangle

clone

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

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


Copyright © 1996-2010 Geotools. All Rights Reserved.