ucar.unidata.geoloc.projection.proj4
Class AlbersEqualAreaEllipse

java.lang.Object
  extended by ucar.unidata.geoloc.ProjectionImpl
      extended by ucar.unidata.geoloc.projection.proj4.AlbersEqualAreaEllipse
All Implemented Interfaces:
Serializable, Cloneable, Projection

public class AlbersEqualAreaEllipse
extends ProjectionImpl

Adapted from com.jhlabs.map.proj.AlbersProjection

Since:
Oct 8, 2009
Author:
caron
See Also:
"http://www.jhlabs.com/java/maps/proj/index.html", "http://trac.osgeo.org/proj/", Serialized Form

Field Summary
 
Fields inherited from class ucar.unidata.geoloc.ProjectionImpl
ATTR_NAME, atts, defaultMapArea, EARTH_RADIUS, INDEX_LAT, INDEX_LON, INDEX_X, INDEX_Y, isLatLon, name, PI, PI_OVER_2, PI_OVER_4, TOLERANCE
 
Constructor Summary
AlbersEqualAreaEllipse()
          Constructor with default parameters
AlbersEqualAreaEllipse(double lat0, double lon0, double par1, double par2, double falseEasting, double falseNorthing, Earth earth)
          Construct a AlbersEqualAreaEllipse Projection, two standard parellels.
 
Method Summary
 Object clone()
          Clone this projection.
 ProjectionImpl constructCopy()
          copy constructor - avoid clone !!
 boolean crossSeam(ProjectionPoint pt1, ProjectionPoint pt2)
          This returns true when the line between pt1 and pt2 crosses the seam.
 boolean equals(Object proj)
          Check for equality with the Object in question
 Earth getEarth()
           
 double getFalseEasting()
          Get the false easting, in km.
 double getFalseNorthing()
          Get the false northing, in km.
 double getOriginLat()
          Get the origin latitude.
 double getOriginLon()
          Get the origin longitude.
 double getParallelOne()
          Get the first standard parallel
 double getParallelTwo()
          Get the second standard parallel
 String getProjectionTypeLabel()
          Get the label to be used in the gui for this type of projection
 ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl result)
          Convert a LatLonPoint to projection coordinates
static void main(String[] args)
           
 String paramsToString()
          Create a String of the parameters.
 LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result)
          Convert projection coordinates to a LatLonPoint Note: a new object is not created on each call for the return value.
 
Methods inherited from class ucar.unidata.geoloc.ProjectionImpl
addParameter, addParameter, addParameter, getClassName, getDefaultMapArea, getDefaultMapAreaLL, getHeader, getLatLonBoundingBox, getName, getProjectionParameters, isLatLon, latLonToProj, latLonToProj, latLonToProj, latLonToProj, latLonToProj, latLonToProj, latLonToProj, latLonToProj, latLonToProj, latLonToProj, latLonToProjBB, projToLatLon, projToLatLon, projToLatLon, projToLatLon, projToLatLon, projToLatLon, projToLatLonBB, setDefaultMapArea, setName, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlbersEqualAreaEllipse

public AlbersEqualAreaEllipse()
Constructor with default parameters


AlbersEqualAreaEllipse

public AlbersEqualAreaEllipse(double lat0,
                              double lon0,
                              double par1,
                              double par2,
                              double falseEasting,
                              double falseNorthing,
                              Earth earth)
Construct a AlbersEqualAreaEllipse Projection, two standard parellels. For the one standard parellel case, set them both to the same value.

Parameters:
lat0 - lat origin of the coord. system on the projection plane
lon0 - lon origin of the coord. system on the projection plane
par1 - standard parallel 1
par2 - standard parallel 2
falseEasting - false easting in km
falseNorthing - false easting in km
earth - shape of the earth
Throws:
IllegalArgumentException - if Math.abs(par1 + par2) < 1.e-10
Method Detail

constructCopy

public ProjectionImpl constructCopy()
copy constructor - avoid clone !!

Specified by:
constructCopy in class ProjectionImpl
Returns:
a copy of this Projection

clone

public Object clone()
Clone this projection.

Overrides:
clone in class ProjectionImpl
Returns:
Clone of this

equals

public boolean equals(Object proj)
Check for equality with the Object in question

Specified by:
equals in interface Projection
Specified by:
equals in class ProjectionImpl
Parameters:
proj - object to check
Returns:
true if they are equal

getEarth

public Earth getEarth()

getParallelTwo

public double getParallelTwo()
Get the second standard parallel

Returns:
the second standard parallel in degrees

getParallelOne

public double getParallelOne()
Get the first standard parallel

Returns:
the first standard parallel in degrees

getOriginLon

public double getOriginLon()
Get the origin longitude.

Returns:
the origin longitude in degrees

getOriginLat

public double getOriginLat()
Get the origin latitude.

Returns:
the origin latitude in degrees

getFalseEasting

public double getFalseEasting()
Get the false easting, in km.

Returns:
the false easting in km

getFalseNorthing

public double getFalseNorthing()
Get the false northing, in km.

Returns:
the false northing in km

getProjectionTypeLabel

public String getProjectionTypeLabel()
Get the label to be used in the gui for this type of projection

Overrides:
getProjectionTypeLabel in class ProjectionImpl
Returns:
Type label

paramsToString

public String paramsToString()
Create a String of the parameters.

Specified by:
paramsToString in interface Projection
Specified by:
paramsToString in class ProjectionImpl
Returns:
a String of the parameters

crossSeam

public boolean crossSeam(ProjectionPoint pt1,
                         ProjectionPoint pt2)
This returns true when the line between pt1 and pt2 crosses the seam. When the cone is flattened, the "seam" is lon0 +- 180.

Specified by:
crossSeam in interface Projection
Specified by:
crossSeam in class ProjectionImpl
Parameters:
pt1 - point 1
pt2 - point 2
Returns:
true when the line between pt1 and pt2 crosses the seam.

latLonToProj

public ProjectionPoint latLonToProj(LatLonPoint latLon,
                                    ProjectionPointImpl result)
Description copied from class: ProjectionImpl
Convert a LatLonPoint to projection coordinates

Specified by:
latLonToProj in interface Projection
Specified by:
latLonToProj in class ProjectionImpl
Parameters:
latLon - convert from these lat, lon coordinates
result - the object to write to
Returns:
the given destPoint

projToLatLon

public LatLonPoint projToLatLon(ProjectionPoint world,
                                LatLonPointImpl result)
Convert projection coordinates to a LatLonPoint Note: a new object is not created on each call for the return value.

Specified by:
projToLatLon in interface Projection
Specified by:
projToLatLon in class ProjectionImpl
Parameters:
world - convert from these projection coordinates
result - the object to write to
Returns:
LatLonPoint convert to these lat/lon coordinates public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { double toLat, toLon; double fromX = world.getX() - falseEasting; double fromY = world.getY() - falseNorthing; double rrho0 = rho0; if (n < 0) { rrho0 *= -1.0; fromX *= -1.0; fromY *= -1.0; } double yd = rrho0 - fromY; double rho = Math.sqrt(fromX * fromX + yd * yd); double theta = Math.atan2(fromX, yd); if (n < 0) { rho *= -1.0; } toLat = Math.toDegrees(Math.asin((C - Math.pow((rho * n / EARTH_RADIUS), 2)) / (2 * n))); toLon = Math.toDegrees(theta / n + lon0); result.setLatitude(toLat); result.setLongitude(toLon); return result; } public Point2D.Double projectInverse(double xyx, double xyy, Point2D.Double out) { double rho; if ((rho = MapMath.distance(xyx, xyy = rho0 - xyy)) != 0) { double lpphi, lplam; if (n < 0.) { rho = -rho; xyx = -xyx; xyy = -xyy; } lpphi = rho / dd; if (!spherical) { lpphi = (c - lpphi * lpphi) / n; if (Math.abs(ec - Math.abs(lpphi)) > TOL7) { if ((lpphi = phi1_(lpphi, e, one_es)) == Double.MAX_VALUE) throw new ProjectionException("I"); } else lpphi = lpphi < 0. ? -MapMath.HALFPI : MapMath.HALFPI; } else if (Math.abs(out.y = (c - lpphi * lpphi) / n2) <= 1.) lpphi = Math.asin(lpphi); else lpphi = lpphi < 0. ? -MapMath.HALFPI : MapMath.HALFPI; lplam = Math.atan2(xyx, xyy) / n; out.x = lplam; out.y = lpphi; } else { out.x = 0.; out.y = n > 0. ? MapMath.HALFPI : - MapMath.HALFPI; } return out; }

main

public static void main(String[] args)


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.