ucar.unidata.geoloc.projection
Class ProjectionAdapter

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

public class ProjectionAdapter
extends ProjectionImpl

Adapts a Projection interface into a subclass of ProjectionImpl, so we can assume a Projection is a ProjectionImpl without loss of generality.

Author:
John Caron
See Also:
Projection, ProjectionImpl, 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
ProjectionAdapter(Projection proj)
          Create a new ProjectionImpl from a Projection
 
Method Summary
 ProjectionImpl constructCopy()
          copy constructor - avoid clone !!
 boolean crossSeam(ProjectionPoint pt1, ProjectionPoint pt2)
          Does the line between these two points cross the projection "seam".
 boolean equals(Object p)
          Check for equality with the object in question
static ProjectionImpl factory(Projection proj)
          Create a ProjectionImpl from the projection
 String getClassName()
          Get the class name
 ProjectionRect getDefaultMapArea()
          Get a reasonable bounding box for this projection.
 ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl result)
          Convert a LatLonPoint to projection coordinates
 String paramsToString()
          Get the parameters as a String
 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, clone, getDefaultMapAreaLL, getHeader, getLatLonBoundingBox, getName, getProjectionParameters, getProjectionTypeLabel, 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

ProjectionAdapter

public ProjectionAdapter(Projection proj)
Create a new ProjectionImpl from a Projection

Parameters:
proj - projection to use
Method Detail

factory

public static ProjectionImpl factory(Projection proj)
Create a ProjectionImpl from the projection

Parameters:
proj - projection
Returns:
a ProjectionImpl representing the projection

constructCopy

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

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

getClassName

public String getClassName()
Get the class name

Specified by:
getClassName in interface Projection
Overrides:
getClassName in class ProjectionImpl
Returns:
the class name

paramsToString

public String paramsToString()
Get the parameters as a String

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

equals

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

Specified by:
equals in interface Projection
Specified by:
equals in class ProjectionImpl
Parameters:
p - object in question
Returns:
true if the represent the same projection

latLonToProj

public ProjectionPoint latLonToProj(LatLonPoint latlon,
                                    ProjectionPointImpl result)
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 result

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

crossSeam

public boolean crossSeam(ProjectionPoint pt1,
                         ProjectionPoint pt2)
Does the line between these two points cross the projection "seam".

Specified by:
crossSeam in interface Projection
Specified by:
crossSeam in class ProjectionImpl
Parameters:
pt1 - the line goes between these two points
pt2 - the line goes between these two points
Returns:
false if there is no seam

getDefaultMapArea

public ProjectionRect getDefaultMapArea()
Get a reasonable bounding box for this projection.

Specified by:
getDefaultMapArea in interface Projection
Overrides:
getDefaultMapArea in class ProjectionImpl
Returns:
reasonable bounding box


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