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:
BidirectionalTransformer, MutableTransformer, ShapeTransformer, ChangeEventSupport
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

Nested Class Summary
protected  class LensTransformer.ComponentListenerImpl
          react to size changes on a component
 
Field Summary
protected  RectangularShape lensShape
          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, MutableTransformer delegate)
          create an instance with a possibly shared transform
 
Method Summary
 double getDistanceFromCenter(Point2D p)
           
 RectangularShape getLensShape()
           
 float getMagnification()
           
 double getRatio()
           
 Point2D getViewCenter()
           
 double getViewRadius()
           
abstract  Point2D inverseTransform(Point2D viewPoint)
          override base class to un-project the fisheye effect
 Shape inverseTransform(Shape shape)
          return the supplied shape, translated to the coordinates that result from calling inverseTransform on its center
 void setLensShape(RectangularShape 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
 Shape transform(Shape shape)
          return the supplied shape, translated to the coordinates that result from calling transform on its center
 
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, preConcatenate, removeChangeListener, rotate, rotate, scale, setDelegate, setScale, setTranslate, shear, 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.util.ChangeEventSupport
addChangeListener, fireStateChanged, getChangeListeners, removeChangeListener
 

Field Detail

lensShape

protected RectangularShape lensShape
the area affected by the transform


magnification

protected float magnification
Constructor Detail

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.

setLensShape

public void setLensShape(RectangularShape ellipse)

getLensShape

public RectangularShape getLensShape()

setToIdentity

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

transform

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

Specified by:
transform in interface BidirectionalTransformer
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 BidirectionalTransformer
Overrides:
inverseTransform in class MutableTransformerDecorator
Parameters:
viewPoint - screen point to convert
Returns:
the graph point

getDistanceFromCenter

public double getDistanceFromCenter(Point2D p)

transform

public Shape transform(Shape shape)
return the supplied shape, translated to the coordinates that result from calling transform on its center

Specified by:
transform in interface BidirectionalTransformer
Specified by:
transform in interface ShapeTransformer
Overrides:
transform in class MutableTransformerDecorator
Returns:
a GeneralPath (Shape) representing the screen points of the shape

inverseTransform

public Shape inverseTransform(Shape shape)
return the supplied shape, translated to the coordinates that result from calling inverseTransform on its center

Specified by:
inverseTransform in interface BidirectionalTransformer
Specified by:
inverseTransform in interface ShapeTransformer
Overrides:
inverseTransform in class MutableTransformerDecorator
Returns:


Copyright © 2009. All Rights Reserved.