Class AffineTransformer

java.lang.Object
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.
  • Field Details

  • Constructor Details

    • AffineTransformer

      public AffineTransformer()
      Create an instance that does not transform points.
    • AffineTransformer

      public AffineTransformer(AffineTransform transform)
      Create an instance with the supplied transform.
      Parameters:
      transform - the transform to use
  • Method Details

    • 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 - the point to transform
      Returns:
      the transformed point
    • getInverse

      public AffineTransform getInverse()
    • getScaleX

      public double getScaleX()
      Returns:
      the transform's x scale value
    • getScaleY

      public double getScaleY()
      Returns:
      the transform's y scale value
    • getScale

      public double getScale()
      Returns:
      the transform's overall scale magnitude
    • getShearX

      public double getShearX()
      Returns:
      the transform's x shear value
    • getShearY

      public double getShearY()
      Returns:
      the transform's y shear value
    • getTranslateX

      public double getTranslateX()
      Returns:
      the transform's x translate value
    • getTranslateY

      public double getTranslateY()
      Returns:
      the transform's y translate value
    • transform

      public Point2D transform(Point2D p)
      Applies the transform to the supplied point.
      Specified by:
      transform in interface BidirectionalTransformer
      Parameters:
      p - the point to be transformed
      Returns:
      the transformed point
    • transform

      public Shape transform(Shape shape)
      Transform the supplied shape from graph (layout) to screen (view) coordinates.
      Specified by:
      transform in interface ShapeTransformer
      Parameters:
      shape - the Shape to transform
      Returns:
      the GeneralPath of the transformed shape
    • inverseTransform

      public Shape inverseTransform(Shape shape)
      Transform the supplied shape from screen (view) to graph (layout) coordinates.
      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