Class MutableAffineTransformer
- java.lang.Object
-
- org.jungrapht.visualization.transform.AffineTransformer
-
- org.jungrapht.visualization.transform.MutableAffineTransformer
-
- All Implemented Interfaces:
BidirectionalTransformer,MutableTransformer,ShapeTransformer,ChangeEventSupport
- Direct Known Subclasses:
TransformSupport
public class MutableAffineTransformer extends AffineTransformer implements MutableTransformer, ShapeTransformer, ChangeEventSupport
Provides methods to mutate the AffineTransform used by AffineTransformer base class to map points from one coordinate system to another.- Author:
- Tom Nelson
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeEventSupportchangeSupport-
Fields inherited from class org.jungrapht.visualization.transform.AffineTransformer
inverse, transform
-
-
Constructor Summary
Constructors Constructor Description MutableAffineTransformer()create an instance that does not transform pointsMutableAffineTransformer(AffineTransform transform)Create an instance with the supplied transform
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(ChangeListener l)Adds aChangeListener.voidconcatenate(AffineTransform xform)voidfireStateChanged()Notifies all listeners that have registered interest for notification on this event type.ChangeListener[]getChangeListeners()Returns an array of all theChangeListeners added with addChangeListener().voidpreConcatenate(AffineTransform xform)voidremoveChangeListener(ChangeListener l)Removes a ChangeListener.voidrotate(double radians, double x, double y)rotates the current transform at the supplied pointsvoidrotate(double theta, Point2D from)preconcatenates the rotation at the supplied point with the current transformvoidscale(double scalex, double scaley, Point2D from)setter for the scale fires a PropertyChangeEvent with the AffineTransforms representing the previous and new values for scale and offsetvoidsetScale(double scalex, double scaley, Point2D from)setter for the scale fires a PropertyChangeEvent with the AffineTransforms representing the previous and new values for scale and offsetvoidsetToIdentity()voidsetTranslate(double tx, double ty)Replace the Transform's translate x and y values with the passed values, leaving the scale values unchanged.voidshear(double shx, double shy, Point2D from)shears the transform by passed parametersvoidtranslate(double offsetx, double offsety)Apply the passed values to the current Transform-
Methods inherited from class org.jungrapht.visualization.transform.AffineTransformer
getInverse, getRotation, getScale, getScaleX, getScaleY, getShearX, getShearY, getTransform, getTranslateX, getTranslateY, inverseTransform, inverseTransform, inverseTransform, scale, setTransform, transform, transform, transform
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jungrapht.visualization.transform.BidirectionalTransformer
inverseTransform, inverseTransform, transform, transform
-
Methods inherited from interface org.jungrapht.visualization.transform.MutableTransformer
getRotation, getScale, getScaleX, getScaleY, getShearX, getShearY, getTransform, getTranslateX, getTranslateY, scale
-
Methods inherited from interface org.jungrapht.visualization.transform.shape.ShapeTransformer
inverseTransform, transform
-
-
-
-
Field Detail
-
changeSupport
protected ChangeEventSupport changeSupport
-
-
Constructor Detail
-
MutableAffineTransformer
public MutableAffineTransformer()
create an instance that does not transform points
-
MutableAffineTransformer
public MutableAffineTransformer(AffineTransform transform)
Create an instance with the supplied transform- Parameters:
transform- the transform to use
-
-
Method Detail
-
scale
public void scale(double scalex, double scaley, Point2D from)setter for the scale fires a PropertyChangeEvent with the AffineTransforms representing the previous and new values for scale and offset- Specified by:
scalein interfaceMutableTransformer- Parameters:
scalex- the amount to scale in the x directionscaley- the amount to scale in the y directionfrom- the point to transform
-
setScale
public void setScale(double scalex, double scaley, Point2D from)setter for the scale fires a PropertyChangeEvent with the AffineTransforms representing the previous and new values for scale and offset- Specified by:
setScalein interfaceMutableTransformer- Parameters:
scalex- the amount to scale in the x directionscaley- the amount to scale in the y directionfrom- the point to transform
-
shear
public void shear(double shx, double shy, Point2D from)shears the transform by passed parameters- Specified by:
shearin interfaceMutableTransformer- Parameters:
shx- x value to shearshy- y value to shearfrom- the point to transform
-
setTranslate
public void setTranslate(double tx, double ty)Replace the Transform's translate x and y values with the passed values, leaving the scale values unchanged.- Specified by:
setTranslatein interfaceMutableTransformer- Parameters:
tx- the x value of the translationty- the y value of the translation
-
translate
public void translate(double offsetx, double offsety)Apply the passed values to the current Transform- Specified by:
translatein interfaceMutableTransformer- Parameters:
offsetx- the x-valueoffsety- the y-value
-
rotate
public void rotate(double theta, Point2D from)preconcatenates the rotation at the supplied point with the current transform- Specified by:
rotatein interfaceMutableTransformer- Parameters:
theta- the angle by which to rotate the pointfrom- the point to transform
-
rotate
public void rotate(double radians, double x, double y)rotates the current transform at the supplied points- Specified by:
rotatein interfaceMutableTransformer- Parameters:
radians- angle by which to rotate the supplied coordinatesx- the x coordinate of the point to transformy- the y coordinate of the point to transform
-
concatenate
public void concatenate(AffineTransform xform)
- Specified by:
concatenatein interfaceMutableTransformer
-
preConcatenate
public void preConcatenate(AffineTransform xform)
- Specified by:
preConcatenatein interfaceMutableTransformer
-
addChangeListener
public void addChangeListener(ChangeListener l)
Adds aChangeListener.- Specified by:
addChangeListenerin interfaceChangeEventSupport- Parameters:
l- the listener to be added
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Removes a ChangeListener.- Specified by:
removeChangeListenerin interfaceChangeEventSupport- Parameters:
l- the listener to be removed
-
getChangeListeners
public ChangeListener[] getChangeListeners()
Returns an array of all theChangeListeners added with addChangeListener().- Specified by:
getChangeListenersin interfaceChangeEventSupport- Returns:
- all of the
ChangeListeners added or an empty array if no listeners have been added
-
fireStateChanged
public void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created.- Specified by:
fireStateChangedin interfaceChangeEventSupport- See Also:
EventListenerList
-
setToIdentity
public void setToIdentity()
- Specified by:
setToIdentityin interfaceMutableTransformer
-
-