Beispiel #1
0
 def __init__(self, **attr):
     PositionableElement.__init__(self, name='path', **attr)
     if attr.has_key('transform'):
         self.postTransform = attr['transform']
     else:
         self.postTransform = None
     self.elements = []
     self.closed = False
Beispiel #2
0
 def __init__ (self, **attr):
     PositionableElement.__init__ (self, name = 'path', **attr)
     if attr.has_key ('transform'):
         self.postTransform = attr['transform']
     else:
         self.postTransform = None
     self.elements = []
     self.closed = False
Beispiel #3
0
 def __init__(self, radius, start, delta, **attr):
     PositionableElement.__init__(self, name='path', **attr)
     self.radius = radius
     if delta < 0:
         delta = -delta
         start -= delta
     self.point1 = self.arcPoint(start)
     self.point2 = self.arcPoint(start + delta)
Beispiel #4
0
 def __init__ (self, radius, start, delta, **attr):
     PositionableElement.__init__ (self, name = 'path', **attr)
     self.radius = radius
     if delta < 0:
         delta = -delta
         start -= delta
     self.point1 = self.arcPoint (start)
     self.point2 = self.arcPoint (start + delta)
Beispiel #5
0
 def __init__(self, **attr):
     PositionableElement.__init__(self, name='line', **attr)
     if attr.has_key('point1'):
         self.point1 = V(*attr['point1'])
     else:
         self.point1 = V(0.0, 0.0)
     if attr.has_key('point2'):
         self.point2 = V(*attr['point2'])
     else:
         self.point2 = V(0.0, 0.0)
Beispiel #6
0
 def __init__ (self, **attr):
     PositionableElement.__init__ (self, name = 'line', **attr)
     if attr.has_key ('point1'):
         self.point1 = VStruct (*attr['point1'])
     else:
         self.point1 = VStruct (0.0, 0.0)
     if attr.has_key ('point2'):
         self.point2 = VStruct (*attr['point2'])
     else:
         self.point2 = VStruct (0.0, 0.0)
Beispiel #7
0
 def setSVG(self):
     attr = PositionableElement.setSVG(self)
     point1 = V(self.point1.x + self.x, self.point1.y + self.y)
     point2 = V(self.point2.x + self.x, self.point2.y + self.y)
     self.applyTransform(point1, point2)
     attr.update([('x1', point1.x), ('y1', point1.y), ('x2', point2.x),
                  ('y2', point2.y)])
     return attr
Beispiel #8
0
 def setSVG (self):
     pos = V (self.x, self.y)
     self.applyTransform (pos)
     attr = PositionableElement.setSVG (self) 
     attr.update ([('cx', pos.x), 
                   ('cy', pos.y),
                   ('r', self.radius)])
     return attr
Beispiel #9
0
 def setSVG (self):
     attr = PositionableElement.setSVG (self)
     point1 = V (self.point1.x + self.x, self.point1.y + self.y)
     point2 = V (self.point2.x + self.x, self.point2.y + self.y)
     self.applyTransform (point1, point2)
     attr.update ([('x1', point1.x),
                   ('y1', point1.y),
                   ('x2', point2.x),
                   ('y2', point2.y)])
     return attr
Beispiel #10
0
 def __init__(self, **attr):
     Grouping.__init__(self, **attr)
     PositionableElement.__init__(self, **attr)
     if attr.has_key('text'):
         self.text = attr['text']
     else:
         self.text = ''
     if attr.has_key('textHeight'):
         self.textHeight = attr['textHeight']
     else:
         self.textHeight = 10
     if attr.has_key('verticalAnchor'):
         self.verticalAnchor = attr['verticalAnchor']
     else:
         self.verticalAnchor = 'top'
     if attr.has_key('horizontalAnchor'):
         self.horizontalAnchor = attr['horizontalAnchor']
     else:
         self.horizontalAnchor = 'left'
     self.width = 0
     self.height = 0
     self.createText()
Beispiel #11
0
 def __init__ (self, **attr):
     Grouping.__init__ (self, **attr)
     PositionableElement.__init__ (self, **attr)
     if attr.has_key ('text'):
         self.text = attr['text']
     else:
         self.text = ''
     if attr.has_key ('textHeight'):
         self.textHeight = attr['textHeight']
     else:
         self.textHeight = 10
     if attr.has_key ('verticalAnchor'):
         self.verticalAnchor = attr['verticalAnchor']
     else:
         self.verticalAnchor = 'top'
     if attr.has_key ('horizontalAnchor'):
         self.horizontalAnchor = attr['horizontalAnchor']
     else:
         self.horizontalAnchor = 'left'
     self.width = 0
     self.height = 0
     self.createText ()
Beispiel #12
0
 def __init__ (self, **attr):
     Grouping.__init__ (self, **attr)
     PositionableElement.__init__ (self, **attr)
     if attr.has_key ('text'):
         self.text = attr['text']
     else:
         self.text = ''
     if attr.has_key ('lineLength'):
         self.lineLength = attr['lineLength']
     else:
         self.lineLength = float ('inf')
     if attr.has_key ('maxLines'):
         self.maxLines = attr['maxLines']
     else:
         self.maxLines = float ('inf')
     if attr.has_key ('textHeight'):
         self.textHeight = attr['textHeight']
     else:
         self.textHeight = 10
     if attr.has_key ('verticalAnchor'):
         self.verticalAnchor = attr['verticalAnchor']
     else:
         self.verticalAnchor = 'top'
     if attr.has_key ('horizontalAnchor'):
         self.horizontalAnchor = attr['horizontalAnchor']
     else:
         self.horizontalAnchor = 'left'
     if attr.has_key ('direction'):
         self.direction = attr['direction']
     else:
         self.direction = 'back'
     self.width = 0
     self.height = 0
     self.current = self.x
     self.currentLine = self.y
     self.maxLen = 0
     self.numLines = 1
     self.createText ()
Beispiel #13
0
 def setSVG(self):
     attr = PositionableElement.setSVG(self)
     pos = V(self.x, self.y)
     o = pos
     p1 = self.point1 + pos
     p2 = self.point2 + pos
     self.applyTransform(o, p1, p2)
     d1 = 'M ' + str(o)
     d2 = 'L ' + str(p1)
     d3 = 'A ' + str(self.radius) + ' ' + str(self.radius) + ' 1 0 0 '
     d3 += str(p2)
     d4 = 'Z'
     data = ' '.join([d1, d2, d3, d4])
     attr.update([('d', data)])
     return attr
Beispiel #14
0
 def setSVG (self):
     attr = PositionableElement.setSVG (self)
     pos = V (self.x, self.y)
     o = pos
     p1 = self.point1 + pos
     p2 = self.point2 + pos
     self.applyTransform (o, p1, p2)
     d1 = 'M ' + str (o)
     d2 = 'L ' + str (p1)
     d3 = 'A ' + str(self.radius) + ' ' + str(self.radius) + ' 1 0 0 '
     d3 += str(p2)
     d4 = 'Z'
     data = ' '.join ([d1, d2, d3, d4])
     attr.update ([('d', data)])
     return attr
Beispiel #15
0
 def __init__(self, **attr):
     PositionableElement.__init__(self, name='circle', **attr)
     if attr.has_key('radius'):
         self.radius = attr['radius']
     else:
         self.radius = 0.0
Beispiel #16
0
 def __init__ (self, **attr):
     PositionableElement.__init__ (self, name = 'circle', **attr)
     if attr.has_key ('radius'):
         self.radius = attr['radius']
     else:
         self.radius = 0.0