Package nltk :: Package sem :: Module drt :: Class DrsDrawer
[hide private]
[frames] | no frames]

Class DrsDrawer

source code

Instance Methods [hide private]
 
__init__(self, drs, size_canvas=True, canvas=None) source code
 
_get_text_height(self)
Get the height of a line of text
source code
 
draw(self, x=3, y=3)
Draw the DRS
source code
 
_visit(self, expression, x, y)
Return the bottom-rightmost point without actually drawing the item
source code
 
_draw_command(self, item, x, y)
Draw the given item at the given location
source code
 
_visit_command(self, item, x, y)
Return the bottom-rightmost point without actually drawing the item
source code
 
_handle(self, expression, command, x=0, y=0)
Returns: the bottom-rightmost point
source code
 
_handle_VariableExpression(self, expression, command, x, y) source code
 
_handle_NegatedExpression(self, expression, command, x, y) source code
 
_handle_DRS(self, expression, command, x, y) source code
 
_handle_ApplicationExpression(self, expression, command, x, y) source code
 
_handle_LambdaExpression(self, expression, command, x, y) source code
 
_handle_BooleanExpression(self, expression, command, x, y) source code
 
_get_centered_top(self, top, full_height, item_height)
Get the y-coordinate of the point that a figure should start at if its height is 'item_height' and it needs to be centered in an area that starts at 'top' and is 'full_height' tall.
source code
Class Variables [hide private]
  BUFFER = 3
Method Details [hide private]

__init__(self, drs, size_canvas=True, canvas=None)
(Constructor)

source code 
Parameters:
  • drs - AbstractDrs, The DRS to be drawn
  • size_canvas - boolean, True if the canvas size should be the exact size of the DRS
  • canvas - Canvas The canvas on which to draw the DRS. If none is given, create a new canvas.

_visit(self, expression, x, y)

source code 

Return the bottom-rightmost point without actually drawing the item

Parameters:
  • expression - the item to visit
  • x - the top of the current drawing area
  • y - the left side of the current drawing area
Returns:
the bottom-rightmost point

_draw_command(self, item, x, y)

source code 

Draw the given item at the given location

Parameters:
  • item - the item to draw
  • x - the top of the current drawing area
  • y - the left side of the current drawing area
Returns:
the bottom-rightmost point

_visit_command(self, item, x, y)

source code 

Return the bottom-rightmost point without actually drawing the item

Parameters:
  • item - the item to visit
  • x - the top of the current drawing area
  • y - the left side of the current drawing area
Returns:
the bottom-rightmost point

_handle(self, expression, command, x=0, y=0)

source code 
Parameters:
  • expression - the expression to handle
  • command - the function to apply, either _draw_command or _visit_command
  • x - the top of the current drawing area
  • y - the left side of the current drawing area
Returns:
the bottom-rightmost point