visad.georef
Class MapProjection

java.lang.Object
  extended by visad.CoordinateSystem
      extended by visad.georef.NavigatedCoordinateSystem
          extended by visad.georef.MapProjection
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AREACoordinateSystem, EASECoordinateSystem, GRIBCoordinateSystem, GRIDCoordinateSystem, HRITCoordinateSystem, LongitudeLatitudeInterpCS, TrivialMapProjection, Vis5DCoordinateSystem

public abstract class MapProjection
extends NavigatedCoordinateSystem

Abstract class for coordinate systems that support (lat,lon) <-> (x,y) with a reference coordinate system of (lat, lon) or (lon, lat).

Author:
Don Murray
See Also:
Serialized Form

Constructor Summary
MapProjection(RealTupleType reference, Unit[] units)
          Constructs from the type of the reference coordinate system and units for values in this coordinate system.
 
Method Summary
 LatLonPoint getCenterLatLon()
          Get the center lat/lon point for this MapProjection.
abstract  Rectangle2D getDefaultMapArea()
          Get a reasonable bounding box in this coordinate system.
 LatLonPoint getLatLon(double[][] xy)
          Get the lat/lon point for the given xy pairs.
 int getXIndex()
          Get the X index
 int getYIndex()
          Get the Y index
 boolean isLatLonOrder()
          Determine if the fromReference and toReference expect the to get the output and input values to be row/col ordered or
 boolean isXYOrder()
          Determine if the input to the toReference and output from the fromReference is (x,y) or (y,x).
 String toString()
          Print out a string representation of this MapProjection
 
Methods inherited from class visad.georef.NavigatedCoordinateSystem
getLatitudeIndex, getLongitudeIndex
 
Methods inherited from class visad.CoordinateSystem
canConvert, equals, fromReference, fromReference, fromReference, fromReference, getCoordinateSystemUnits, getDimension, getReference, getReferenceUnits, toReference, toReference, 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

MapProjection

public MapProjection(RealTupleType reference,
                     Unit[] units)
              throws VisADException
Constructs from the type of the reference coordinate system and units for values in this coordinate system. The reference coordinate system must contain RealType.Latitude and RealType.Longitude only.

Parameters:
reference - The type of the reference coordinate system. The reference must contain RealType.Latitude and RealType.Longitude. Values in the reference coordinate system shall be in units of reference.getDefaultUnits() unless specified otherwise.
units - The default units for this coordinate system. Numeric values in this coordinate system shall be in units of units unless specified otherwise. May be null or an array of null-s.
Throws:
VisADException - Couldn't create necessary VisAD object or reference does not contain RealType.Latitude and/or RealType.Longitude or the reference dimension is greater than 2.
Method Detail

getDefaultMapArea

public abstract 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. For example, the bounding box for a satellite image MapProjection might have an upper left corner of (0,0) and the width and height of the Rectangle2D would be the number of elements and lines, respectively.

Returns:
the bounding box of the MapProjection

isXYOrder

public boolean isXYOrder()
Determine if the input to the toReference and output from the fromReference is (x,y) or (y,x). Subclasses should override if (y,x).

Returns:
true if (x,y)

isLatLonOrder

public boolean isLatLonOrder()
Determine if the fromReference and toReference expect the to get the output and input values to be row/col ordered or


getCenterLatLon

public LatLonPoint getCenterLatLon()
                            throws VisADException
Get the center lat/lon point for this MapProjection.

Returns:
the lat/lon point at the center of the projection.
Throws:
VisADException

getXIndex

public int getXIndex()
Get the X index

Returns:
the index

getYIndex

public int getYIndex()
Get the Y index

Returns:
the index

getLatLon

public LatLonPoint getLatLon(double[][] xy)
                      throws VisADException
Get the lat/lon point for the given xy pairs. this method will flip the order of the xy if it is not in xyorder

Returns:
the lat/lon point for the given xy pairs
Throws:
VisADException

toString

public String toString()
Print out a string representation of this MapProjection

Overrides:
toString in class Object