Пример #1
0
    def genHoneycomb(self):
        outComb = G()
        circleStyle = StyleBuilder()
        #circleStyle.setStrokeWidth(0.5)
        circleStyle.setStroke('orange')
        circleStyle.setFilling('#edd239')
        CORNER = self.hCSlice.getBottomRight()

        circleY = []
        circleY.append(CORNER[1] + (ROW_SPACE - CIRCLE_RADIUS))
        for g in range(0, self.row):
            circleX = CORNER[0] - CIRCLE_RADIUS
            if (g != 0 and g % 2 != 0):
                circleY.append(circleY[g-1] + 2*CIRCLE_RADIUS)
            elif (g!= 0 and g % 2 == 0):
                circleY.append(circleY[g-1] + 2*(ROW_SPACE - CIRCLE_RADIUS))

            #initCircle = Circle(circleX, circleY[g], CIRCLE_RADIUS)
            #outComb.addElement(initCircle)
            for i in range(0, self.col):
                newShift = TransformBuilder()
                xShift = -i*CIRCLE_RADIUS*math.sqrt(3)
                yShift = 0
                if i % 2 != 0 and g % 2 != 0:
                    yShift = CIRCLE_RADIUS
                elif i % 2 != 0 and g % 2 == 0:
                    yShift = -1*CIRCLE_RADIUS
                newShift.setTranslation(str(xShift) + ' ' + str(yShift))
                a = Circle(circleX, circleY[g], CIRCLE_RADIUS)
                a.set_transform(newShift.getTransform())
                outComb.addElement(a)

        outComb.set_style(circleStyle.getStyle())
        return outComb
Пример #2
0
 def rotate(self, angle):
     group = g()
     for e in self:
         group.addElement(e)
     tb = TransformBuilder()
     tb.setRotation(angle)
     group.set_transform(tb.getTransform())
     self.items = [group]
     return self
Пример #3
0
 def move(self, x, y):
     group = g()
     for item in self:
         group.addElement(item)
     tb = TransformBuilder()
     tb.setTranslation('{0},{1}'.format(x, y))
     group.set_transform(tb.getTransform())
     self.items = [group]
     return self
Пример #4
0
def translate(elems, x, y):
    group = g()
    for e in elems:
        group.addElement(e)
    tb = TransformBuilder()
    #tb.setRotation(rotate(x1, y1, x2, y2))
    tb.setTranslation('{0},{1}'.format(x, y))
    group.set_transform(tb.getTransform())
    return group
Пример #5
0
def translate(elems, x, y):
    group = g()
    for e in elems:
        group.addElement(e)
    tb = TransformBuilder()
    #tb.setRotation(rotate(x1, y1, x2, y2))
    tb.setTranslation('{0},{1}'.format(x,y))
    group.set_transform(tb.getTransform())
    return group
Пример #6
0
 def rotate(self, angle):
     group = g()
     for e in self:
         group.addElement(e)
     tb = TransformBuilder()
     tb.setRotation(angle)
     group.set_transform(tb.getTransform())
     self.items = [group]
     return self
Пример #7
0
 def move(self, x, y):
     group = g()
     for item in self:
         group.addElement(item)
     tb = TransformBuilder()
     tb.setTranslation('{0},{1}'.format(x,y))
     group.set_transform(tb.getTransform())
     self.items = [group]
     return self
Пример #8
0
 def scale(self, amount):
     """1 = 100%"""
     group = g()
     for e in self:
         group.addElement(e)
     tb = TransformBuilder()
     tb.setScaling(amount, amount)
     group.set_transform(tb.getTransform())
     self.items = [group]
     return self
Пример #9
0
def scale(elems, amount):
    """1 = 100%"""
    group = g()
    for e in elems:
        group.addElement(e)
    tb = TransformBuilder()
    #tb.setRotation(rotate(x1, y1, x2, y2))
    tb.setScaling(amount, amount)
    group.set_transform(tb.getTransform())
    return group
Пример #10
0
def scale(elems, amount):
    """1 = 100%"""
    group = g()
    for e in elems:
        group.addElement(e)
    tb = TransformBuilder()
    #tb.setRotation(rotate(x1, y1, x2, y2))
    tb.setScaling(amount, amount)
    group.set_transform(tb.getTransform())
    return group
Пример #11
0
 def scale(self, amount):
     """1 = 100%"""
     group = g()
     for e in self:
         group.addElement(e)
     tb = TransformBuilder()
     tb.setScaling(amount, amount)
     group.set_transform(tb.getTransform())
     self.items = [group]
     return self
Пример #12
0
    def chair(self, id_attr, color_1, color_2):
        head = ShapeBuilder().createCircle(30, 25, 20, stroke='black', strokewidth=5.0, fill=color_1)
        head.set_class('head')
        body = path(pathData="M 19.264266,38.267870 C 12.892238,41.659428 9.0221978,48.396703 6.6126745,55.405840 L 51.476471,55.405840 C 49.270169,48.545436 45.682644,41.911786 39.811885,38.267870 C 33.901416,38.010889 26.459633,38.267870 19.264266,38.267870 z ")
        body.set_style('stroke-width:5.0;stroke:black;fill:%s;' % color_2)
        body.set_class('body')

        th = TransformBuilder()
        th.setScaling('0.8', '0.8')

        group = g()
        group.addElement(body)
        group.addElement(head)
        group.set_id(id_attr)
        group.set_transform(th.getTransform())

        return group
Пример #13
0
    def chair_svg(self, row, column, id_attr):
        angle, x, y = self.hc.chair_location(row, column)

        width, height = self.svg_dimention()

        # This '30' is half the size of the svg chair, should be configured
        x = x + width / 2 - 30 * cos(pi / 2 - angle) + TRANSX
        y = height - y - 30 * sin(pi / 2 - angle) + TRANSY

        # Chair translation and rotation parametrization
        th = TransformBuilder()
        th.setRotation('%f' % (90 - degrees(angle)))
        th.setTranslation('%f,%f' % (x, y))

        u = use()
        u._attributes['xlink:href'] = '#%s' % id_attr
        u.set_transform(th.getTransform())

        return u
Пример #14
0
    def chair_svg(self, row, column, mp):
        angle, x, y = self.hc.chair_location(row, column)

        width, height = self.svg_dimention()

        # NOTE: Original comment stated '30' is half the size of the svg chair
        # NOTE: 30 was replaced with 25 to make the hemicycle roughly balanced
        x = x + width / 2 - 25 * cos(pi/2 - angle) + TRANSX
        y = height - y - 25 * sin(pi/2 - angle) + TRANSY

        # Chair translation and rotation parametrization
        th = TransformBuilder()
        th.setRotation('%f' % (90 - degrees(angle)))
        th.setTranslation('%f,%f' % (x, y))

        u = use()
        u._attributes['xlink:href'] = '#%s' % mp.party.initials
        u.set_transform(th.getTransform())

        return u