Package org.jungrapht.visualization
Class DefaultTransformer
- java.lang.Object
-
- org.jungrapht.visualization.DefaultTransformer
-
- All Implemented Interfaces:
EventListener
,ChangeListener
,MultiLayerTransformer
,BidirectionalTransformer
,ShapeTransformer
,ChangeEventSupport
public class DefaultTransformer extends Object implements MultiLayerTransformer, ShapeTransformer, ChangeListener, ChangeEventSupport
A basic implementation of the MultiLayerTransformer interface that provides two Layers: VIEW and LAYOUT. It also provides ChangeEventSupport- Author:
- Tom Nelson
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.MultiLayerTransformer
MultiLayerTransformer.Layer
-
-
Field Summary
Fields Modifier and Type Field Description protected ChangeEventSupport
changeSupport
protected MutableTransformer
layoutTransformer
protected MutableTransformer
viewTransformer
-
Constructor Summary
Constructors Constructor Description DefaultTransformer()
Creates an instance and notifies the view and layout Functions to listen to changes published by this instance.
-
Method Summary
-
-
-
Field Detail
-
changeSupport
protected ChangeEventSupport changeSupport
-
viewTransformer
protected MutableTransformer viewTransformer
-
layoutTransformer
protected MutableTransformer layoutTransformer
-
-
Method Detail
-
setViewTransformer
protected void setViewTransformer(MutableTransformer Function)
-
setLayoutTransformer
protected void setLayoutTransformer(MutableTransformer Function)
-
getLayoutTransformer
protected MutableTransformer getLayoutTransformer()
-
getViewTransformer
protected MutableTransformer getViewTransformer()
-
inverseTransform
public Point2D inverseTransform(Point2D p)
Description copied from interface:BidirectionalTransformer
convert the supplied screen coordinate to the graph coordinate.- Specified by:
inverseTransform
in interfaceBidirectionalTransformer
- Parameters:
p
- screen point to convert- Returns:
- the graph point
-
inverseTransform
public Point2D inverseTransform(double x, double y)
- Specified by:
inverseTransform
in interfaceBidirectionalTransformer
-
transform
public Point2D transform(Point2D p)
Description copied from interface:BidirectionalTransformer
convert the supplied graph coordinate to the screen coordinate- Specified by:
transform
in interfaceBidirectionalTransformer
- Parameters:
p
- graph point to convert- Returns:
- screen point
-
transform
public Point2D transform(double x, double y)
- Specified by:
transform
in interfaceBidirectionalTransformer
-
inverseTransform
public Shape inverseTransform(Shape shape)
- Specified by:
inverseTransform
in interfaceShapeTransformer
-
transform
public Shape transform(Shape shape)
Description copied from interface:ShapeTransformer
map a shape from graph coordinate system to the screen coordinate system- Specified by:
transform
in interfaceShapeTransformer
- Parameters:
shape
- the Shape to transform- Returns:
- a GeneralPath (Shape) representing the screen points of the shape
-
setToIdentity
public void setToIdentity()
- Specified by:
setToIdentity
in interfaceMultiLayerTransformer
-
addChangeListener
public void addChangeListener(ChangeListener l)
- Specified by:
addChangeListener
in interfaceChangeEventSupport
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Description copied from interface:ChangeEventSupport
Removes a ChangeListener.- Specified by:
removeChangeListener
in interfaceChangeEventSupport
- Parameters:
l
- the listener to be removed
-
getChangeListeners
public ChangeListener[] getChangeListeners()
Description copied from interface:ChangeEventSupport
Returns an array of all theChangeListener
s added with addChangeListener().- Specified by:
getChangeListeners
in interfaceChangeEventSupport
- Returns:
- all of the
ChangeListener
s added or an empty array if no listeners have been added
-
fireStateChanged
public void fireStateChanged()
- Specified by:
fireStateChanged
in interfaceChangeEventSupport
-
stateChanged
public void stateChanged(ChangeEvent e)
- Specified by:
stateChanged
in interfaceChangeListener
-
getTransformer
public MutableTransformer getTransformer(MultiLayerTransformer.Layer layer)
- Specified by:
getTransformer
in interfaceMultiLayerTransformer
-
inverseTransform
public Point2D inverseTransform(MultiLayerTransformer.Layer layer, Point2D p)
- Specified by:
inverseTransform
in interfaceMultiLayerTransformer
-
inverseTransform
public Point2D inverseTransform(MultiLayerTransformer.Layer layer, double x, double y)
- Specified by:
inverseTransform
in interfaceMultiLayerTransformer
-
setTransformer
public void setTransformer(MultiLayerTransformer.Layer layer, MutableTransformer Function)
- Specified by:
setTransformer
in interfaceMultiLayerTransformer
-
transform
public Point2D transform(MultiLayerTransformer.Layer layer, Point2D p)
- Specified by:
transform
in interfaceMultiLayerTransformer
-
transform
public Point2D transform(MultiLayerTransformer.Layer layer, double x, double y)
- Specified by:
transform
in interfaceMultiLayerTransformer
-
transform
public Shape transform(MultiLayerTransformer.Layer layer, Shape shape)
- Specified by:
transform
in interfaceMultiLayerTransformer
-
inverseTransform
public Shape inverseTransform(MultiLayerTransformer.Layer layer, Shape shape)
- Specified by:
inverseTransform
in interfaceMultiLayerTransformer
-
-