y.layout.hierarchic
Class AbstractDrawer

java.lang.Object
  |
  +--y.layout.hierarchic.AbstractDrawer
All Implemented Interfaces:
Drawer
Direct Known Subclasses:
LinearSegmentsDrawer, MedianLinearSegmentDrawer, PendularDrawer, PolylineDrawer, SimplexDrawer, TreeDrawer

public abstract class AbstractDrawer
extends Object
implements Drawer

Abstract base class for the third phase of the sugiyama algorithm. It assigns the coordinates to the nodes according to the defined rangs. It provides methods to assign the Y-Coordinates to the nodes.


Field Summary
protected  NodeMap distanceToNextNode
           
protected  NodeMap dummyMap
           
protected  Object edgeLengthKey
           
protected  LayoutGraph graph
           
protected  double minimalEdgeDistance
           
protected  double minimalLayerDistance
           
protected  double minimalMultiEdgeDistance
           
protected  double minimalNodeDistance
           
 
Fields inherited from interface y.layout.hierarchic.Drawer
NODE_BORDER_BOTTOM, NODE_BORDER_LEFT, NODE_BORDER_RIGHT, NODE_BORDER_TOP, NODE_DISTANCE
 
Constructor Summary
AbstractDrawer()
           
 
Method Summary
 void assignCoordinates(LayoutGraph g, NodeList[] layerLists, DataProvider layerID)
          Binds the specified graph to this drawer and calls the abstract method AbstractDrawer.assignCoordinates(NodeList[],DataProvider)
protected abstract  void assignCoordinates(NodeList[] layerLists, DataProvider layerID)
          Overwrite this method to assign the final coordinates to the objects of he graph.
 void assignYCoords(LayoutGraph graph, NodeCursor[] layers)
          Assign the y coordinates to the nodes respecting the minimal layer distance.
 void assignYCoords(LayoutGraph graph, NodeList[] layerLists)
          Assign the y coordinates to the nodes respecting the minimal layer distance.
protected  void dispose()
          Frees allocated resources after the drawwer is finished.
 double getBottomBorder(Node v)
          Returns the height of the bottom border of the given node.
 double getBottomHalf(Node v)
          Returns the height of the border-obeying bottom half of the node,
 double getBottomY(Node v)
          Returns the border obeying bottom y-coordinate of the given node.
protected  double getDistanceToNextNode(Node v)
          Returns the minimal distance between the right border of the given node and the left border of its right hand side neighbor in the layer.
 double getFullHeight(Node v)
          Returns the border obeying full height of the given node.
 double getFullWidth(Node v)
          Returns the border obeying full width of the given node.
 double getLeftBorder(Node v)
          Returns the width of the left border of the given node.
 double getLeftHalf(Node v)
          Returns the width of the border-obeying left half of the node,
 double getLeftX(Node v)
          Returns the border obeying left x-coordinate of the given node.
 double getMinimalEdgeDistance()
          Returns the minimal distance between two edges in the same layer.
 double getMinimalLayerDistance()
          Returns the minimal distance between two layers.
 double getMinimalMultiEdgeDistance()
          Returns the minimal distance between two edges sharing source/target in the same layer.
 double getMinimalNodeDistance()
          Returns the minimal distance between two nodes in the same layer.
 double getRightBorder(Node v)
          Returns the width of the right border of the given node.
 double getRightHalf(Node v)
          Returns the width of the border-obeying right half of the node,
 double getRightX(Node v)
          Returns the border obeying right x-coordinate of the given node.
 double getTopBorder(Node v)
          Returns the height of the top border of the given node.
 double getTopHalf(Node v)
          Returns the height of the border-obeying top half of the node,
 double getTopY(Node v)
          Returns the border obeying top y-coordinate of the given node.
protected  void initializeDistancesToNextNode(NodeList[] layerLists)
          Initializes the minimal distances between the right border of a node and the left border of its right hand side neighbor in a layer.
 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 setEdgeLengthKey(Object key)
          Set the key to the data provider, which stores the length of the edges.
 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 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

minimalNodeDistance

protected double minimalNodeDistance

minimalLayerDistance

protected double minimalLayerDistance

minimalEdgeDistance

protected double minimalEdgeDistance

minimalMultiEdgeDistance

protected double minimalMultiEdgeDistance

dummyMap

protected NodeMap dummyMap

edgeLengthKey

protected Object edgeLengthKey

graph

protected LayoutGraph graph

distanceToNextNode

protected NodeMap distanceToNextNode
Constructor Detail

AbstractDrawer

public AbstractDrawer()
Method Detail

setMinimalEdgeDistance

public void setMinimalEdgeDistance(double d)
Sets the minimal distance between two edges in the same layer.

Specified by:
setMinimalEdgeDistance in interface Drawer

setMinimalMultiEdgeDistance

public void setMinimalMultiEdgeDistance(double d)
Sets the minimal distance between two edges sharing source/target in the same layer.

Specified by:
setMinimalMultiEdgeDistance in interface Drawer

getMinimalEdgeDistance

public double getMinimalEdgeDistance()
Returns the minimal distance between two edges in the same layer.


getMinimalMultiEdgeDistance

public double getMinimalMultiEdgeDistance()
Returns the minimal distance between two edges sharing source/target in the same layer.


setMinimalNodeDistance

public void setMinimalNodeDistance(double d)
Sets the minimal distance between two nodes in the same layer.

Specified by:
setMinimalNodeDistance in interface Drawer

setMinimalLayerDistance

public void setMinimalLayerDistance(double d)
Sets the minimal distance between two layers.

Specified by:
setMinimalLayerDistance in interface Drawer

setDummyMap

public 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.

Specified by:
setDummyMap in interface Drawer

getMinimalNodeDistance

public double getMinimalNodeDistance()
Returns the minimal distance between two nodes in the same layer.


getMinimalLayerDistance

public double getMinimalLayerDistance()
Returns the minimal distance between two layers.


setEdgeLengthKey

public void setEdgeLengthKey(Object key)
Set the key to the data provider, which stores the length of the edges. Remark: Edges, which are split in the firts phase do no longer supply lengths. This should not be to criticall as they span at least two layers and are so hopefully long enough.


assignYCoords

public void assignYCoords(LayoutGraph graph,
                          NodeList[] layerLists)
Assign the y coordinates to the nodes respecting the minimal layer distance.


assignYCoords

public void assignYCoords(LayoutGraph graph,
                          NodeCursor[] layers)
Assign the y coordinates to the nodes respecting the minimal layer distance.


assignCoordinates

public void assignCoordinates(LayoutGraph g,
                              NodeList[] layerLists,
                              DataProvider layerID)
Binds the specified graph to this drawer and calls the abstract method AbstractDrawer.assignCoordinates(NodeList[],DataProvider)

Specified by:
assignCoordinates in interface Drawer

assignCoordinates

protected abstract void assignCoordinates(NodeList[] layerLists,
                                          DataProvider layerID)
Overwrite this method to assign the final coordinates to the objects of he graph.


getLeftX

public double getLeftX(Node v)
Returns the border obeying left x-coordinate of the given node.


getRightX

public double getRightX(Node v)
Returns the border obeying right x-coordinate of the given node.


getTopY

public double getTopY(Node v)
Returns the border obeying top y-coordinate of the given node.


getBottomY

public double getBottomY(Node v)
Returns the border obeying bottom y-coordinate of the given node.


getFullWidth

public double getFullWidth(Node v)
Returns the border obeying full width of the given node.


getFullHeight

public double getFullHeight(Node v)
Returns the border obeying full height of the given node.


getLeftBorder

public double getLeftBorder(Node v)
Returns the width of the left border of the given node.


getRightBorder

public double getRightBorder(Node v)
Returns the width of the right border of the given node.


getTopBorder

public double getTopBorder(Node v)
Returns the height of the top border of the given node.


getBottomBorder

public double getBottomBorder(Node v)
Returns the height of the bottom border of the given node.


getLeftHalf

public double getLeftHalf(Node v)
Returns the width of the border-obeying left half of the node,


getRightHalf

public double getRightHalf(Node v)
Returns the width of the border-obeying right half of the node,


getTopHalf

public double getTopHalf(Node v)
Returns the height of the border-obeying top half of the node,


getBottomHalf

public double getBottomHalf(Node v)
Returns the height of the border-obeying bottom half of the node,


initializeDistancesToNextNode

protected void initializeDistancesToNextNode(NodeList[] layerLists)
Initializes the minimal distances between the right border of a node and the left border of its right hand side neighbor in a layer.

See Also:
AbstractDrawer.getDistanceToNextNode(Node), AbstractDrawer.distanceToNextNode

getDistanceToNextNode

protected double getDistanceToNextNode(Node v)
Returns the minimal distance between the right border of the given node and the left border of its right hand side neighbor in the layer. Node minimal node distances are constructed by using the values provided by the dataproviders that are re gistered with the input graph under the keys Drawer.NODE_DISTANCE, Drawer.NODE_BORDER_LEFT and Drawer.NODE_BORDER_RIGHT.


dispose

protected void dispose()
Frees allocated resources after the drawwer is finished.


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

2003