com.googlecode.whatswrong
Class SingleSentenceRenderer

java.lang.Object
  extended by com.googlecode.whatswrong.SingleSentenceRenderer
All Implemented Interfaces:
NLPCanvasRenderer

public class SingleSentenceRenderer
extends java.lang.Object
implements NLPCanvasRenderer

A SingleSentenceRenderer renders an NLPInstance as a single sentence with spans drawn below the tokens, and dependencies above the tokens.

Author:
Sebastian Riedel

Constructor Summary
SingleSentenceRenderer()
           
 
Method Summary
 int getHeightFactor()
          Returns an integer that reflects the height of the graph.
 int getMargin()
          Returns the margin between tokens.
 boolean isAntiAliasing()
          Should anti-aliasing be used when drawing the graph.
 boolean isCurved()
          Returns whether the renderer draws a more curved graph or not.
 java.awt.Dimension render(NLPInstance instance, java.awt.Graphics2D graphics2D)
          Renders the given instance as a single sentence with spans drawn below tokens, and dependencies above tokens.
 void setAntiAliasing(boolean antiAliasing)
          Should anti-aliasing be used when drawing the graph.
 void setCurved(boolean isCurved)
          Controls whether the graph should be curved or rectangular.
 void setEdgeTypeColor(java.lang.String edgeType, java.awt.Color color)
          Set the color for edges of a certain type.
 void setEdgeTypeOrder(java.lang.String edgeType, int order)
          Sets the order/vertical layer in which the area of a certain type should be drawn.
 void setHeightFactor(int heightFactor)
          Controls the height of the graph.
 void setMargin(int margin)
          Sets the margin between tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleSentenceRenderer

public SingleSentenceRenderer()
Method Detail

render

public java.awt.Dimension render(NLPInstance instance,
                                 java.awt.Graphics2D graphics2D)
Renders the given instance as a single sentence with spans drawn below tokens, and dependencies above tokens.

Specified by:
render in interface NLPCanvasRenderer
Parameters:
instance - the instance to render
graphics2D - the graphics object to draw upon
Returns:
the width and height of the drawn object.
See Also:
NLPCanvasRenderer.render(NLPInstance, Graphics2D)

setAntiAliasing

public void setAntiAliasing(boolean antiAliasing)
Should anti-aliasing be used when drawing the graph.

Specified by:
setAntiAliasing in interface NLPCanvasRenderer
Parameters:
antiAliasing - rue iff anti-aliasing should be used when drawing the graph.

setMargin

public void setMargin(int margin)
Sets the margin between tokens.

Specified by:
setMargin in interface NLPCanvasRenderer
Parameters:
margin - the margin between tokens.

getMargin

public int getMargin()
Returns the margin between tokens.

Specified by:
getMargin in interface NLPCanvasRenderer
Returns:
the margin between tokens.

setHeightFactor

public void setHeightFactor(int heightFactor)
Controls the height of the graph.

Specified by:
setHeightFactor in interface NLPCanvasRenderer
Parameters:
heightFactor - an integer that indicates how high the graph should be.

getHeightFactor

public int getHeightFactor()
Returns an integer that reflects the height of the graph.

Specified by:
getHeightFactor in interface NLPCanvasRenderer
Returns:
an integer that reflects the height of the graph. The higher this value, the higher the graph.

setCurved

public void setCurved(boolean isCurved)
Controls whether the graph should be curved or rectangular. If curved the dependencies are drawn as curves instead of rectangular lines, and spans are drawn as rounded rectangles.

Specified by:
setCurved in interface NLPCanvasRenderer
Parameters:
isCurved - should the graph be more curved.
See Also:
NLPCanvasRenderer.setCurved(boolean)

isCurved

public boolean isCurved()
Returns whether the renderer draws a more curved graph or not.

Specified by:
isCurved in interface NLPCanvasRenderer
Returns:
true iff the renderer draws a more curved graph.

setEdgeTypeColor

public void setEdgeTypeColor(java.lang.String edgeType,
                             java.awt.Color color)
Set the color for edges of a certain type.

Specified by:
setEdgeTypeColor in interface NLPCanvasRenderer
Parameters:
edgeType - the type of the edges we want to change the color for.
color - the color of the edges of the given type.

setEdgeTypeOrder

public void setEdgeTypeOrder(java.lang.String edgeType,
                             int order)
Sets the order/vertical layer in which the area of a certain type should be drawn.

Specified by:
setEdgeTypeOrder in interface NLPCanvasRenderer
Parameters:
edgeType - the type we want to change the order for.
order - the order/vertical layer in which the area of the given type should be drawn.

isAntiAliasing

public boolean isAntiAliasing()
Should anti-aliasing be used when drawing the graph.

Specified by:
isAntiAliasing in interface NLPCanvasRenderer
Returns:
true iff anti-aliasing should be used when drawing the graph.


Copyright © 2009. All Rights Reserved.