org.geotools.ct.proj
Class MapProjection

java.lang.Object
  extended byorg.geotools.ct.AbstractMathTransform
      extended byorg.geotools.ct.proj.MapProjection
All Implemented Interfaces:
MathTransform, MathTransform2D, java.io.Serializable
Direct Known Subclasses:
ConicProjection, CylindricalProjection, PlanarProjection

Deprecated. Replaced by MapProjection.

public abstract class MapProjection
extends AbstractMathTransform
implements MathTransform2D, java.io.Serializable

Base class for transformation services between ellipsoidal and cartographic projections. This base class provides the basic feature needed for all methods (no need to overrides methods). Subclasses must "only" implements the following methods:



NOTE:Serialization of this class is appropriate for short-term storage or RMI use, but will probably not be compatible with future version. For long term storage, WKT (Well Know Text) or XML (not yet implemented) are more appropriate.

Version:
$Id: MapProjection.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Andr? Gosselin, Martin Desruisseaux, Rueben Schulz
See Also:
Map projections on MathWorld, Serialized Form

Field Summary
protected  double centralMeridian
          Deprecated. Central longitude in radians.
protected  double e
          Deprecated. Ellipsoid excentricity, equals to sqrt(es).
protected  double es
          Deprecated. The square of excentricity: e? = (a?-b?)/a? where a is the semi major axis length and b is the semi minor axis length.
protected  double falseEasting
          Deprecated. False easting, in metres.
protected  double falseNorthing
          Deprecated. False northing, in metres.
protected  double globalScale
          Deprecated. Global scale factor.
protected  boolean isSpherical
          Deprecated. true if this projection is spherical.
protected  double latitudeOfOrigin
          Deprecated. Latitude of origin in radians.
protected  double scaleFactor
          Deprecated. The scale factor.
protected  double semiMajor
          Deprecated. Length of semi-major axis, in metres.
protected  double semiMinor
          Deprecated. Length of semi-minor axis, in metres.
 
Fields inherited from interface org.geotools.ct.MathTransform2D
IDENTITY
 
Constructor Summary
protected MapProjection(Projection parameters)
          Deprecated. Construct a new map projection from the suplied parameters.
 
Method Summary
 boolean equals(java.lang.Object object)
          Deprecated. Compares the specified object with this map projection for equality.
 int getDimSource()
          Deprecated. Gets the dimension of input points.
 int getDimTarget()
          Deprecated. Gets the dimension of output points.
abstract  java.lang.String getName(java.util.Locale locale)
          Deprecated. Returns a human readable name localized for the specified locale.
 int hashCode()
          Deprecated. Returns a hash value for this map projection.
 MathTransform inverse()
          Deprecated. Returns the inverse of this map projection.
protected abstract  java.awt.geom.Point2D inverseTransformNormalized(double x, double y, java.awt.geom.Point2D ptDst)
          Deprecated. Transforms the specified coordinate and stores the result in ptDst.
 java.lang.String toString()
          Deprecated. Retourne une cha?ne de caract?res repr?sentant cette projection cartographique.
 void transform(double[] src, int srcOffset, double[] dest, int dstOffset, int numPts)
          Deprecated. Transforms a list of coordinate point ordinal values.
 void transform(float[] src, int srcOffset, float[] dest, int dstOffset, int numPts)
          Deprecated. Transforms a list of coordinate point ordinal values.
 java.awt.geom.Point2D transform(java.awt.geom.Point2D ptSrc, java.awt.geom.Point2D ptDst)
          Deprecated. Transforms the specified ptSrc and stores the result in ptDst.
protected abstract  java.awt.geom.Point2D transformNormalized(double x, double y, java.awt.geom.Point2D ptDst)
          Deprecated. Transforms the specified coordinate and stores the result in ptDst.
 
Methods inherited from class org.geotools.ct.AbstractMathTransform
createTransformedShape, derivative, derivative, fromGeoAPI, isIdentity, transform
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.ct.MathTransform2D
createTransformedShape, derivative
 
Methods inherited from interface org.geotools.ct.MathTransform
derivative, isIdentity, transform
 

Field Detail

e

protected final double e
Deprecated. 
Ellipsoid excentricity, equals to sqrt(es). Value 0 means that the ellipsoid is spherical.

See Also:
es, isSpherical

es

protected final double es
Deprecated. 
The square of excentricity: e? = (a?-b?)/a? where a is the semi major axis length and b is the semi minor axis length.

See Also:
e, semiMajor, semiMinor, isSpherical

isSpherical

protected final boolean isSpherical
Deprecated. 
true if this projection is spherical. Spherical model has identical semi major and semi minor axis length, and an excentricity zero.

See Also:
e, semiMajor, semiMinor

semiMajor

protected final double semiMajor
Deprecated. 
Length of semi-major axis, in metres. This is named 'a' or 'R' (Radius in spherical cases) in Snyder.

See Also:
e, semiMinor

semiMinor

protected final double semiMinor
Deprecated. 
Length of semi-minor axis, in metres. This is named 'b' in Snyder.

See Also:
e, semiMajor

centralMeridian

protected final double centralMeridian
Deprecated. 
Central longitude in radians. Default value is 0, the Greenwich meridian. This is called 'lambda0' in Snyder.


latitudeOfOrigin

protected double latitudeOfOrigin
Deprecated. 
Latitude of origin in radians. Default value is 0, the equator. This is called 'phi0' in Snyder. Consider this field as final. It is not final only because some classes need to modify it at construction time.


scaleFactor

protected double scaleFactor
Deprecated. 
The scale factor. Default value is 1. Named 'k' in Snyder. Consider this field as final. It is not final only because some classes need to modify it at construction time.


falseEasting

protected final double falseEasting
Deprecated. 
False easting, in metres. Default value is 0.


falseNorthing

protected final double falseNorthing
Deprecated. 
False northing, in metres. Default value is 0.


globalScale

protected double globalScale
Deprecated. 
Global scale factor. Default value globalScale is equal to semiMajor×scaleFactor. Consider this field as final. It is not final only because some classes need to modify it at construction time.

Constructor Detail

MapProjection

protected MapProjection(Projection parameters)
                 throws MissingParameterException
Deprecated. 
Construct a new map projection from the suplied parameters.

Parameters:
parameters - The parameter values in standard units. The following parameter are recognized:
Throws:
MissingParameterException - if a mandatory parameter is missing.
Method Detail

getName

public abstract java.lang.String getName(java.util.Locale locale)
Deprecated. 
Returns a human readable name localized for the specified locale.

Overrides:
getName in class AbstractMathTransform
Parameters:
locale - The desired locale, or null for a default locale.
Returns:
The transform name localized in the specified locale if possible, or null if no name is available in any locale.

getDimSource

public final int getDimSource()
Deprecated. 
Gets the dimension of input points.

Specified by:
getDimSource in interface MathTransform
See Also:
CT_MathTransform.getDimSource()

getDimTarget

public final int getDimTarget()
Deprecated. 
Gets the dimension of output points.

Specified by:
getDimTarget in interface MathTransform
See Also:
CT_MathTransform.getDimTarget()

inverseTransformNormalized

protected abstract java.awt.geom.Point2D inverseTransformNormalized(double x,
                                                                    double y,
                                                                    java.awt.geom.Point2D ptDst)
                                                             throws ProjectionException
Deprecated. 
Transforms the specified coordinate and stores the result in ptDst. This method returns longitude as x values in the range [-PI..PI] and latitude as y values in the range [-PI/2..PI/2]. It will be checked by the caller, so this method doesn't need to performs this check.

Input coordinates are also guarenteed to have the falseEasting and falseNorthing removed and be divided by globalScale before this method is invoked. After this method is invoked, the centralMeridian is added to the x results in ptDst. This means that projections that implement this method are performed on an ellipse (or sphere) with a semiMajor axis of 1.0.

In PROJ.4, the same standardization, described above, is handled by pj_inv.c. Therefore when porting projections from PROJ.4, the inverse transform equations can be used directly here with minimal change. In the equations of Snyder, falseEasting, falseNorthing and scaleFactor are usually not given. When implementing these equations here, you will not need to add the centralMeridian to the output longitude or remove the semiMajor ('a' or 'R').

Parameters:
x - The easting of the coordinate, linear distance on a unit sphere or ellipse.
y - The northing of the coordinate, linear distance on a unit sphere or ellipse.
ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null. Ordinates will be in radians.
Returns:
the coordinate point after transforming x, y and storing the result in ptDst.
Throws:
ProjectionException - if the point can't be transformed.
To Do:
The ptDst argument will be removed and the return type changed if RFE 4222792 is implemented efficiently in a future J2SE release (maybe J2SE 1.5?).

transformNormalized

protected abstract java.awt.geom.Point2D transformNormalized(double x,
                                                             double y,
                                                             java.awt.geom.Point2D ptDst)
                                                      throws ProjectionException
Deprecated. 
Transforms the specified coordinate and stores the result in ptDst. This method is guaranteed to be invoked with values of x in the range [-PI..PI] and values of y in the range [-PI/2..PI/2].

Coordinates are also guaranteed to have the centralMeridian removed from x before this method is invoked. After this method is invoked, the results in ptDst are multiplied by globalScale, and the falseEasting and falseNorthing are added. This means that projections that implement this method are performed on an ellipse (or sphere) with a semiMajor axis of 1.0.

In PROJ.4, the same standardization, described above, is handled by pj_fwd.c. Therefore when porting projections from PROJ.4, the forward transform equations can be used directly here with minimal change. In the equations of Snyder, falseEasting, falseNorthing and scaleFactor are usually not given. When implementing these equations here, you will not need to remove the centralMeridian from x or apply the semiMajor ('a' or 'R').

Parameters:
x - The longitude of the coordinate, in radians.
y - The latitude of the coordinate, in radians.
ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null. Ordinates will be in a dimensionless unit, as a linear distance on a unit sphere or ellipse.
Returns:
the coordinate point after transforming x, y and storing the result in ptDst.
Throws:
ProjectionException - if the point can't be transformed.
To Do:
The ptDst argument will be removed and the return type changed if RFE 4222792 is implemented efficiently in a future J2SE release (maybe J2SE 1.5?).

transform

public final java.awt.geom.Point2D transform(java.awt.geom.Point2D ptSrc,
                                             java.awt.geom.Point2D ptDst)
                                      throws ProjectionException
Deprecated. 
Transforms the specified ptSrc and stores the result in ptDst.

This method standardizes the source x coordinate by removing the centralMeridian, before invoking transformNormalized(x, y, ptDst). It also multiplies by globalScale and adds the falseEasting and falseNorthing to the point returned by the transformNormalized(...) call.

Specified by:
transform in interface MathTransform2D
Overrides:
transform in class AbstractMathTransform
Parameters:
ptSrc - the specified coordinate point to be transformed. Ordinates must be in degrees.
ptDst - the specified coordinate point that stores the result of transforming ptSrc, or null. Ordinates will be in metres.
Returns:
the coordinate point after transforming ptSrc and storing the result in ptDst.
Throws:
ProjectionException - if the point can't be transformed.
See Also:
MathTransform2D.transform(Point2D,Point2D)

transform

public final void transform(double[] src,
                            int srcOffset,
                            double[] dest,
                            int dstOffset,
                            int numPts)
                     throws ProjectionException
Deprecated. 
Transforms a list of coordinate point ordinal values. Ordinates must be (longitude,latitude) pairs in degrees.

Specified by:
transform in interface MathTransform
Parameters:
src - the array containing the source point coordinates.
srcOffset - the offset to the first point to be transformed in the source array.
dest - the array into which the transformed point coordinates are returned. May be the same than srcPts.
dstOffset - the offset to the location of the first transformed point that is stored in the destination array.
numPts - the number of point objects to be transformed.
Throws:
ProjectionException - if a point can't be transformed. This method try to transform every points even if some of them can't be transformed. Non-transformable points will have value Double.NaN. If more than one point can't be transformed, then this exception may be about an arbitrary point.
See Also:
CT_MathTransform.transformList(double[])

transform

public final void transform(float[] src,
                            int srcOffset,
                            float[] dest,
                            int dstOffset,
                            int numPts)
                     throws ProjectionException
Deprecated. 
Transforms a list of coordinate point ordinal values. Ordinates must be (longitude,latitude) pairs in degrees.

Specified by:
transform in interface MathTransform
Overrides:
transform in class AbstractMathTransform
Throws:
ProjectionException - if a point can't be transformed. This method try to transform every points even if some of them can't be transformed. Non-transformable points will have value Float.NaN. If more than one point can't be transformed, then this exception may be about an arbitrary point.

inverse

public final MathTransform inverse()
Deprecated. 
Returns the inverse of this map projection.

Specified by:
inverse in interface MathTransform
Overrides:
inverse in class AbstractMathTransform

hashCode

public int hashCode()
Deprecated. 
Returns a hash value for this map projection.

Overrides:
hashCode in class AbstractMathTransform

equals

public boolean equals(java.lang.Object object)
Deprecated. 
Compares the specified object with this map projection for equality.

Overrides:
equals in class AbstractMathTransform

toString

public final java.lang.String toString()
Deprecated. 
Retourne une cha?ne de caract?res repr?sentant cette projection cartographique. Cette cha?ne de caract?res contiendra entre autres le nom de la projection, les coordonn?es du centre et celles de l'origine.

Overrides:
toString in class AbstractMathTransform
Task:
REVISIT: part of the implementation is identical to the package-private method AbstractMathTransform.paramMT(String). We should consider moving it in a formatter class, probably close to WKTParser.


Copyright © GeoTools. All Rights Reserved.