org.geotools.image.io.metadata
Class ImageGeometry

java.lang.Object
  extended by org.geotools.image.io.metadata.MetadataAccessor
      extended by org.geotools.image.io.metadata.ImageGeometry

public class ImageGeometry
extends MetadataAccessor

A combinaison of <Envelope> and <RectifiedGrid> elements in geographic metadata format. This class offers similar service than envelope and grid range, except that the maximum value for coordinate range and grid range are inclusives.

The <GridEnvelope> child element is typically (but not always) initialized to the following ranges:

However n-dimensional grid coverages may contains additional entries.

Since:
2.4
Version:
$Id: ImageGeometry.java 30998 2008-07-10 15:08:09Z cedricbr $
Author:
Martin Desruisseaux, Cédric Briançon

Constructor Summary
protected ImageGeometry(GeographicMetadata metadata)
          Creates a parser for a grid geometry.
 
Method Summary
 void addOffsetVector(double[] values)
          Adds offset vector values for a new dimension.
 void addOrdinates(int minIndex, double[] values)
          Adds ordinate values for an envelope along a dimension.
 int getDimension()
          Returns the number of dimensions.
 NumberRange<java.lang.Integer> getGridRange(int dimension)
          Returns the range of grid index along the specified dimension.
 double[] getOffsetVector(int dimension)
          Returns the offset vector for the specified dimension.
 NumberRange<java.lang.Double> getOrdinateRange(int dimension)
          Returns the range of ordinate values along the specified dimension.
 double[] getOrdinates(int dimension)
          Returns the ordinate values along the specified dimension, or null if none.
 java.lang.String getPixelOrientation()
          Returns the point in a pixel corresponding to the Earth location of the pixel, or null if not defined.
 void setGridRange(int dimension, int minimum, int maximum)
          Set the grid range along the specified dimension.
 void setOffsetVector(int dimension, double[] values)
          Set the offset vector for the specified dimension.
 void setOrdinateRange(int dimension, double minimum, double maximum)
          Set the envelope range along the specified dimension.
 void setOrdinates(int dimension, double[] values)
          Set the ordinate values along the specified dimension.
 void setPixelOrientation(java.lang.String pixelOrientation)
          Set the pixel orientation to the specified value.
 
Methods inherited from class org.geotools.image.io.metadata.MetadataAccessor
appendChild, childCount, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubles, getAttributeAsInteger, getAttributeAsIntegers, getAttributeAsString, getUserObject, getUserObject, selectChild, selectParent, setAttributeAsDate, setAttributeAsDouble, setAttributeAsDoubles, setAttributeAsInteger, setAttributeAsIntegers, setAttributeAsString, setUserObject, setWarningsEnabled, toString, trimFractionalPart, warningOccurred
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageGeometry

protected ImageGeometry(GeographicMetadata metadata)
Creates a parser for a grid geometry. This constructor should not be invoked directly; use GeographicMetadata.getGeometry() instead.

Parameters:
metadata - The metadata node.
Method Detail

getDimension

public int getDimension()
Returns the number of dimensions. If the low array and the cells don't have the same dimension, then a warning is logged and the smallest dimension is returned. If one of them is empty, the dimension of the oter one is then returned.


getGridRange

public NumberRange<java.lang.Integer> getGridRange(int dimension)
Returns the range of grid index along the specified dimension. Note that range minimum value, maximum value or both may be null if no "low" or "high" attribute were found for the "rectifiedGridDomain/limits" element.

Parameters:
dimension - The dimension index, from 0 inclusive to getDimension() exclusive.

setGridRange

public void setGridRange(int dimension,
                         int minimum,
                         int maximum)
Set the grid range along the specified dimension. If the dimension is greater than the current envelope dimension, then this dimension is added.

Parameters:
dimension - The dimension to set. It can eventually be greater than getDimension().
minimum - The minimum value along the specified dimension (inclusive).
maximum - The maximum value along the specified dimension (inclusive).

getOrdinateRange

public NumberRange<java.lang.Double> getOrdinateRange(int dimension)
Returns the range of ordinate values along the specified dimension. Note that range minimum value, maximum value or both may be null if no "lowerCorner" or "upperCorner" attribute were found for the "boundedBy/Envelope" element.

Parameters:
dimension - The dimension index, from 0 inclusive to getDimension() exclusive.

setOrdinateRange

public void setOrdinateRange(int dimension,
                             double minimum,
                             double maximum)
Set the envelope range along the specified dimension. If the dimension is greater than the current envelope dimension, then this dimension is added.

Parameters:
dimension - The dimension to set. It can eventually be greater than getDimension().
minimum - The minimum value along the specified dimension (inclusive).
maximum - The maximum value along the specified dimension (inclusive).

getOrdinates

public double[] getOrdinates(int dimension)
Returns the ordinate values along the specified dimension, or null if none. This method returns a non-null values only if an array of was explicitly specified, for example by a call to setOrdinates(int, double[]).

Parameters:
dimension - The dimension index, from 0 inclusive to getDimension() exclusive.

setOrdinates

public void setOrdinates(int dimension,
                         double[] values)
Set the ordinate values along the specified dimension. The minimum and maximum coordinates will be determined from the specified array.

Parameters:
dimension - The dimension to set, from 0 inclusive to getDimension() exclusive.
values - The coordinate values.

addOrdinates

public void addOrdinates(int minIndex,
                         double[] values)
Adds ordinate values for an envelope along a dimension. Invoking this method will increase the envelope dimension by one. This method may be invoked in replacement of addOffsetVector(double[]) when every cell coordinates need to be specified explicitly.

Parameters:
minIndex - The minimal index value, inclusive. This is usually 0.
values - The coordinate values.
See Also:
addOffsetVector(double[])

getOffsetVector

public double[] getOffsetVector(int dimension)
Returns the offset vector for the specified dimension.

Parameters:
dimension - The dimension index, from 0 inclusive to getDimension() exclusive.

setOffsetVector

public void setOffsetVector(int dimension,
                            double[] values)
Set the offset vector for the specified dimension.

Parameters:
dimension - The dimension to set, from 0 inclusive to getDimension() exclusive.
values - The offset values.

addOffsetVector

public void addOffsetVector(double[] values)
Adds offset vector values for a new dimension.

Parameters:
values - The offset values for this new dimension.

getPixelOrientation

public java.lang.String getPixelOrientation()
Returns the point in a pixel corresponding to the Earth location of the pixel, or null if not defined. In the JAI framework, this is typically the upper left corner. In some OGC specifications, this is often the pixel center.

Parameters:
pixelOrientation - The pixel orientation (usually "center", "lower left", "lower right", "upper right" or "upper left"), or null if unknown.
See Also:
PixelOrientation

setPixelOrientation

public void setPixelOrientation(java.lang.String pixelOrientation)
Set the pixel orientation to the specified value. The pixel orientation gives the point in a pixel corresponding to the Earth location of the pixel. In the JAI framework, this is typically the upper left corner. In some OGC specifications, this is often the pixel center.

Parameters:
pixelOrientation - The pixel orientation (usually "center", "lower left", "lower right", "upper right" or "upper left"), or null if unknown.
See Also:
PixelOrientation


Copyright © 1996-2010 Geotools. All Rights Reserved.