Class LensTransformer
java.lang.Object
edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
react to size changes on a component -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RectangularShape
the area affected by the transformprotected float
Fields inherited from class edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator
delegate
-
Constructor Summary
ConstructorsConstructorDescriptionLensTransformer
(Component component, MutableTransformer delegate) Create an instance with a possibly shared transform. -
Method Summary
Modifier and TypeMethodDescriptiondouble
float
double
getRatio()
double
abstract Point2D
inverseTransform
(Point2D viewPoint) override base class to un-project the fisheye effectinverseTransform
(Shape shape) Returns the supplied shape, translated to the coordinates that result from calling inverseTransform on its center.private void
setComponent
(Component component) Set values from the passed component.void
setLensShape
(RectangularShape ellipse) void
setMagnification
(float magnification) void
void
setViewCenter
(Point2D viewCenter) void
setViewRadius
(double viewRadius) abstract Point2D
override base class transform to project the fisheye effectreturn the supplied shape, translated to the coordinates that result from calling transform on its centerMethods 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.util.ChangeEventSupport
addChangeListener, fireStateChanged, getChangeListeners, removeChangeListener
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
-
Field Details
-
lensShape
the area affected by the transform -
magnification
protected float magnification
-
-
Constructor Details
-
LensTransformer
Create an instance with a possibly shared transform.- Parameters:
component
- the component used for renderingdelegate
- the transformer to use
-
-
Method Details
-
setComponent
Set values from the passed component.- Parameters:
component
- the component used for rendering
-
getMagnification
public float getMagnification() -
setMagnification
public void setMagnification(float magnification) -
getViewCenter
-
setViewCenter
-
getViewRadius
public double getViewRadius() -
setViewRadius
public void setViewRadius(double viewRadius) -
getRatio
public double getRatio()- Returns:
- the ratio between the lens height and lens width
-
setLensShape
-
getLensShape
-
setToIdentity
public void setToIdentity()- Specified by:
setToIdentity
in interfaceMutableTransformer
- Overrides:
setToIdentity
in classMutableTransformerDecorator
-
transform
override base class transform to project the fisheye effect- Specified by:
transform
in interfaceBidirectionalTransformer
- Overrides:
transform
in classMutableTransformerDecorator
- Parameters:
graphPoint
- graph point to convert- Returns:
- screen point
-
inverseTransform
override base class to un-project the fisheye effect- Specified by:
inverseTransform
in interfaceBidirectionalTransformer
- Overrides:
inverseTransform
in classMutableTransformerDecorator
- Parameters:
viewPoint
- screen point to convert- Returns:
- the graph point
-
getDistanceFromCenter
-
transform
return the supplied shape, translated to the coordinates that result from calling transform on its center- Specified by:
transform
in interfaceShapeTransformer
- Overrides:
transform
in classMutableTransformerDecorator
- Parameters:
shape
- the Shape to transform- Returns:
- a GeneralPath (Shape) representing the screen points of the shape
-
inverseTransform
Returns the supplied shape, translated to the coordinates that result from calling inverseTransform on its center.- Specified by:
inverseTransform
in interfaceShapeTransformer
- Overrides:
inverseTransform
in classMutableTransformerDecorator
-