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

java.lang.Object
  extended by edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator
      extended by edu.uci.ics.jung.visualization.transform.LensTransformer
All Implemented Interfaces:
ChangeEventSupport, MutableTransformer, ShapeTransformer, Transformer
Direct Known Subclasses:
HyperbolicTransformer, MagnifyTransformer

public abstract class LensTransformer
extends MutableTransformerDecorator
implements MutableTransformer

LensTransformer wraps a MutableAffineTransformer and modifies the transform and inverseTransform methods so that they create a projection of the graph points within an elliptical lens. LensTransformer uses an affine transform to cause translation, scaling, rotation, and shearing while applying a possibly non-affine filter in its transform and inverseTransform methods.

Author:
Tom Nelson - RABA Technologies

Nested Class Summary
protected  class LensTransformer.ComponentListenerImpl
          react to size changes on a component
protected static class LensTransformer.PolarPoint
          a convenience class to represent a point in polar coordinates
 
Field Summary
protected  Ellipse2D ellipse
          the area affected by the transform
protected  float magnification
           
 
Fields inherited from class edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator
delegate
 
Constructor Summary
LensTransformer(Component component)
          create an instance, setting values from the passed component and registering to listen for size changes on the component
LensTransformer(Component component, MutableTransformer delegate)
          create an instance with a possibly shared transform
 
Method Summary
protected  LensTransformer.PolarPoint cartesianToPolar(double x, double y)
          Returns the result of converting (x, y) to polar coordinates.
protected  LensTransformer.PolarPoint cartesianToPolar(Point2D point)
          Returns the result of converting point to polar coordinates.
 double getDistanceFromCenter(Point2D p)
           
 Ellipse2D getEllipse()
           
 float getMagnification()
           
 double getRatio()
           
 Point2D getViewCenter()
           
 double getViewRadius()
           
abstract  Point2D inverseTransform(Point2D viewPoint)
          override base class to un-project the fisheye effect
protected  Point2D polarToCartesian(double theta, double radius)
          Returns the result of converting (theta, radius) to Cartesian coordinates.
protected  Point2D polarToCartesian(LensTransformer.PolarPoint polar)
          Returns the result of converting polar to Cartesian coordinates.
 void setEllipse(Ellipse2D ellipse)
           
 void setMagnification(float magnification)
           
 void setToIdentity()
           
 void setViewCenter(Point2D viewCenter)
           
 void setViewRadius(double viewRadius)
           
abstract  Point2D transform(Point2D graphPoint)
          override base class transform to project the fisheye effect
 
Methods inherited from class edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator
addChangeListener, concatenate, fireStateChanged, getChangeListeners, getDelegate, getRotation, getScale, getScaleX, getScaleY, getShearX, getShearY, getTransform, getTranslateX, getTranslateY, inverseTransform, preConcatenate, removeChangeListener, rotate, rotate, scale, setDelegate, setScale, setTranslate, shear, transform, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.uci.ics.jung.visualization.transform.MutableTransformer
concatenate, getRotation, getScale, getScaleX, getScaleY, getShearX, getShearY, getTransform, getTranslateX, getTranslateY, preConcatenate, rotate, rotate, scale, setScale, setTranslate, shear, translate
 
Methods inherited from interface edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer
inverseTransform, transform
 
Methods inherited from interface edu.uci.ics.jung.utils.ChangeEventSupport
addChangeListener, fireStateChanged, getChangeListeners, removeChangeListener
 

Field Detail

ellipse

protected Ellipse2D ellipse
the area affected by the transform


magnification

protected float magnification
Constructor Detail

LensTransformer

public LensTransformer(Component component)
create an instance, setting values from the passed component and registering to listen for size changes on the component

Parameters:
component -

LensTransformer

public LensTransformer(Component component,
                       MutableTransformer delegate)
create an instance with a possibly shared transform

Parameters:
component -
delegate -
Method Detail

getMagnification

public float getMagnification()
Returns:
Returns the magnification.

setMagnification

public void setMagnification(float magnification)
Parameters:
magnification - The magnification to set.

getViewCenter

public Point2D getViewCenter()
Returns:
Returns the viewCenter.

setViewCenter

public void setViewCenter(Point2D viewCenter)
Parameters:
viewCenter - The viewCenter to set.

getViewRadius

public double getViewRadius()
Returns:
Returns the viewRadius.

setViewRadius

public void setViewRadius(double viewRadius)
Parameters:
viewRadius - The viewRadius to set.

getRatio

public double getRatio()
Returns:
Returns the ratio.

setEllipse

public void setEllipse(Ellipse2D ellipse)

getEllipse

public Ellipse2D getEllipse()

setToIdentity

public void setToIdentity()
Specified by:
setToIdentity in interface MutableTransformer
Overrides:
setToIdentity in class MutableTransformerDecorator

polarToCartesian

protected Point2D polarToCartesian(LensTransformer.PolarPoint polar)
Returns the result of converting polar to Cartesian coordinates.


polarToCartesian

protected Point2D polarToCartesian(double theta,
                                   double radius)
Returns the result of converting (theta, radius) to Cartesian coordinates.


cartesianToPolar

protected LensTransformer.PolarPoint cartesianToPolar(Point2D point)
Returns the result of converting point to polar coordinates.


cartesianToPolar

protected LensTransformer.PolarPoint cartesianToPolar(double x,
                                                      double y)
Returns the result of converting (x, y) to polar coordinates.


transform

public abstract Point2D transform(Point2D graphPoint)
override base class transform to project the fisheye effect

Specified by:
transform in interface Transformer
Overrides:
transform in class MutableTransformerDecorator
Parameters:
graphPoint - graph point to convert
Returns:
screen point

inverseTransform

public abstract Point2D inverseTransform(Point2D viewPoint)
override base class to un-project the fisheye effect

Specified by:
inverseTransform in interface Transformer
Overrides:
inverseTransform in class MutableTransformerDecorator
Parameters:
viewPoint - screen point to convert
Returns:
the graph point

getDistanceFromCenter

public double getDistanceFromCenter(Point2D p)