edu.uci.ics.jung.visualization.transform
Class AffineTransformer

java.lang.Object
  extended by edu.uci.ics.jung.visualization.transform.AffineTransformer
All Implemented Interfaces:
BidirectionalTransformer, ShapeTransformer
Direct Known Subclasses:
MutableAffineTransformer

public class AffineTransformer
extends Object
implements BidirectionalTransformer, ShapeTransformer

Provides methods to map points from one coordinate system to another, by delegating to a wrapped AffineTransform (uniform) and its inverse.

Author:
Tom Nelson

Field Summary
protected  AffineTransform inverse
           
protected  AffineTransform transform
          the AffineTransform to use.
 
Constructor Summary
AffineTransformer()
          create an instance that does not transform points
AffineTransformer(AffineTransform transform)
          Create an instance with the supplied transform
 
Method Summary
 AffineTransform getInverse()
           
 double getRotation()
           
 double getScale()
           
 double getScaleX()
          getter for scalex
 double getScaleY()
          getter for scaley
 double getShearX()
          getter for shear in x axis
 double getShearY()
          getter for shear in y axis
 AffineTransform getTransform()
           
 double getTranslateX()
          get the translate x value
 double getTranslateY()
          get the translate y value
 Point2D inverseTransform(Point2D p)
          applies the inverse transform to the supplied point
 Shape inverseTransform(Shape shape)
          transform the supplied shape from graph coordinates to screen coordinates
 void setTransform(AffineTransform transform)
           
 String toString()
           
 Point2D transform(Point2D p)
          applies the transform to the supplied point
 Shape transform(Shape shape)
          transform the supplied shape from graph coordinates to screen coordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inverse

protected AffineTransform inverse

transform

protected AffineTransform transform
the AffineTransform to use. Initialize to identity

Constructor Detail

AffineTransformer

public AffineTransformer()
create an instance that does not transform points


AffineTransformer

public AffineTransformer(AffineTransform transform)
Create an instance with the supplied transform

Method Detail

getTransform

public AffineTransform getTransform()
Returns:
Returns the transform.

setTransform

public void setTransform(AffineTransform transform)
Parameters:
transform - The transform to set.

inverseTransform

public Point2D inverseTransform(Point2D p)
applies the inverse transform to the supplied point

Specified by:
inverseTransform in interface BidirectionalTransformer
Parameters:
p -
Returns:

getInverse

public AffineTransform getInverse()

getScaleX

public double getScaleX()
getter for scalex


getScaleY

public double getScaleY()
getter for scaley


getScale

public double getScale()

getShearX

public double getShearX()
getter for shear in x axis


getShearY

public double getShearY()
getter for shear in y axis


getTranslateX

public double getTranslateX()
get the translate x value


getTranslateY

public double getTranslateY()
get the translate y value


transform

public Point2D transform(Point2D p)
applies the transform to the supplied point

Specified by:
transform in interface BidirectionalTransformer
Parameters:
p - graph point to convert
Returns:
screen point

transform

public Shape transform(Shape shape)
transform the supplied shape from graph coordinates to screen coordinates

Specified by:
transform in interface BidirectionalTransformer
Specified by:
transform in interface ShapeTransformer
Returns:
the GeneralPath of the transformed shape

inverseTransform

public Shape inverseTransform(Shape shape)
transform the supplied shape from graph coordinates to screen coordinates

Specified by:
inverseTransform in interface BidirectionalTransformer
Specified by:
inverseTransform in interface ShapeTransformer
Returns:
the GeneralPath of the transformed shape

getRotation

public double getRotation()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009. All Rights Reserved.