|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.hierarchic.MedianDrawerWrapper
public class MedianDrawerWrapper
This class can be used for improving the results of different drawers.
It is designed as a wrapper to another drawer (especially SimplexDrawer
).
It will insert additional dummy nodes for each node that has an even number of
incoming edges or outgoing edges. Dummy nodes will be inserted in the neighboring
layer at the center of the other edges' opposite nodes.
The produced drawings are considered to be more symmetric.
Field Summary | |
---|---|
protected Drawer |
drawerDelegate
The delegate Drawer instance that will perform the actual drawing. |
protected NodeMap |
dummy
A NodeMap used for identifying dummy nodes. |
Fields inherited from interface y.layout.hierarchic.Drawer |
---|
NODE_BORDER_BOTTOM, NODE_BORDER_LEFT, NODE_BORDER_RIGHT, NODE_BORDER_TOP, NODE_DISTANCE |
Constructor Summary | |
---|---|
MedianDrawerWrapper(Drawer drawerDelegate)
Creates an instance of MedianDrawerWrapper using the delegate Drawer instance to
perform the core work. |
Method Summary | |
---|---|
void |
assignCoordinates(LayoutGraph graph,
NodeList[] layerLists,
DataProvider layerID)
Assigns the coordinates to the nodes of the given graph. |
Drawer |
getDelegate()
Returns the Drawer to which the actual drawing is delegated. |
protected void |
postprocess(LayoutGraph graph,
NodeList[] layerLists,
NodeMap layerID)
Called as a hook after the actual drawing is performed by the delegate Drawer instance. |
protected void |
preprocess(LayoutGraph graph,
NodeList[] layerLists,
NodeMap layerID)
Called as a hook before the actual drawing is performed by the delegate Drawer instance. |
void |
setDelegate(Drawer drawerDelegate)
Specifies the Drawer to which the actual drawing is delegated. |
void |
setDummyMap(NodeMap dummyMap)
Specifies a NodeMap instance for identifying the dummy nodes from the real ones. |
void |
setMinimalEdgeDistance(double d)
Specifies the minimum distance between two edges that span the same layer. |
void |
setMinimalLayerDistance(double d)
Specifies the minimum distance between two layers. |
void |
setMinimalMultiEdgeDistance(double d)
Specifies the minimum distance between two edges sharing source/target in the same layer. |
void |
setMinimalNodeDistance(double d)
Specifies the minimum distance between two nodes in the same layer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Drawer drawerDelegate
Drawer
instance that will perform the actual drawing.
setDummyMap(NodeMap)
protected NodeMap dummy
NodeMap
used for identifying dummy nodes.
It returns the original edge for each dummy node or null
for real nodes.
setDummyMap(y.base.NodeMap)
Constructor Detail |
---|
public MedianDrawerWrapper(Drawer drawerDelegate)
MedianDrawerWrapper
using the delegate Drawer
instance to
perform the core work.
drawerDelegate
- the delegate Drawer
instanceMethod Detail |
---|
public void assignCoordinates(LayoutGraph graph, NodeList[] layerLists, DataProvider layerID)
Drawer
assignCoordinates
in interface Drawer
graph
- the graphlayerLists
- the array of NodeList
s each of which contains nodes that belong to the same layerlayerID
- the DataProvider
that returns the zero-based index of the layer to which each node belongspublic void setDummyMap(NodeMap dummyMap)
NodeMap
instance for identifying the dummy nodes from the real ones.
setDummyMap
in interface Drawer
dummyMap
- the NodeMap
that returns the original edge for each dummy node or
null
for real nodespublic void setMinimalEdgeDistance(double d)
Minimum distance must be non-negative.
setMinimalEdgeDistance
in interface Drawer
public void setMinimalLayerDistance(double d)
Minimum distance must be non-negative.
setMinimalLayerDistance
in interface Drawer
public void setMinimalMultiEdgeDistance(double d)
Minimum distance must be non-negative.
setMinimalMultiEdgeDistance
in interface Drawer
public void setMinimalNodeDistance(double d)
Minimum distance must be non-negative.
setMinimalNodeDistance
in interface Drawer
protected void preprocess(LayoutGraph graph, NodeList[] layerLists, NodeMap layerID)
Drawer
instance.
This method is called by assignCoordinates(LayoutGraph, NodeList[], DataProvider)
and calculates the
dummy nodes that have to be inserted to the graph for each node that has an even number of
incoming edges or outgoing edges. These nodes are being removed in
postprocess(LayoutGraph, NodeList[], NodeMap)
method.
graph
- the graphlayerLists
- an array of NodeList
s each of which contains nodes that belong to the same layerlayerID
- the NodeMap
that will be filled during the calculation and holds the zero-based index of
the layer to which each node belongspostprocess(LayoutGraph, NodeList[], NodeMap)
protected void postprocess(LayoutGraph graph, NodeList[] layerLists, NodeMap layerID)
Drawer
instance.
This method is called by assignCoordinates(LayoutGraph, NodeList[], DataProvider)
as a last step in
order to remove the dummy nodes inserted by preprocess(LayoutGraph, NodeList[], NodeMap)
method
and restore the graph.
graph
- the graphlayerLists
- an array of NodeList
s each of which contains nodes that belong to the same layerlayerID
- the NodeMap
that returns the zero-based index of the layer to which each node belongspostprocess(LayoutGraph, NodeList[], NodeMap)
public Drawer getDelegate()
Drawer
to which the actual drawing is delegated.
Drawer
instance that performs the actual drawingsetDelegate(Drawer)
public void setDelegate(Drawer drawerDelegate)
Drawer
to which the actual drawing is delegated.
drawerDelegate
- the given Drawer
instance that performs the actual drawing
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |