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 classreact to size changes on a component -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RectangularShapethe area affected by the transformprotected floatFields inherited from class MutableTransformerDecorator
delegate -
Constructor Summary
ConstructorsConstructorDescriptionLensTransformer(Component component, MutableTransformer delegate) Create an instance with a possibly shared transform. -
Method Summary
Modifier and TypeMethodDescriptiondoublefloatdoublegetRatio()doubleabstract Point2DinverseTransform(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 voidsetComponent(Component component) Set values from the passed component.voidsetLensShape(RectangularShape ellipse) voidsetMagnification(float magnification) voidvoidsetViewCenter(Point2D viewCenter) voidsetViewRadius(double viewRadius) abstract Point2Doverride 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 MutableTransformerDecorator
addChangeListener, concatenate, fireStateChanged, getChangeListeners, getDelegate, getRotation, getScale, getScaleX, getScaleY, getShearX, getShearY, getTransform, getTranslateX, getTranslateY, preConcatenate, removeChangeListener, rotate, rotate, scale, setDelegate, setScale, setTranslate, shear, translateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChangeEventSupport
addChangeListener, fireStateChanged, getChangeListeners, removeChangeListenerMethods inherited from interface 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:
setToIdentityin interfaceMutableTransformer- Overrides:
setToIdentityin classMutableTransformerDecorator
-
transform
override base class transform to project the fisheye effect- Specified by:
transformin interfaceBidirectionalTransformer- Overrides:
transformin classMutableTransformerDecorator- Parameters:
graphPoint- graph point to convert- Returns:
- screen point
-
inverseTransform
override base class to un-project the fisheye effect- Specified by:
inverseTransformin interfaceBidirectionalTransformer- Overrides:
inverseTransformin 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:
transformin interfaceShapeTransformer- Overrides:
transformin 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:
inverseTransformin interfaceShapeTransformer- Overrides:
inverseTransformin classMutableTransformerDecorator
-