org.deegree.cs.projections
Class Projection

java.lang.Object
  extended by org.deegree.cs.CRSIdentifiable
      extended by org.deegree.cs.projections.Projection
All Implemented Interfaces:
Object, TypedObjectNode, CRSResource, IProjection
Direct Known Subclasses:
AzimuthalProjection, ConicProjection, CylindricalProjection

public abstract class Projection
extends CRSIdentifiable
implements IProjection

Map conversion is the process of changing the map grid coordinates (usually, but not always, Easting & Northing) of a Projected Coordinate Reference System to its corresponding geographical coordinates (Latitude & Longitude) or vice versa.

A projection is conformal if an infinitesimal small perfect circle on the earth's surface results in an infinitesimal small projected perfect circle (an ellipsoid with no eccentricity). In other words, the relative local angles about every point on the map are shown correctly.

An equal area projection can be best explained with a coin (Snyder), a coin (of any size) covers exactly the same area of the actual earth as the same coin on any other part of the map. This can only be done by distorting shape, scale and and angles of the original earth's layout.

Version:
$Revision: 29642 $, $Date: 2011-02-11 13:59:33 +0100 (Fri, 11 Feb 2011) $
Author:
Rutger Bezema, last edited by: $Author: lbuesching $

Constructor Summary
Projection(double falseNorthing, double falseEasting, javax.vecmath.Point2d naturalOrigin, IUnit units, double scale, boolean conformal, boolean equalArea, CRSResource id)
          Creates a Projection.
 
Method Summary
abstract  javax.vecmath.Point2d doInverseProjection(IGeographicCRS underlyingCRS, double x, double y)
          Do an inverse projection from projected (map) coordinates to geographic coordinates.
abstract  javax.vecmath.Point2d doProjection(IGeographicCRS underlyingCRS, double lambda, double phi)
          The actual transform method doing a projection from geographic coordinates to map coordinates.
 boolean equals(Object other)
           
 double getCosphi0()
           
 double getEccentricity(IGeographicCRS geographicCRS)
           
 IEllipsoid getEllipsoid(IGeographicCRS geographicCRS)
           
 double getFalseEasting()
           
 double getFalseNorthing()
           
abstract  String getImplementationName()
           
 javax.vecmath.Point2d getNaturalOrigin()
           
 IPrimeMeridian getPrimeMeridian(IGeographicCRS geographicCRS)
           
 double getProjectionLatitude()
           
 double getProjectionLongitude()
           
 double getScale()
           
 double getScaleFactor(IGeographicCRS geographicCRS)
           
 double getSemiMajorAxis(IGeographicCRS geographicCRS)
           
 double getSemiMinorAxis(IGeographicCRS geographicCRS)
           
 double getSinphi0()
           
 double getSquaredEccentricity(IGeographicCRS geographicCRS)
           
 IUnit getUnits()
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
 boolean isConformal()
           
 boolean isEqualArea()
           
 boolean isSpherical(IGeographicCRS geographicCRS)
           
 void setFalseEasting(double newFalseEasting)
          sets the false easting to given value.
 void setScale(double scale)
          Sets the old scale to the given scale, also adjusts the scaleFactor.
 String toString()
           
 
Methods inherited from class org.deegree.cs.CRSIdentifiable
addAreaOfUse, addName, checkForNullObject, checkForNullObject, checkForNullObject, getAreaOfUse, getAreaOfUseBBox, getAreasOfUse, getCode, getCodeAndName, getCodes, getDescription, getDescriptions, getId, getName, getNames, getOrignalCodeStrings, getVersion, getVersions, hasCode, hasId, hasIdOrName, setDefaultAreaOfUse, setDefaultDescription, setDefaultId, setDefaultName, setDefaultVersion
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.deegree.cs.CRSResource
addAreaOfUse, addName, getAreaOfUse, getAreaOfUseBBox, getAreasOfUse, getCode, getCodeAndName, getCodes, getDescription, getDescriptions, getName, getNames, getOrignalCodeStrings, getVersion, getVersions, hasCode, hasId, hasIdOrName, setDefaultAreaOfUse, setDefaultDescription, setDefaultId, setDefaultName, setDefaultVersion
 
Methods inherited from interface org.deegree.commons.tom.Object
getId
 

Constructor Detail

Projection

public Projection(double falseNorthing,
                  double falseEasting,
                  javax.vecmath.Point2d naturalOrigin,
                  IUnit units,
                  double scale,
                  boolean conformal,
                  boolean equalArea,
                  CRSResource id)
Creates a Projection. Caution, the given natural origin should be given in radians rather then degrees.

Parameters:
geographicCRS - which this projection uses.
falseNorthing - in given units
falseEasting - in given units
naturalOrigin - in radians longitude, latitude.
units - of the map projection
scale - at the prime meridian (e.g. 0.9996 for UTM)
conformal - if the projection is conformal
equalArea - if the projection result in an equal area map
id - an identifiable instance containing information about this projection.
Method Detail

doProjection

public abstract javax.vecmath.Point2d doProjection(IGeographicCRS underlyingCRS,
                                                   double lambda,
                                                   double phi)
                                            throws ProjectionException
The actual transform method doing a projection from geographic coordinates to map coordinates.

Specified by:
doProjection in interface IProjection
Parameters:
lambda - the longitude
phi - the latitude
Returns:
the projected Point or Point(Double.NAN, Double.NAN) if an error occurred.
Throws:
ProjectionException - if the given lamba and phi coordinates could not be projected to x and y.

doInverseProjection

public abstract javax.vecmath.Point2d doInverseProjection(IGeographicCRS underlyingCRS,
                                                          double x,
                                                          double y)
                                                   throws ProjectionException
Do an inverse projection from projected (map) coordinates to geographic coordinates.

Specified by:
doInverseProjection in interface IProjection
Parameters:
x - coordinate on the map
y - coordinate on the map
Returns:
the projected Point with x = lambda and y = phi;
Throws:
ProjectionException - if the given x and y coordinates could not be inverted to lambda and phi.

getImplementationName

public abstract String getImplementationName()
Specified by:
getImplementationName in interface IProjection
Returns:
A deegree specific name which will be used for the export of a projection.

isConformal

public final boolean isConformal()
Specified by:
isConformal in interface IProjection
Returns:
true if the projection projects conformal.

isEqualArea

public final boolean isEqualArea()
Specified by:
isEqualArea in interface IProjection
Returns:
true if the projection is projects equal Area.

getScale

public final double getScale()
Specified by:
getScale in interface IProjection
Returns:
the scale.

setScale

public void setScale(double scale)
Sets the old scale to the given scale, also adjusts the scaleFactor.

Specified by:
setScale in interface IProjection
Parameters:
scale - the new scale

getFalseEasting

public final double getFalseEasting()
Specified by:
getFalseEasting in interface IProjection
Returns:
the falseEasting.

setFalseEasting

public void setFalseEasting(double newFalseEasting)
sets the false easting to given value. (Used in for example transverse mercator, while setting the utm zone).

Specified by:
setFalseEasting in interface IProjection
Parameters:
newFalseEasting - the new false easting parameter.

getFalseNorthing

public final double getFalseNorthing()
Specified by:
getFalseNorthing in interface IProjection
Returns:
the falseNorthing.

getNaturalOrigin

public final javax.vecmath.Point2d getNaturalOrigin()
Specified by:
getNaturalOrigin in interface IProjection
Returns:
the naturalOrigin.

getUnits

public final IUnit getUnits()
Specified by:
getUnits in interface IProjection
Returns:
the units.

getPrimeMeridian

public IPrimeMeridian getPrimeMeridian(IGeographicCRS geographicCRS)
Specified by:
getPrimeMeridian in interface IProjection
Returns:
the primeMeridian of the datum.

getEllipsoid

public IEllipsoid getEllipsoid(IGeographicCRS geographicCRS)
Specified by:
getEllipsoid in interface IProjection
Returns:
the ellipsoid of the datum.

getEccentricity

public final double getEccentricity(IGeographicCRS geographicCRS)
Specified by:
getEccentricity in interface IProjection
Returns:
the eccentricity of the ellipsoid of the datum.

getSquaredEccentricity

public final double getSquaredEccentricity(IGeographicCRS geographicCRS)
Specified by:
getSquaredEccentricity in interface IProjection
Returns:
the eccentricity of the ellipsoid of the datum.

getSemiMajorAxis

public final double getSemiMajorAxis(IGeographicCRS geographicCRS)
Specified by:
getSemiMajorAxis in interface IProjection
Returns:
the semiMajorAxis (a) of the ellipsoid of the datum.

getSemiMinorAxis

public final double getSemiMinorAxis(IGeographicCRS geographicCRS)
Specified by:
getSemiMinorAxis in interface IProjection
Returns:
the semiMinorAxis (a) of the ellipsoid of the datum.

getProjectionLatitude

public final double getProjectionLatitude()
Specified by:
getProjectionLatitude in interface IProjection
Returns:
the projectionLatitude also known as central-latitude or latitude-of-origin, in Snyder referenced as phi_1 for azimuthal, phi_0 for other projections.

getProjectionLongitude

public final double getProjectionLongitude()
Specified by:
getProjectionLongitude in interface IProjection
Returns:
the projectionLongitude also known as projection-meridian or central-meridian, in Snyder referenced as lambda_0

getSinphi0

public final double getSinphi0()
Specified by:
getSinphi0 in interface IProjection
Returns:
the sinphi0, the sine of the projection latitude

getCosphi0

public final double getCosphi0()
Specified by:
getCosphi0 in interface IProjection
Returns:
the cosphi0, the cosine of the projection latitude

getScaleFactor

public double getScaleFactor(IGeographicCRS geographicCRS)
Specified by:
getScaleFactor in interface IProjection
Returns:
the scale*semimajor-axis, often revered to as R*k_0 in Snyder.

isSpherical

public boolean isSpherical(IGeographicCRS geographicCRS)
Specified by:
isSpherical in interface IProjection
Returns:
true if the ellipsoid of the datum is a sphere and not an ellipse.

equals

public boolean equals(Object other)
Overrides:
equals in class CRSIdentifiable

toString

public String toString()
Overrides:
toString in class CRSIdentifiable

hashCode

public int hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. It is created from field f as follows:

Combining the hash code(s) computed above: result = 37 * result + code;

Overrides:
hashCode in class CRSIdentifiable
Returns:
(int) ( result >>> 32 ) ^ (int) result;
See Also:
Object.hashCode()


Copyright © 2011. All Rights Reserved.