org.geotoolkit.coverage.grid
Class ImageGeometry

Object
  extended by ImageGeometry
All Implemented Interfaces:
Serializable, GridGeometry

@Immutable
public class ImageGeometry
extends Object
implements GridGeometry, Serializable

A simple grid geometry holding the grid envelope as a rectangle and the grid to CRS relationship as an affine transform.

This class does not specify whatever the grid to CRS transform maps pixel center or upper left corner. The OGC convention is to map pixel center, while the Java2D convention is to map pixel corner. It is user responsibility to know the convention in use. For a more powerful class providing support for arbitrary convention, see GridGeometry2D.

This grid geometry does not hold any Coordinate Reference System information. Consequently it is not suitable for usage with GridCoverage2D. This ImageGeometry class is rather designed as a lightweight container for usage with RenderedImage instances.

Since:
2.5
Version:
3.20
Author:
Martin Desruisseaux (Geomatys)
See Also:
GridGeometry2D, GeneralGridGeometry, Serialized Form
Module:
coverage/geotk-coverage (download)    View source code for this class

Constructor Summary
ImageGeometry(Rectangle bounds, AffineTransform gridToCRS)
          Creates a grid geometry from the specified bounds and grid to CRS affine transform.
 
Method Summary
 boolean equals(Object object)
          Compares this grid geometry with the specified one for equality.
 Rectangle2D getEnvelope(PixelOrientation orientation)
          Returns the georeferenced image envelope in "real world" coordinates.
 GridEnvelope2D getExtent()
          Returns the image bounds in pixel coordinates.
 GridEnvelope2D getGridRange()
          Deprecated. Renamed getExtent().
 AffineTransform2D getGridToCRS()
          Returns the conversion from grid coordinates to real world earth coordinates.
 int hashCode()
          Returns a hash code value for this grid geometry.
 String toString()
          Returns a string representation of this grid geometry.
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageGeometry

public ImageGeometry(Rectangle bounds,
                     AffineTransform gridToCRS)
Creates a grid geometry from the specified bounds and grid to CRS affine transform.

Parameters:
bounds - The image bounds in pixel coordinates.
gridToCRS - The affine transform from pixel coordinates to "real world" coordinates.
Method Detail

getExtent

public GridEnvelope2D getExtent()
Returns the image bounds in pixel coordinates.

Specified by:
getExtent in interface GridGeometry
Since:
3.20 (derived from 2.5)

getGridRange

@Deprecated
public GridEnvelope2D getGridRange()
Deprecated. Renamed getExtent().

Specified by:
getGridRange in interface GridGeometry

getGridToCRS

public AffineTransform2D getGridToCRS()
Returns the conversion from grid coordinates to real world earth coordinates.

Specified by:
getGridToCRS in interface GridGeometry

getEnvelope

public Rectangle2D getEnvelope(PixelOrientation orientation)
Returns the georeferenced image envelope in "real world" coordinates. This is the grid extent transformed using the grid to CRS transform. The transform may maps pixel center or a corner, depending on the value of the orientation argument.

According OGC specification, the transform shall maps pixel center. However Java2D usage is to maps the upper-left corner. Because this ImageGeometry class is primarily designed for use with rendered images, this method allows to override the OGC behavior with the Java2D one if needed.

Parameters:
orientation - Whatever the transform maps pixel center or a corner. If this argument is not provided, the default value is CENTER.
Returns:
The image envelope in "real world" coordinates.
Since:
3.00

toString

public String toString()
Returns a string representation of this grid geometry. The returned string is implementation dependent. It is usually provided for debugging purposes.

Overrides:
toString in class Object

hashCode

public int hashCode()
Returns a hash code value for this grid geometry.

Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Compares this grid geometry with the specified one for equality.

Overrides:
equals in class Object
Parameters:
object - The object to compare with.
Returns:
true if the given object is equal to this grid geometry.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.