Ejemplo n.º 1
0
 def __init__(self, initialPosition, radius,
         lineProps=defaultLineProperties(),
         transformation=Translation(),
         repeater=defaultRepeater()):
     AbstractShape.__init__(self, initialPosition,
         lineProps, transformation, repeater)
     self.radius = radius
     self.pi2 = 2 * math.pi
Ejemplo n.º 2
0
from AbstractShape import AbstractShape


class Line(AbstractShape):

    def __init__(self, initialPosition, (lengthX, lengthY),
            lineProps=defaultLineProperties(),
            transformation=Translation(),
            repeater=defaultRepeater()):
        AbstractShape.__init__(self, initialPosition,
            lineProps, transformation, repeater)
        self.lengthX = lengthX
        self.lengthY = lengthY

    def drawInitialShape(self, cr):
        cr.move_to(0, 0)
        cr.line_to(self.lengthX, self.lengthY)
        cr.stroke
Ejemplo n.º 3
0
import math
from AbstractShape import AbstractShape
from Core.Transformations.Translations import Translation
from ..LineProperties import defaultLineProperties
from ..Repeaters import defaultRepeater


class Ellipse(AbstractShape):
    def __init__(self,
                 initialPosition,
                 radius, (scaleX, scaleY),
                 lineProps=defaultLineProperties(),
                 transformation=Translation(),
                 repeater=defaultRepeater()):
        AbstractShape.__init__(self, initialPosition, lineProps,
                               transformation, repeater)
        self.radius = radius
        self.scaleX = scaleX
        self.scaleY = scaleY
        self.pi2 = 2 * math.pi

    def drawInitialShape(self, cr):
        cr.save()
        cr.scale(self.scaleX, self.scaleY)
        cr.arc(0, 0, self.radius, 0, self.pi2)
        cr.stroke()
        cr.restore()