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
def rotate(elems, angle): group = g() for e in elems: group.addElement(e) tb = TransformBuilder() #tb.setRotation(rotate(x1, y1, x2, y2)) tb.setRotation(angle) #tb.setTranslation('{0},{1}'.format(x,y)) group.set_transform(tb.getTransform()) return group
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
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