ucar.visad
Class ProjectionCoordinateSystem

java.lang.Object
  extended by visad.CoordinateSystem
      extended by visad.georef.NavigatedCoordinateSystem
          extended by visad.georef.MapProjection
              extended by ucar.visad.ProjectionCoordinateSystem
All Implemented Interfaces:
Serializable, XmlPersistable

public class ProjectionCoordinateSystem
extends MapProjection
implements XmlPersistable

Adapts a ucar.unidata.Projection into a VisAD MapProjection CoordinateSystem. Transforms between world coordinates (x,y) in km and lat/lon in degrees. Reference is lat/lon (RealTupleType.LatitudeLongitudeTuple)

Version:
$Revision: 1.25 $ $Date: 2006/08/18 17:28:41 $
Author:
Stuart Wier, Don Murray
See Also:
Projection, MapProjection, Serialized Form

Constructor Summary
ProjectionCoordinateSystem(ucar.unidata.geoloc.ProjectionImpl projection)
          Constructs an instance from the supplied Projection.
 
Method Summary
 Element createElement(XmlEncoder encoder)
          Create the XML to represent this object.
 boolean equals(Object obj)
          Check for equality of CoordinateSystem objects
 double[][] fromReference(double[][] latlon)
          Convert lat/lon coordinates to world (projection) coords.
 float[][] fromReference(float[][] latlon)
          Convert lat/lon coordinates to world (projection) coords.
 Rectangle2D getDefaultMapArea()
          Get a reasonable bounding box in this coordinate system.
 ucar.unidata.geoloc.ProjectionImpl getProjection()
          Get the Projection used for the transformations.
 boolean initFromXml(XmlEncoder encoder, Element node)
          Do nothing, return true to tell the encoder that it is ok to process any methods or properties.
 double[][] toReference(double[][] world)
          Convert world coordinates to lat/lon.
 float[][] toReference(float[][] world)
          Convert world coordinates to lat/lon.
 String toString()
          Override the parent toString method to use the contained ProjectionImpl's name
 
Methods inherited from class visad.georef.MapProjection
getCenterLatLon, getLatLon, isLatLonOrder, isXYOrder
 
Methods inherited from class visad.georef.NavigatedCoordinateSystem
getLatitudeIndex, getLongitudeIndex
 
Methods inherited from class visad.CoordinateSystem
canConvert, fromReference, fromReference, getCoordinateSystemUnits, getDimension, getReference, getReferenceUnits, toReference, toReference, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinatesFreeUnits, transformCoordinatesFreeUnits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProjectionCoordinateSystem

public ProjectionCoordinateSystem(ucar.unidata.geoloc.ProjectionImpl projection)
                           throws VisADException
Constructs an instance from the supplied Projection. The reference coordinate system is RealTupleType.LatitudeLongitudeTuple; the incoming units are assumed to be km (1000 m).

Parameters:
projection - projection to adapt
Throws:
NullPointerException - if the argument is null.
VisADException
Method Detail

toString

public String toString()
Override the parent toString method to use the contained ProjectionImpl's name

Overrides:
toString in class MapProjection
Returns:
string representation

getDefaultMapArea

public Rectangle2D getDefaultMapArea()
Get a reasonable bounding box in this coordinate system. MapProjections are typically specific to an area of the world; there's no bounding box that works for all projections so each subclass must implement this method.

Specified by:
getDefaultMapArea in class MapProjection
Returns:
the default MapArea of the Projection

getProjection

public ucar.unidata.geoloc.ProjectionImpl getProjection()
Get the Projection used for the transformations.

Returns:
projection

toReference

public double[][] toReference(double[][] world)
                       throws VisADException
Convert world coordinates to lat/lon. Input coords are in km.

Specified by:
toReference in class CoordinateSystem
Parameters:
world - world projection coordinates (x = world[0][i])
Returns:
corresponding lat/lon values (lat = latlon[0][i])
Throws:
VisADException - world coordinate array length != 2

fromReference

public double[][] fromReference(double[][] latlon)
                         throws VisADException
Convert lat/lon coordinates to world (projection) coords.

Specified by:
fromReference in class CoordinateSystem
Parameters:
latlon - lat/lon values (lat = latlon[0][i])
Returns:
world projection coordinates (x = world[0][i])
Throws:
VisADException - latlon coordinate array length != 2

toReference

public float[][] toReference(float[][] world)
                      throws VisADException
Convert world coordinates to lat/lon. Input coords are in km.

Overrides:
toReference in class CoordinateSystem
Parameters:
world - world projection coordinates (x = world[0][i])
Returns:
corresponding lat/lon values (lat = latlon[0][i])
Throws:
VisADException - world coordinate array length != 2

fromReference

public float[][] fromReference(float[][] latlon)
                        throws VisADException
Convert lat/lon coordinates to world (projection) coords.

Overrides:
fromReference in class CoordinateSystem
Parameters:
latlon - lat/lon values (lat = latlon[0][i])
Returns:
world projection coordinates (x = world[0][i])
Throws:
VisADException - latlon coordinate array length != 2

equals

public boolean equals(Object obj)
Check for equality of CoordinateSystem objects

Specified by:
equals in class CoordinateSystem
Parameters:
obj - other object in question
Returns:
true if the object in question is a ProjectionCoordinateSystem and it's Projection is equal the this object's Projection

createElement

public Element createElement(XmlEncoder encoder)
Create the XML to represent this object.

Specified by:
createElement in interface XmlPersistable
Parameters:
encoder - encoder to use
Returns:
Element that represents this object.

initFromXml

public boolean initFromXml(XmlEncoder encoder,
                           Element node)
Do nothing, return true to tell the encoder that it is ok to process any methods or properties.

Specified by:
initFromXml in interface XmlPersistable
Parameters:
encoder - encoder to use
node - node to process
Returns:
true