ecologylab.projection
Class PlateCarreeProjection

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.projection.Projection
          extended by ecologylab.projection.PlateCarreeProjection

public class PlateCarreeProjection
extends Projection

A plate carree projection directly maps X coordinates to longitude and Y coordinates to latitude. This projection is fast, but will only generally be effective for small spaces and/or near the equator. Otherwise, the distortion created by this mapping may be problematic. Essentially, any north-south movement will take place directly along a great circle, any east-west movement will run along a parallel. Distortion will come into play in that as a person moves further north, EW movement in the virtual world will be accelerated: one step east or west will cover more "ground" at high and low latitudes. Note that, although it is somewhat confusing, this projection will map north to negative Y (because in Java, negative Y is UP) and east to positive X. PlateCarreeProjection sets scale in terms of virtual world points : degrees latitude/longitude.

Author:
Zachary O. Toups (toupsz@cs.tamu.edu)

Nested Class Summary
 
Nested classes/interfaces inherited from class ecologylab.projection.Projection
Projection.RotationConstraintMode, Projection.ScaleConstraintMode
 
Field Summary
protected  java.awt.geom.AffineTransform inverseTransformMatrix
           
protected  java.awt.geom.AffineTransform transformMatrix
          The matrix that performs the transformation from real-world coordinates to virtual world coordinates.
 
Fields inherited from class ecologylab.projection.Projection
aspectRatio, physicalWorldPointNE, physicalWorldPointSW, realWorldHeight, realWorldWidth, rotConstMode, scaleConstMode, specedPWP1, specedPWP2, virtualWorldHeight, virtualWorldWidth
 
Constructor Summary
PlateCarreeProjection(GPSDatum physicalWorldPoint1, GPSDatum physicalWorldPoint2, double virtualWorldWidth, double virtualWorldHeight, Projection.RotationConstraintMode rotConstMode)
           
PlateCarreeProjection(GPSDatum physicalWorldPoint1, GPSDatum physicalWorldPoint2, double scaleFactor, Projection.RotationConstraintMode rotConstMode)
           
 
Method Summary
protected  void configure()
          Adjusts internal variables to match the modes, based on the current parameters.
 java.awt.geom.AffineTransform getInverseTransformMatrix()
           
 double getScale()
          Compute (if necessary) the scale factor between virtual world and real world units.
 java.awt.geom.AffineTransform getTransformMatrix()
           
static void main(java.lang.String[] args)
           
protected  GPSDatum projectIntoRealImpl(java.awt.geom.Point2D.Double origPoint, GPSDatum destDatum)
          This method does the real work of projectIntoReal; all calls to it are guaranteed to pass an instantiated GPSDatum object.
protected  java.awt.geom.Point2D.Double projectIntoVirtualImpl(GPSDatum origPoint, java.awt.geom.Point2D.Double destPoint)
          Projects the given GPSDatum's coordinates into the virtual space, using some type of projection.
 
Methods inherited from class ecologylab.projection.Projection
getPhysicalWorldPointNE, getPhysicalWorldPointSW, getVirtualWorldHeight, getVirtualWorldWidth, projectIntoReal, projectIntoReal, projectIntoVirtual, projectIntoVirtual, setPhysicalWorldCoordinates, setPhysicalWorldCoordinatesOnly, setRotConstMode, setRotConstModeOnly, setScaleConstMode, setScaleConstModeOnly, setVirtualWorldPoints, setVirtualWorldSizeOnly
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

transformMatrix

protected java.awt.geom.AffineTransform transformMatrix
The matrix that performs the transformation from real-world coordinates to virtual world coordinates.


inverseTransformMatrix

protected java.awt.geom.AffineTransform inverseTransformMatrix
Constructor Detail

PlateCarreeProjection

public PlateCarreeProjection(GPSDatum physicalWorldPoint1,
                             GPSDatum physicalWorldPoint2,
                             double scaleFactor,
                             Projection.RotationConstraintMode rotConstMode)
                      throws SameCoordinatesException
Throws:
SameCoordinatesException

PlateCarreeProjection

public PlateCarreeProjection(GPSDatum physicalWorldPoint1,
                             GPSDatum physicalWorldPoint2,
                             double virtualWorldWidth,
                             double virtualWorldHeight,
                             Projection.RotationConstraintMode rotConstMode)
                      throws SameCoordinatesException
Parameters:
physicalWorldPoint1 -
physicalWorldPoint2 -
virtualWorldPointUpperRight - - the upper right of this coordinate system; normally, this will be the point with the greatest X and least Y.
virtualWorldPointLowerLeft - - the lower left of the target coordinate system; normally, this will be the point with the least X and the greatest Y.
rotConstMode -
Throws:
SameCoordinatesException
Method Detail

main

public static void main(java.lang.String[] args)
                 throws SameCoordinatesException
Throws:
SameCoordinatesException

getScale

public double getScale()
Description copied from class: Projection
Compute (if necessary) the scale factor between virtual world and real world units. Should be virtual points : real world measure. The real world measure is dependent on the subclass.

Specified by:
getScale in class Projection
Returns:
the scale factor between the virtual world and the real world.
See Also:
Projection.getScale()

configure

protected void configure()
Adjusts internal variables to match the modes, based on the current parameters. This method should be called whenever any states are changed.

Specified by:
configure in class Projection

projectIntoVirtualImpl

protected java.awt.geom.Point2D.Double projectIntoVirtualImpl(GPSDatum origPoint,
                                                              java.awt.geom.Point2D.Double destPoint)
Projects the given GPSDatum's coordinates into the virtual space, using some type of projection. This version takes an instantiated Point2D, so as not to expend resources instantating a new one. Subclasses may override this method, if they are not making affine transformations.

Specified by:
projectIntoVirtualImpl in class Projection
Parameters:
origPoint -
destPoint -
Returns:
destPoint containing the virtual space point for origPoint.

projectIntoRealImpl

protected GPSDatum projectIntoRealImpl(java.awt.geom.Point2D.Double origPoint,
                                       GPSDatum destDatum)
Description copied from class: Projection
This method does the real work of projectIntoReal; all calls to it are guaranteed to pass an instantiated GPSDatum object.

Specified by:
projectIntoRealImpl in class Projection
Returns:

getTransformMatrix

public java.awt.geom.AffineTransform getTransformMatrix()
Returns:
the transformMatrix

getInverseTransformMatrix

public java.awt.geom.AffineTransform getInverseTransformMatrix()
Returns:
the inverseTransformMatrix