<s> '''<STR_LIT>''' <EOL> from attributes import * <EOL> from core import BaseElement , BaseShape , PointAttrib , DimensionAttrib , PointToAttrib <EOL> class rect ( BaseShape , PointAttrib , DimensionAttrib ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , x = None , y = None , width = None , height = None , rx = None , ry = None , ** kwargs ) : <EOL> BaseElement . __init__ ( self , '<STR_LIT>' ) <EOL> self . set_x ( x ) <EOL> self . set_y ( y ) <EOL> self . set_height ( height ) <EOL> self . set_width ( width ) <EOL> self . set_rx ( rx ) <EOL> self . set_ry ( ry ) <EOL> self . setKWARGS ( ** kwargs ) <EOL> def set_rx ( self , rx ) : <EOL> self . _attributes [ '<STR_LIT>' ] = rx <EOL> def get_rx ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_ry ( self , ry ) : <EOL> self . _attributes [ '<STR_LIT>' ] = ry <EOL> def get_ry ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def getEdgePoints ( self ) : <EOL> """<STR_LIT>""" <EOL> result = [ ( float ( self . get_x ( ) ) , float ( self . get_y ( ) ) ) ] <EOL> result . append ( ( float ( self . get_x ( ) ) + float ( self . get_width ( ) ) , float ( self . get_y ( ) ) ) ) <EOL> result . append ( ( float ( self . get_x ( ) ) + float ( self . get_width ( ) ) , float ( self . get_y ( ) ) + float ( self . get_height ( ) ) ) ) <EOL> result . append ( ( float ( self . get_x ( ) ) , float ( self . get_y ( ) ) + float ( self . get_height ( ) ) ) ) <EOL> return result <EOL> def getInnerEdgePoints ( self ) : <EOL> """<STR_LIT>""" <EOL> result = [ ] <EOL> result . append ( ( float ( self . get_x ( ) ) + float ( self . get_rx ( ) ) , float ( self . get_y ( ) ) + float ( self . get_ry ( ) ) ) ) <EOL> result . append ( ( float ( self . get_x ( ) ) + float ( self . get_width ( ) ) - float ( self . get_rx ( ) ) , float ( self . get_y ( ) ) + float ( self . get_ry ( ) ) ) ) <EOL> result . append ( ( float ( self . get_x ( ) ) + float ( self . get_width ( ) ) - float ( self . get_rx ( ) ) , float ( self . get_y ( ) ) + float ( self . get_height ( ) ) - float ( self . get_ry ( ) ) ) ) <EOL> result . append ( ( float ( self . get_x ( ) ) + float ( self . get_rx ( ) ) , float ( self . get_y ( ) ) + float ( self . get_height ( ) ) - float ( self . get_ry ( ) ) ) ) <EOL> return result <EOL> def getBottomLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_x ( ) ) , float ( self . get_y ( ) ) ) <EOL> def getBottomRight ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_x ( ) ) + float ( self . get_width ( ) ) , float ( self . get_y ( ) ) ) <EOL> def getTopLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_x ( ) ) , float ( self . get_y ( ) ) + float ( self . get_height ( ) ) ) <EOL> def getTopRight ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_x ( ) ) + float ( self . get_width ( ) ) , float ( self . get_y ( ) ) + float ( self . get_height ( ) ) ) <EOL> def moveToPoint ( self , ( x , y ) ) : <EOL> """<STR_LIT>""" <EOL> self . set_x ( float ( self . get_x ( ) ) + float ( x ) ) <EOL> self . set_y ( float ( self . get_y ( ) ) + float ( y ) ) <EOL> class circle ( BaseShape ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , cx = None , cy = None , r = None , ** kwargs ) : <EOL> BaseElement . __init__ ( self , '<STR_LIT>' ) <EOL> self . set_cx ( cx ) <EOL> self . set_cy ( cy ) <EOL> self . set_r ( r ) <EOL> self . setKWARGS ( ** kwargs ) <EOL> def set_cx ( self , cx ) : <EOL> self . _attributes [ '<STR_LIT>' ] = cx <EOL> def get_cx ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_cy ( self , cy ) : <EOL> self . _attributes [ '<STR_LIT>' ] = cy <EOL> def get_cy ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_r ( self , r ) : <EOL> self . _attributes [ '<STR_LIT:r>' ] = r <EOL> def get_r ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT:r>' ) <EOL> def getDiameter ( self ) : <EOL> """<STR_LIT>""" <EOL> return <NUM_LIT:2> * float ( self . get_r ( ) ) <EOL> def getWidth ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . getDiameter ( ) <EOL> def getHeight ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . getDiameter ( ) <EOL> def getBottomLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) - float ( self . get_r ( ) ) , float ( self . get_cy ( ) ) - float ( self . get_r ( ) ) ) <EOL> def getBottomRight ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) + float ( self . get_r ( ) ) , float ( self . get_cy ( ) ) - float ( self . get_r ( ) ) ) <EOL> def getTopLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) - float ( self . get_r ( ) ) , float ( self . get_cy ( ) ) + float ( self . get_r ( ) ) ) <EOL> def getTopRight ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) + float ( self . get_r ( ) ) , float ( self . get_cy ( ) ) + float ( self . get_r ( ) ) ) <EOL> def moveToPoint ( self , ( x , y ) ) : <EOL> """<STR_LIT>""" <EOL> self . set_cx ( float ( self . get_cx ( ) ) + float ( x ) ) <EOL> self . set_cy ( float ( self . get_cy ( ) ) + float ( y ) ) <EOL> class ellipse ( BaseShape ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , cx = None , cy = None , rx = None , ry = None , ** kwargs ) : <EOL> BaseElement . __init__ ( self , '<STR_LIT>' ) <EOL> self . set_cx ( cx ) <EOL> self . set_cy ( cy ) <EOL> self . set_rx ( rx ) <EOL> self . set_ry ( ry ) <EOL> self . setKWARGS ( ** kwargs ) <EOL> def set_cx ( self , cx ) : <EOL> self . _attributes [ '<STR_LIT>' ] = cx <EOL> def get_cx ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_cy ( self , cy ) : <EOL> self . _attributes [ '<STR_LIT>' ] = cy <EOL> def get_cy ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_rx ( self , rx ) : <EOL> self . _attributes [ '<STR_LIT>' ] = rx <EOL> def get_rx ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_ry ( self , ry ) : <EOL> self . _attributes [ '<STR_LIT>' ] = ry <EOL> def get_ry ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def getWidth ( self ) : <EOL> return abs ( <NUM_LIT:2> * float ( self . get_rx ( ) ) ) <EOL> def getHeight ( self ) : <EOL> return abs ( <NUM_LIT:2> * float ( self . get_ry ( ) ) ) <EOL> def getBottomLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) - float ( self . get_rx ( ) ) , float ( self . get_cy ( ) ) - float ( self . get_ry ( ) ) ) <EOL> def getBottomRight ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) + float ( self . get_rx ( ) ) , float ( self . get_cy ( ) ) - float ( self . get_ry ( ) ) ) <EOL> def getTopLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) - float ( self . get_rx ( ) ) , float ( self . get_cy ( ) ) + float ( self . get_ry ( ) ) ) <EOL> def getTopRight ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( float ( self . get_cx ( ) ) + float ( self . get_rx ( ) ) , float ( self . get_cy ( ) ) + float ( self . get_ry ( ) ) ) <EOL> class line ( BaseShape , PointToAttrib ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , X1 = None , Y1 = None , X2 = None , Y2 = None , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> BaseElement . __init__ ( self , '<STR_LIT>' ) <EOL> self . set_x1 ( X1 ) <EOL> self . set_y1 ( Y1 ) <EOL> self . set_x2 ( X2 ) <EOL> self . set_y2 ( Y2 ) <EOL> self . setKWARGS ( ** kwargs ) <EOL> def set_x1 ( self , x1 ) : <EOL> self . _attributes [ '<STR_LIT>' ] = x1 <EOL> def get_x1 ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_y1 ( self , y1 ) : <EOL> self . _attributes [ '<STR_LIT>' ] = y1 <EOL> def get_y1 ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_x2 ( self , x2 ) : <EOL> self . _attributes [ '<STR_LIT>' ] = x2 <EOL> def get_x2 ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def set_y2 ( self , y2 ) : <EOL> self . _attributes [ '<STR_LIT>' ] = y2 <EOL> def get_y2 ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def getWidth ( self ) : <EOL> """<STR_LIT>""" <EOL> return abs ( float ( self . get_x1 ( ) ) - float ( self . get_x2 ( ) ) ) <EOL> def getHeight ( self ) : <EOL> """<STR_LIT>""" <EOL> return abs ( float ( self . get_y1 ( ) ) - float ( self . get_y2 ( ) ) ) <EOL> def getBottomLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> x1 = float ( self . get_x1 ( ) ) <EOL> x2 = float ( self . get_x2 ( ) ) <EOL> y1 = float ( self . get_y1 ( ) ) <EOL> y2 = float ( self . get_y2 ( ) ) <EOL> if x1 < x2 : <EOL> if y1 < y2 : <EOL> return ( x1 , y1 ) <EOL> else : <EOL> return ( x1 , y2 ) <EOL> else : <EOL> if y1 < y2 : <EOL> return ( x2 , y1 ) <EOL> else : <EOL> return ( x2 , y2 ) <EOL> def getBottomRight ( self ) : <EOL> """<STR_LIT>""" <EOL> x1 = float ( self . get_x1 ( ) ) <EOL> x2 = float ( self . get_x2 ( ) ) <EOL> y1 = float ( self . get_y1 ( ) ) <EOL> y2 = float ( self . get_y2 ( ) ) <EOL> if x1 < x2 : <EOL> if y1 < y2 : <EOL> return ( x2 , y1 ) <EOL> else : <EOL> return ( x2 , y2 ) <EOL> else : <EOL> if y1 < y2 : <EOL> return ( x1 , y1 ) <EOL> else : <EOL> return ( x1 , y2 ) <EOL> def getTopRight ( self ) : <EOL> """<STR_LIT>""" <EOL> x1 = float ( self . get_x1 ( ) ) <EOL> x2 = float ( self . get_x2 ( ) ) <EOL> y1 = float ( self . get_y1 ( ) ) <EOL> y2 = float ( self . get_y2 ( ) ) <EOL> if x1 < x2 : <EOL> if y1 < y2 : <EOL> return ( x2 , y2 ) <EOL> else : <EOL> return ( x2 , y1 ) <EOL> else : <EOL> if y1 < y2 : <EOL> return ( x1 , y2 ) <EOL> else : <EOL> return ( x1 , y1 ) <EOL> def getTopLeft ( self ) : <EOL> """<STR_LIT>""" <EOL> x1 = float ( self . get_x1 ( ) ) <EOL> x2 = float ( self . get_x2 ( ) ) <EOL> y1 = float ( self . get_y1 ( ) ) <EOL> y2 = float ( self . get_y2 ( ) ) <EOL> if x1 < x2 : <EOL> if y1 < y2 : <EOL> return ( x1 , y2 ) <EOL> else : <EOL> return ( x1 , y1 ) <EOL> else : <EOL> if y1 < y2 : <EOL> return ( x2 , y2 ) <EOL> else : <EOL> return ( x2 , y1 ) <EOL> def moveToPoint ( self , ( x , y ) ) : <EOL> """<STR_LIT>""" <EOL> self . set_x1 ( float ( self . get_x1 ( ) ) + float ( x ) ) <EOL> self . set_x2 ( float ( self . get_x2 ( ) ) + float ( x ) ) <EOL> self . set_y1 ( float ( self . get_y1 ( ) ) + float ( y ) ) <EOL> self . set_y2 ( float ( self . get_y2 ( ) ) + float ( y ) ) <EOL> class path ( BaseShape , ExternalAttrib , MarkerAttrib ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , pathData = "<STR_LIT>" , pathLength = None , style = None , focusable = None , ** kwargs ) : <EOL> BaseElement . __init__ ( self , '<STR_LIT:path>' ) <EOL> if pathData != '<STR_LIT>' and not pathData . endswith ( '<STR_LIT:U+0020>' ) : <EOL> pathData += '<STR_LIT:U+0020>' <EOL> self . set_d ( pathData ) <EOL> if style != None : <EOL> self . set_style ( style ) <EOL> self . setKWARGS ( ** kwargs ) <EOL> def set_d ( self , d ) : <EOL> self . _attributes [ '<STR_LIT:d>' ] = d <EOL> def get_d ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT:d>' ) <EOL> def set_pathLength ( self , pathLength ) : <EOL> self . _attributes [ '<STR_LIT>' ] = pathLength <EOL> def get_pathLength ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> def __append__ ( self , command , params , relative = True ) : <EOL> d = self . get_d ( ) <EOL> if relative == True : <EOL> d += command . lower ( ) <EOL> else : <EOL> d += command . upper ( ) <EOL> for param in params : <EOL> d += '<STR_LIT>' % ( param ) <EOL> self . set_d ( d ) <EOL> def appendLineToPath ( self , endx , endy , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:l>' , [ endx , endy ] , relative ) <EOL> def appendHorizontalLineToPath ( self , endx , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:h>' , [ endx ] , relative ) <EOL> def appendVerticalLineToPath ( self , endy , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:v>' , [ endy ] , relative ) <EOL> def appendMoveToPath ( self , endx , endy , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:m>' , [ endx , endy ] , relative ) <EOL> def appendCloseCurve ( self ) : <EOL> d = self . get_d ( ) <EOL> d += "<STR_LIT:z>" <EOL> self . set_d ( d ) <EOL> def appendCubicCurveToPath ( self , controlstartx , controlstarty , controlendx , controlendy , endx , endy , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:c>' , [ controlstartx , controlstarty , controlendx , controlendy , endx , endy ] , relative ) <EOL> def appendCubicShorthandCurveToPath ( self , controlendx , controlendy , endx , endy , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:s>' , [ controlendx , controlendy , endx , endy ] , relative ) <EOL> def appendQuadraticCurveToPath ( self , controlx , controly , endx , endy , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:q>' , [ controlx , controly , endx , endy ] , relative ) <EOL> def appendQuadraticShorthandCurveToPath ( self , endx , endy , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:t>' , [ endx , endy ] , relative ) <EOL> def appendArcToPath ( self , rx , ry , x , y , x_axis_rotation = <NUM_LIT:0> , large_arc_flag = <NUM_LIT:0> , sweep_flag = <NUM_LIT:1> , relative = True ) : <EOL> self . __append__ ( '<STR_LIT:a>' , [ rx , ry , x_axis_rotation , large_arc_flag , sweep_flag , x , y ] , relative ) <EOL> class polyline ( BaseShape ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , points = None , ** kwargs ) : <EOL> BaseElement . __init__ ( self , '<STR_LIT>' ) <EOL> self . set_points ( points ) <EOL> self . setKWARGS ( ** kwargs ) <EOL> def set_points ( self , points ) : <EOL> self . _attributes [ '<STR_LIT>' ] = points <EOL> def get_points ( self ) : <EOL> return self . _attributes . get ( '<STR_LIT>' ) <EOL> class polygon ( polyline ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , points = None , ** kwargs ) : <EOL> BaseElement . __init__ ( self , '<STR_LIT>' ) <EOL> self . set_points ( points ) <EOL> self . setKWARGS ( ** kwargs ) </s>
