com.googlecode.whatswrong
Class DependencyLayout

java.lang.Object
  extended by com.googlecode.whatswrong.AbstractEdgeLayout
      extended by com.googlecode.whatswrong.DependencyLayout

public class DependencyLayout
extends AbstractEdgeLayout

A DependencyLayout lays out edges in a dependency parse layout. Here the edge from head to modifier is represented as a directed edge that starts at the head, first goes up and then down to the modifier. The height depends on the number of other edges between the head and the modifier.

Note that all incoming and outgoing edges of a token are placed along the upper edge of the token bounding box in an order that depends on the distance of the other token of the edge. The further away the other token is, the closer the edge start or end point is to the middle of the token bounding box. There is one exception to this rule: self loops always start at the leftmost position and end at the rightmost position.

Author:
Sebastian Riedel

Field Summary
 
Fields inherited from class com.googlecode.whatswrong.AbstractEdgeLayout
baseline, curve, from, heightPerLevel, maxHeight, maxWidth, shapes, to, vertexExtraSpace, visible
 
Constructor Summary
DependencyLayout()
           
 
Method Summary
 int getArrowSize()
          Return the arrow size.
 java.awt.Dimension layoutEdges(java.util.Collection<Edge> edges, java.util.Map<Token,Bounds1D> bounds, java.awt.Graphics2D g2d)
          Lays out the edges as directed labelled dependency links between tokens.
 void setArrowSize(int arrowSize)
          The size of the arrow.
 
Methods inherited from class com.googlecode.whatswrong.AbstractEdgeLayout
addToSelection, calculateDepth, clearSelection, getBaseline, getColor, getEdgeAt, getFrom, getHeight, getHeightPerLevel, getSelected, getStroke, getStroke, getTo, getVertexExtraSpace, getWidth, isCurve, onlyShow, removeFromSelection, select, setBaseline, setColor, setCurve, setHeightPerLevel, setStroke, setVertexExtraSpace, showAll, toggleSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DependencyLayout

public DependencyLayout()
Method Detail

layoutEdges

public java.awt.Dimension layoutEdges(java.util.Collection<Edge> edges,
                                      java.util.Map<Token,Bounds1D> bounds,
                                      java.awt.Graphics2D g2d)
Lays out the edges as directed labelled dependency links between tokens.

Parameters:
edges - the edges to layout.
bounds - the bounds of the tokens the edges connect.
g2d - the graphics object to draw on.
Returns:
the dimensions of the drawn graph.

setArrowSize

public void setArrowSize(int arrowSize)
The size of the arrow.

Parameters:
arrowSize - the size of the arrow.

getArrowSize

public int getArrowSize()
Return the arrow size.

Returns:
the size of the arrow.


Copyright © 2010. All Rights Reserved.