deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.model.crs
Class GeoTransformer

java.lang.Object
  extended by org.deegree.model.crs.GeoTransformer

public class GeoTransformer
extends Object

class for transforming deegree geometries to new coordinate reference systems.

------------------------------------------------------------

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Andreas Poth, last edited by: $Author: mschneider $

Constructor Summary
GeoTransformer(CoordinateSystem targetCRS)
          Creates a new GeoTransformer object.
GeoTransformer(CoordinateSystem targetCRS)
          Creates a new GeoTransformer object.
GeoTransformer(String targetCRS)
          Creates a new GeoTransformer object, with the given id as the target CRS.
GeoTransformer(Transformation definedTransformation)
           
 
Method Summary
 GridCoverage transform(AbstractGridCoverage coverage, Envelope targetBBOX, int dstWidth, int dstHeight, int refPointsGridSize, int degree, javax.media.jai.Interpolation interpolation)
          transforms a GridCoverage into another coordinate reference system.
 GridCoverage transform(AbstractGridCoverage coverage, int refPointsGridSize, int degree, javax.media.jai.Interpolation interpolation)
          Deprecated. 
 BufferedImage transform(BufferedImage img, Envelope sourceBBOX, Envelope targetBBOX, int dstWidth, int dstHeight, int refPointsGridSize, int degree, javax.media.jai.Interpolation interpolation)
          transforms an image into another coordinate reference system.
 List<javax.vecmath.Point3d> transform(CoordinateSystem sourceCRS, List<javax.vecmath.Point3d> points)
           
 Envelope transform(Envelope envelope, CoordinateSystem sourceCRS)
          Transforms a Envelope to the target crs of the GeoTransformer instance
 Envelope transform(Envelope envelope, CoordinateSystem sourceCRS, boolean regardDistortion)
          Transforms a Envelope to the target crs of the GeoTransformer instance This transformation takes rotation and distortion into account when regardDistortion is true.
 Envelope transform(Envelope envelope, String sourceCRS)
          Transforms a Envelope to the target crs of the GeoTransformer instance
 Envelope transform(Envelope envelope, String sourceCRS, boolean regardDistortion)
          Transforms a Envelope to the target crs of the GeoTransformer instance This transformation takes rotation and distortion into account when regardDistortion is true.
 Feature transform(Feature feature)
          transforms all geometries contained within the passed Feature into the target CRS of a GeoTransformer instance.
 FeatureCollection transform(FeatureCollection fc)
          transforms all geometries contained within the passed FeatureCollection into the target CRS of a GeoTransformer instance.
 Geometry transform(Geometry geo)
          transforms the coordinates of a deegree geometry to the target coordinate reference system.
 Geometry transform(Geometry geo, CoordinateSystem sourceCRS)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeoTransformer

public GeoTransformer(CoordinateSystem targetCRS)
               throws InvalidParameterException
Creates a new GeoTransformer object.

Parameters:
targetCRS -
Throws:
InvalidParameterException - if the given parameter is null.

GeoTransformer

public GeoTransformer(CoordinateSystem targetCRS)
Creates a new GeoTransformer object.

Parameters:
targetCRS -
Throws:
InvalidParameterException - if the given parameter is null.

GeoTransformer

public GeoTransformer(Transformation definedTransformation)
Parameters:
definedTransformation - to use instead of the CRSFactory.

GeoTransformer

public GeoTransformer(String targetCRS)
               throws UnknownCRSException,
                      InvalidParameterException
Creates a new GeoTransformer object, with the given id as the target CRS.

Parameters:
targetCRS - an identifier to which all other CRS's shall be transformed.
Throws:
UnknownCRSException - if the given crs name could not be mapped to a valid (configured) crs.
InvalidParameterException - if the given parameter is null.
Method Detail

transform

public GridCoverage transform(AbstractGridCoverage coverage,
                              Envelope targetBBOX,
                              int dstWidth,
                              int dstHeight,
                              int refPointsGridSize,
                              int degree,
                              javax.media.jai.Interpolation interpolation)
                       throws CRSTransformationException
transforms a GridCoverage into another coordinate reference system.

Parameters:
coverage - grid coverage to definedTransformation
targetBBOX - envelope for the target coverage
dstWidth - width of the output coverage in pixel
dstHeight - height of the output coverage in pixel
refPointsGridSize - size of the grid used to calculate polynoms coefficients. E.g. 2 -≶ 4 points, 3 -≶ 9 points ...
Must be ≶= 2. Accuracy of coefficients increase with size of the grid. Speed decreases with size of the grid.
degree - The degree of the polynomial is supplied as an argument.
interpolation - interpolation method for warping the passed coverage. Can be null. In this case 'Nearest Neighbor' will be used as default
Returns:
a transformed GridCoverage.
Throws:
CRSTransformationException - if the gridCoverage could not be created or the transformation failed

transform

public BufferedImage transform(BufferedImage img,
                               Envelope sourceBBOX,
                               Envelope targetBBOX,
                               int dstWidth,
                               int dstHeight,
                               int refPointsGridSize,
                               int degree,
                               javax.media.jai.Interpolation interpolation)
                        throws CRSTransformationException
transforms an image into another coordinate reference system.

Parameters:
img - the image to definedTransformation
sourceBBOX - envelope of the source image
targetBBOX - envelope for the target image
dstWidth - width of the output image in pixel
dstHeight - height of the output image in pixel
refPointsGridSize - size of the grid used to calculate polynoms coefficients. E.g. 2 -≶ 4 points, 3 -≶ 9 points ...
Must be ≶= 2. Accuracy of coefficients increase with size of the grid. Speed decreases with size of the grid.
degree - The degree of the polynomial is supplied as an argument.
interpolation - interpolation method for warping the passed image. Can be null. In this case 'Nearest Neighbor' will be used as default
Returns:
a transformed image.
Throws:
CRSTransformationException - if the image could not be created or the transformation failed

transform

@Deprecated
public GridCoverage transform(AbstractGridCoverage coverage,
                                         int refPointsGridSize,
                                         int degree,
                                         javax.media.jai.Interpolation interpolation)
                       throws CRSTransformationException
Deprecated. 

transforms a GridCoverage into another coordinate reference system.

Parameters:
coverage - grid coverage to definedTransformation
refPointsGridSize - size of the grid used to calculate polynoms coefficients. E.g. 2 -≶ 4 points, 3 -≶ 9 points ...
Must be ≶= 2. Accuracy of coefficients increase with size of the grid. Speed decreases with size of the grid.
degree - The degree of the polynomial is supplied as an argument.
interpolation - interpolation method for warping the passed coverage. Can be null. In this case 'Nearest Neighbor' will be used as default
Returns:
a transformed GridCoverage.
Throws:
CRSTransformationException - if the gridCoverage could not be created or the transformation failed

transform

public Envelope transform(Envelope envelope,
                          CoordinateSystem sourceCRS)
                   throws CRSTransformationException
Transforms a Envelope to the target crs of the GeoTransformer instance

Parameters:
envelope - to definedTransformation
sourceCRS - CRS of the envelope
Returns:
the transformed envelope
Throws:
CRSTransformationException

transform

public Envelope transform(Envelope envelope,
                          String sourceCRS,
                          boolean regardDistortion)
                   throws CRSTransformationException,
                          UnknownCRSException
Transforms a Envelope to the target crs of the GeoTransformer instance This transformation takes rotation and distortion into account when regardDistortion is true. Otherwise the transformed envelope may not contain the whole input envelope.

Parameters:
envelope - to definedTransformation
sourceCRS - CRS of the envelope
regardDistortion -
Returns:
the transformed envelope
Throws:
CRSTransformationException
UnknownCRSException

transform

public Envelope transform(Envelope envelope,
                          CoordinateSystem sourceCRS,
                          boolean regardDistortion)
                   throws CRSTransformationException
Transforms a Envelope to the target crs of the GeoTransformer instance This transformation takes rotation and distortion into account when regardDistortion is true. Otherwise the transformed envelope may not contain the whole input envelope.

Parameters:
envelope - to definedTransformation
sourceCRS - CRS of the envelope
regardDistortion -
Returns:
the transformed envelope
Throws:
CRSTransformationException

transform

public List<javax.vecmath.Point3d> transform(CoordinateSystem sourceCRS,
                                             List<javax.vecmath.Point3d> points)
                                      throws CRSTransformationException,
                                             IllegalArgumentException
Parameters:
sourceCRS - in which the given points are referenced.
points - to definedTransformation.
Returns:
a list of transformed point3d's or an empty list if something went wrong, never null
Throws:
CRSTransformationException - if no transformation could be created for the given source and target crs.
IllegalArgumentException - if the sourceCRS is null

transform

public Envelope transform(Envelope envelope,
                          String sourceCRS)
                   throws CRSTransformationException,
                          UnknownCRSException
Transforms a Envelope to the target crs of the GeoTransformer instance

Parameters:
envelope - to definedTransformation
sourceCRS - CRS of the envelope
Returns:
the transformed envelope
Throws:
CRSTransformationException - if the transformation did not succeed.
UnknownCRSException - if the given string is unknown to the CRSProvider

transform

public Feature transform(Feature feature)
                  throws CRSTransformationException
transforms all geometries contained within the passed Feature into the target CRS of a GeoTransformer instance. If a geometry was transformed the Feature.setEnvelopesUpdated() method will be called.

Parameters:
feature -
Returns:
the transformed geometries in the given Feature.
Throws:
CRSTransformationException

transform

public FeatureCollection transform(FeatureCollection fc)
                            throws CRSTransformationException
transforms all geometries contained within the passed FeatureCollection into the target CRS of a GeoTransformer instance.

Parameters:
fc - the collection to definedTransformation
Returns:
the transformed geometries in the FeatureCollection
Throws:
CRSTransformationException - if the transformation cannot be created or processed.

transform

public Geometry transform(Geometry geo)
                   throws CRSTransformationException,
                          IllegalArgumentException
transforms the coordinates of a deegree geometry to the target coordinate reference system.

Parameters:
geo - to be transformed
Returns:
the same geometry in a different crs.
Throws:
CRSTransformationException - if the transformation between the source and target crs cannot be created.
IllegalArgumentException - if the coordinates system of the geometry is null

transform

public Geometry transform(Geometry geo,
                          CoordinateSystem sourceCRS)
                   throws CRSTransformationException
Parameters:
geo -
sourceCRS -
Returns:
a transformed geometry
Throws:
CRSTransformationException

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org