org.geotools.resources.coverage
Class FeatureUtilities

java.lang.Object
  extended by org.geotools.resources.coverage.FeatureUtilities

public final class FeatureUtilities
extends java.lang.Object

A set of utilities methods for interactions between GridCoverage and Feature. Those methods are not really rigorous; must of them should be seen as temporary implementations.

Since:
2.4
Version:
$Id: FeatureUtilities.java 34917 2010-02-18 18:02:26Z aaime $
Author:
Simone Giannecchini

Method Summary
static java.awt.Polygon convertPolygon(com.vividsolutions.jts.geom.Polygon roiInput, org.opengis.referencing.operation.MathTransform worldToGridTransform)
          Converts a JTS Polygon, which represents a ROI, int an AWT Polygon by means of the provided MathTransform.
static java.awt.Polygon convertPolygonToPointArray(com.vividsolutions.jts.geom.Polygon roiInput, org.opengis.referencing.operation.MathTransform worldToGridTransform, java.util.List<java.awt.geom.Point2D> points)
          Converts a JTS Polygon, which represents a ROI, int an AWT Polygon by means of the provided MathTransform.
static boolean isWrappedCoverage(org.opengis.feature.simple.SimpleFeatureType featureType)
          Checks if the feature type specified is a GridCoverage wrapper
static boolean isWrappedCoverageReader(org.opengis.feature.simple.SimpleFeatureType featureType)
          Checks if the feature type specified is a AbstractGridCoverage2DReader wrapper
static FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> wrapGridCoverage(GridCoverage2D coverage)
          Wraps a grid coverage into a Feature.
static FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> wrapGridCoverageReader(AbstractGridCoverage2DReader gridCoverageReader, org.opengis.parameter.GeneralParameterValue[] params)
          Wraps a grid coverage into a Feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrapGridCoverage

public static FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> wrapGridCoverage(GridCoverage2D coverage)
                                                                                                                                 throws org.opengis.referencing.operation.TransformException,
                                                                                                                                        SchemaException
Wraps a grid coverage into a Feature. Code lifted from ArcGridDataSource (temporary).

Parameters:
coverage - the grid coverage.
Returns:
a feature with the grid coverage envelope as the geometry and the grid coverage itself in the "grid" attribute.
Throws:
org.opengis.referencing.operation.TransformException
SchemaException

isWrappedCoverage

public static boolean isWrappedCoverage(org.opengis.feature.simple.SimpleFeatureType featureType)
Checks if the feature type specified is a GridCoverage wrapper

Parameters:
featureType -
Returns:

wrapGridCoverageReader

public static FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> wrapGridCoverageReader(AbstractGridCoverage2DReader gridCoverageReader,
                                                                                                                                              org.opengis.parameter.GeneralParameterValue[] params)
                                                                                                                                       throws org.opengis.referencing.operation.TransformException,
                                                                                                                                              FactoryRegistryException,
                                                                                                                                              SchemaException
Wraps a grid coverage into a Feature. Code lifted from ArcGridDataSource (temporary).

Parameters:
reader - the grid coverage reader.
Returns:
a feature with the grid coverage envelope as the geometry and the grid coverage itself in the "grid" attribute.
Throws:
org.opengis.referencing.operation.TransformException
FactoryRegistryException
SchemaException

isWrappedCoverageReader

public static boolean isWrappedCoverageReader(org.opengis.feature.simple.SimpleFeatureType featureType)
Checks if the feature type specified is a AbstractGridCoverage2DReader wrapper

Parameters:
featureType -
Returns:

convertPolygon

public static java.awt.Polygon convertPolygon(com.vividsolutions.jts.geom.Polygon roiInput,
                                              org.opengis.referencing.operation.MathTransform worldToGridTransform)
                                       throws org.opengis.referencing.operation.TransformException
Converts a JTS Polygon, which represents a ROI, int an AWT Polygon by means of the provided MathTransform.

Parameters:
roiInput - the input ROI as a JTS Polygon.
worldToGridTransform - the MathTransform to apply to the input ROI.
Returns:
an AWT Polygon.
Throws:
org.opengis.referencing.operation.TransformException - in case the provided MathTransform chokes.

convertPolygonToPointArray

public static java.awt.Polygon convertPolygonToPointArray(com.vividsolutions.jts.geom.Polygon roiInput,
                                                          org.opengis.referencing.operation.MathTransform worldToGridTransform,
                                                          java.util.List<java.awt.geom.Point2D> points)
                                                   throws org.opengis.referencing.operation.TransformException
Converts a JTS Polygon, which represents a ROI, int an AWT Polygon by means of the provided MathTransform.

It also stores the points for this polygon into the provided List.

Parameters:
roiInput - the input ROI as a JTS Polygon.
worldToGridTransform - the MathTransform to apply to the input ROI.
points - a List that should hold the transformed points.
Returns:
an AWT Polygon.
Throws:
org.opengis.referencing.operation.TransformException - in case the provided MathTransform chokes.


Copyright © 1996-2010 Geotools. All Rights Reserved.