org.geotools.resources
Class GCSUtilities

java.lang.Object
  extended byorg.geotools.resources.GCSUtilities

public final class GCSUtilities
extends java.lang.Object

A set of utilities methods for the Grid Coverage package. Those methods are not really rigorous; must of them should be seen as temporary implementations.

Since:
2.0
Version:
$Id: GCSUtilities.java 14834 2005-07-20 11:55:24Z desruisseaux $
Author:
Martin Desruisseaux

Method Summary
static int getVisibleBand(java.lang.Object image)
          Returns the visible band in the specified RenderedImage or PropertySource.
static boolean hasGridRange(org.opengis.coverage.grid.GridGeometry geometry)
          Returns if the specified geometry has a valid grid range.
static boolean hasTransform(org.opengis.coverage.grid.GridGeometry geometry)
          Returns if the specified geometry has a valid "grid to coordinate system" transform.
static boolean hasTransform(org.opengis.coverage.SampleDimension[] sampleDimensions)
          Returns if at least one of the specified sample dimensions has a sample to geophysics transform which is not the identity transform.
static org.opengis.spatialschema.geometry.Envelope toEnvelope(org.opengis.coverage.grid.GridRange gridRange)
          Cast the specified grid range into an envelope.
static org.opengis.coverage.grid.GridRange toGridRange(org.opengis.spatialschema.geometry.Envelope envelope)
          Cast the specified envelope into a grid range.
static boolean uses(org.opengis.coverage.grid.GridCoverage coverage, java.awt.image.RenderedImage image)
          Returns if the specified grid coverage or any of its source uses the following image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasGridRange

public static boolean hasGridRange(org.opengis.coverage.grid.GridGeometry geometry)
Returns if the specified geometry has a valid grid range.


hasTransform

public static boolean hasTransform(org.opengis.coverage.grid.GridGeometry geometry)
Returns if the specified geometry has a valid "grid to coordinate system" transform.


toEnvelope

public static org.opengis.spatialschema.geometry.Envelope toEnvelope(org.opengis.coverage.grid.GridRange gridRange)
Cast the specified grid range into an envelope. This is sometime used before to transform the envelope using CTSUtilities.transform(MathTransform, Envelope).


toGridRange

public static org.opengis.coverage.grid.GridRange toGridRange(org.opengis.spatialschema.geometry.Envelope envelope)
Cast the specified envelope into a grid range. This is sometime used after the envelope has been transformed using CTSUtilities.transform(MathTransform, Envelope). The floating point values are rounded toward the nearest integer.

Note about conversion of floating point values to integers:
In previous versions, we used Math.floor(double) and Math.ceil(double) 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 it had the undesirable effect of changing image width. For example the range were changed to , which is not what the Affine operation expects for instance. Rounding to nearest integer produces better results. Note that the rounding mode do not alter the significiance of the "Resample" operation, since this operation will respect the "grid to coordinate system" transform no matter what the grid range is.


hasTransform

public static boolean hasTransform(org.opengis.coverage.SampleDimension[] sampleDimensions)
Returns if at least one of the specified sample dimensions has a sample to geophysics transform which is not the identity transform.


uses

public static boolean uses(org.opengis.coverage.grid.GridCoverage coverage,
                           java.awt.image.RenderedImage image)
Returns if the specified grid coverage or any of its source uses the following image.


getVisibleBand

public static int getVisibleBand(java.lang.Object image)
Returns the visible band in the specified RenderedImage or PropertySource. This method fetch the property. If this property is undefined, then the visible band default to the first one.

Parameters:
image - The image for which to fetch the visible band, or .
Returns:
The visible band.


Copyright © GeoTools. All Rights Reserved.