com.partnersoft.geometry.projection
Class CoordinateTransformation

java.lang.Object
  extended by com.partnersoft.geometry.projection.CoordinateTransformation
All Implemented Interfaces:
Coggable

public class CoordinateTransformation
extends java.lang.Object
implements Coggable

Handles transformation of coordinates from one system to another. Both reverse and forward projection are provided, along with input and output scaling and offsets. This allows a variety of transformations, including but not limited to:

For truly weird transformations, write a special implementation of Projection. The order of application is:
  1. addition of inputOffset
  2. multiplication by inputScale
  3. reverse projection using reverseProjection
  4. forward projection using projection
  5. multiplication by outputScale
  6. addition of outputOffset
Notice that this means the offsets are always in the correct units of either the input coordinate system or output coordinate system. Also note that, in general, projections are done in meters, which must be converted from feet (or inches, or furlongs, or whatever). If either projection is empty or blank, nothing is done for those stages. Zero inputScale or outputScale is interpreted as 1 (no change) rather than actual zero (which would simply zero out any input). The algorithm is optimized to do nothing for the default case of no scaling, projection, or offset, and you can check the isIdentity() property to see if it is such a case and avoid passing points to it at all.

Author:
Paul Reavis Copyright 2005 Partner Software, Inc.

Constructor Summary
CoordinateTransformation()
           
 
Method Summary
 double getInputOffsetX()
           
 double getInputOffsetY()
           
 double getInputScaleX()
           
 double getInputScaleY()
           
 double getOutputOffsetX()
           
 double getOutputOffsetY()
           
 double getOutputScaleX()
           
 double getOutputScaleY()
           
 java.lang.String getProjectionName()
           
 java.lang.String getReverseProjectionName()
           
 Cog getState()
           
 boolean isIdentity()
           
 void setInputOffsetX(double d)
           
 void setInputOffsetY(double d)
           
 void setInputScaleX(double d)
           
 void setInputScaleY(double d)
           
 void setOutputOffsetX(double d)
           
 void setOutputOffsetY(double d)
           
 void setOutputScaleX(double d)
           
 void setOutputScaleY(double d)
           
 void setState(Cog state)
           
 void transform(DoubleBuffer coords)
          Modifies the given DoubleBuffer, treating it as a list of x, y pairs.
 Point transform(double x, double y)
           
 void transform(Point point)
          Modifies the coordinates of the input Point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoordinateTransformation

public CoordinateTransformation()
Method Detail

transform

public Point transform(double x,
                       double y)

transform

public void transform(Point point)
Modifies the coordinates of the input Point.


transform

public void transform(DoubleBuffer coords)
Modifies the given DoubleBuffer, treating it as a list of x, y pairs.


isIdentity

public boolean isIdentity()

getState

public Cog getState()
Specified by:
getState in interface Coggable

setState

public void setState(Cog state)
Specified by:
setState in interface Coggable

setInputScaleX

public void setInputScaleX(double d)

getInputScaleX

public double getInputScaleX()

setInputScaleY

public void setInputScaleY(double d)

getInputScaleY

public double getInputScaleY()

setInputOffsetX

public void setInputOffsetX(double d)

getInputOffsetX

public double getInputOffsetX()

setInputOffsetY

public void setInputOffsetY(double d)

getInputOffsetY

public double getInputOffsetY()

getProjectionName

public java.lang.String getProjectionName()

setOutputScaleX

public void setOutputScaleX(double d)

getOutputScaleX

public double getOutputScaleX()

setOutputScaleY

public void setOutputScaleY(double d)

getOutputScaleY

public double getOutputScaleY()

setOutputOffsetX

public void setOutputOffsetX(double d)

getOutputOffsetX

public double getOutputOffsetX()

setOutputOffsetY

public void setOutputOffsetY(double d)

getOutputOffsetY

public double getOutputOffsetY()

getReverseProjectionName

public java.lang.String getReverseProjectionName()