y.layout.hierarchic
Class MedianDrawerWrapper

java.lang.Object
  |
  +--y.layout.hierarchic.MedianDrawerWrapper
All Implemented Interfaces:
Drawer

public class MedianDrawerWrapper
extends Object
implements Drawer

This class can be used to improve 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 neighbor layer at the center of the other edges' opposite nodes.


Field Summary
protected  Drawer delegate
          the delegate
protected  NodeMap dummy
          the dummyMap
 
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 delegate)
          Creates a new instance of MedianDrawerWrapper using the delegate to perform the core work.
 
Method Summary
 void assignCoordinates(LayoutGraph g, NodeList[] layerLists, DataProvider layerID)
          This method assigns the coordinates to the nodes.
 Drawer getDelegate()
          Gets the drawer to which the actual drawing will be delegated.
protected  void postprocess(LayoutGraph g, NodeList[] layerLists, NodeMap layerID)
          Called as a hook after the actual drawing is performed by the delegate
protected  void preprocess(LayoutGraph g, NodeList[] layerLists, NodeMap layerID)
          Called as a hook before the actual drawing is performed by the delegate
 void setDelegate(Drawer delegate)
          Sets the drawer to which the actual drawing will be delegated.
 void setDummyMap(NodeMap dummy)
          Gives the drawer the opportunity to distinguish between dummy nodes and real ones. dummy stores the original edge for each dummy node or null for real nodes.
 void setMinimalEdgeDistance(double d)
          Sets the minimal distance between two edges in the same layer.
 void setMinimalLayerDistance(double d)
          Sets the minimal distance between two layers.
 void setMinimalMultiEdgeDistance(double d)
          Sets the minimal distance between two edges sharing source/target (aka multiedges) in the same layer.
 void setMinimalNodeDistance(double d)
          Sets the minimal 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

delegate

protected Drawer delegate
the delegate


dummy

protected NodeMap dummy
the dummyMap

Constructor Detail

MedianDrawerWrapper

public MedianDrawerWrapper(Drawer delegate)
Creates a new instance of MedianDrawerWrapper using the delegate to perform the core work.

Method Detail

assignCoordinates

public void assignCoordinates(LayoutGraph g,
                              NodeList[] layerLists,
                              DataProvider layerID)
Description copied from interface: Drawer
This method assigns the coordinates to the nodes.

Specified by:
assignCoordinates in interface Drawer

setDummyMap

public void setDummyMap(NodeMap dummy)
Description copied from interface: Drawer
Gives the drawer the opportunity to distinguish between dummy nodes and real ones. dummy stores the original edge for each dummy node or null for real nodes.

Specified by:
setDummyMap in interface Drawer

setMinimalEdgeDistance

public void setMinimalEdgeDistance(double d)
Description copied from interface: Drawer
Sets the minimal distance between two edges in the same layer.

Specified by:
setMinimalEdgeDistance in interface Drawer

setMinimalLayerDistance

public void setMinimalLayerDistance(double d)
Description copied from interface: Drawer
Sets the minimal distance between two layers.

Specified by:
setMinimalLayerDistance in interface Drawer

setMinimalMultiEdgeDistance

public void setMinimalMultiEdgeDistance(double d)
Description copied from interface: Drawer
Sets the minimal distance between two edges sharing source/target (aka multiedges) in the same layer.

Specified by:
setMinimalMultiEdgeDistance in interface Drawer

setMinimalNodeDistance

public void setMinimalNodeDistance(double d)
Description copied from interface: Drawer
Sets the minimal distance between two nodes in the same layer.

Specified by:
setMinimalNodeDistance in interface Drawer

preprocess

protected void preprocess(LayoutGraph g,
                          NodeList[] layerLists,
                          NodeMap layerID)
Called as a hook before the actual drawing is performed by the delegate


postprocess

protected void postprocess(LayoutGraph g,
                           NodeList[] layerLists,
                           NodeMap layerID)
Called as a hook after the actual drawing is performed by the delegate


getDelegate

public Drawer getDelegate()
Gets the drawer to which the actual drawing will be delegated.


setDelegate

public void setDelegate(Drawer delegate)
Sets the drawer to which the actual drawing will be delegated.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003