JIDE 3.5.15

com.jidesoft.chart
Class UserToPixelTransform

java.lang.Object
  extended by com.jidesoft.chart.UserToPixelTransform

public class UserToPixelTransform
extends Object

An affine transform does not provide for logarithmic conversions so we need a more general conversion mechanism. This class contains an affine transform but can also contain other transform(s) so that we can support the logarithmic and other transformations.

Author:
Simon White

Constructor Summary
UserToPixelTransform()
           
UserToPixelTransform(AffineTransform affineT)
           
 
Method Summary
 AffineTransform getAffineTransform()
           
 AffineTransform getAffineTransformWithTranslation()
          Returns an AffineTransform for transforming user coordinates to pixel coordinates
 Point2D getTranslation()
          Return the translation part of the transformation
 Transform<Double> getXTransform()
           
 Transform<Double> getYTransform()
           
 Point2D inverseTransform(Point2D src)
          Transforms a pixel coordinate to a user coordinate
 void setAffineTransform(AffineTransform affineTransform)
           
 void setTranslation(Double x, Double y)
          Specify the translation in user coordinates
 void setXTransform(InvertibleTransform<Double> transform)
           
 void setYTransform(InvertibleTransform<Double> transform)
           
 Point2D transform(Point2D src)
          Transforms a user coordinate to a pixel coordinate
 Point2D transform(Point2D src, Point2D dst)
          Transforms a user coordinate to a pixel coordinate and puts the result into the supplied destination Point2D object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserToPixelTransform

public UserToPixelTransform()

UserToPixelTransform

public UserToPixelTransform(AffineTransform affineT)
Method Detail

getAffineTransform

public AffineTransform getAffineTransform()

setAffineTransform

public void setAffineTransform(AffineTransform affineTransform)

getAffineTransformWithTranslation

public AffineTransform getAffineTransformWithTranslation()
Returns an AffineTransform for transforming user coordinates to pixel coordinates

Important: Do not use this method if you are dealing with time series values, as the size of values used for translation may cause overflow-type errors in calculations. This is especially true of the inverse transform.

Returns:
an Affine Transform

setTranslation

public void setTranslation(Double x,
                           Double y)
Specify the translation in user coordinates

Parameters:
x - the x offset
y - the y offset

getTranslation

public Point2D getTranslation()
Return the translation part of the transformation

Returns:
the translation

getXTransform

public Transform<Double> getXTransform()

setXTransform

public void setXTransform(InvertibleTransform<Double> transform)

getYTransform

public Transform<Double> getYTransform()

setYTransform

public void setYTransform(InvertibleTransform<Double> transform)

transform

public Point2D transform(Point2D src)
Transforms a user coordinate to a pixel coordinate

Parameters:
src - the user coordinate
Returns:
a pixel coordinate

transform

public Point2D transform(Point2D src,
                         Point2D dst)
Transforms a user coordinate to a pixel coordinate and puts the result into the supplied destination Point2D object

Parameters:
src - the user coordinate
dst - object to receive the destination
Returns:
the dst object with the x and y locations set

inverseTransform

public Point2D inverseTransform(Point2D src)
                         throws NoninvertibleTransformException
Transforms a pixel coordinate to a user coordinate

Parameters:
src - the source point in pixel coordinates
Returns:
a point in user coordinates
Throws:
NoninvertibleTransformException

JIDE 3.5.15