Пример #1
0
 def rect(self, attrs):
     #print 'rect', attrs.map
     if self.in_defs:
         id = attrs.get('id', '')
         if id:
             self.named_objects[id] = ('object', 'rect', attrs)
         return
     if attrs.has_key('x'):
         x = attrs['x']
     else:
         x = '0'
     if attrs.has_key('y'):
         y = attrs['y']
     else:
         y = '0'
     x, y = self.point(x, y)
     wx, wy = self.point(attrs['width'], "0", relative = 1)
     hx, hy = self.point("0", attrs['height'], relative = 1)
     t = Trafo(wx, wy, hx, hy, x, y)
     self._print('rect', t)
     style = attrs.get('style', '')
     if style:
         self.parse_style(style)
     self.set_loader_style()
     apply(self.loader.rectangle, t.coeff())
Пример #2
0
 def rect(self, attrs):
     #print 'rect', attrs.map
     if self.in_defs:
         id = attrs.get('id', '')
         if id:
             self.named_objects[id] = ('object', 'rect', attrs)
         return
     if attrs.has_key('x'):
         x = attrs['x']
     else:
         x = '0'
     if attrs.has_key('y'):
         y = attrs['y']
     else:
         y = '0'
     x, y = self.point(x, y)
     wx, wy = self.point(attrs['width'], "0", relative=1)
     hx, hy = self.point("0", attrs['height'], relative=1)
     t = Trafo(wx, wy, hx, hy, x, y)
     self._print('rect', t)
     style = attrs.get('style', '')
     if style:
         self.parse_style(style)
     self.set_loader_style()
     apply(self.loader.rectangle, t.coeff())
Пример #3
0
    def read_ellipse(self, line):
        readline = self.readline
        tokenize = skread.tokenize_line
        args = tokenize(line)
        if len(args) != 19:
            raise SketchLoadError("Invalid Ellipse specification")
        sub_type, line_style, thickness, pen_color, fill_color, depth, pen_style, area_fill, style, direction, angle, cx, cy, rx, ry, sx, sy, ex, ey = (
            args
        )
        self.fill(fill_color, area_fill)
        self.line(pen_color, thickness, const.JoinMiter, const.CapButt, line_style, style)

        center = self.trafo(cx, cy)
        radius = self.trafo.DTransform(rx, ry)
        trafo = Trafo(radius.x, 0, 0, radius.y)
        trafo = Rotation(angle)(trafo)
        trafo = Translation(center)(trafo)
        apply(self.ellipse, trafo.coeff())
        self.set_depth(depth)
Пример #4
0
    def read_ellipse(self, line):
        readline = self.readline
        tokenize = skread.tokenize_line
        args = tokenize(line)
        if len(args) != 19:
            raise SketchLoadError('Invalid Ellipse specification')
        sub_type, line_style, thickness, pen_color, fill_color, depth, \
                pen_style, area_fill, style, direction, angle, \
                cx, cy, rx, ry, sx, sy, ex, ey = args
        self.fill(fill_color, area_fill)
        self.line(pen_color, thickness, const.JoinMiter, const.CapButt,
                  line_style, style)

        center = self.trafo(cx, cy)
        radius = self.trafo.DTransform(rx, ry)
        trafo = Trafo(radius.x, 0, 0, radius.y)
        trafo = Rotation(angle)(trafo)
        trafo = Translation(center)(trafo)
        apply(self.ellipse, trafo.coeff())
        self.set_depth(depth)
Пример #5
0
 def ellipse(self, attrs):
     if self.in_defs:
         id = attrs.get('id', '')
         if id:
             self.named_objects[id] = ('object', 'ellipse', attrs)
         return
     if attrs.has_key('cx'):
         x = attrs['cx']
     else:
         x = '0'
     if attrs.has_key('cy'):
         y = attrs['cy']
     else:
         y = '0'
     x, y = self.point(x, y)
     rx, ry = self.point(attrs['rx'], attrs['ry'], relative = 1)
     t = Trafo(rx, 0, 0, ry, x, y)
     self._print('ellipse', t)
     style = attrs.get('style', '')
     if style:
         self.parse_style(style)
     self.set_loader_style()
     apply(self.loader.ellipse, t.coeff())
Пример #6
0
 def ellipse(self, attrs):
     if self.in_defs:
         id = attrs.get('id', '')
         if id:
             self.named_objects[id] = ('object', 'ellipse', attrs)
         return
     if attrs.has_key('cx'):
         x = attrs['cx']
     else:
         x = '0'
     if attrs.has_key('cy'):
         y = attrs['cy']
     else:
         y = '0'
     x, y = self.point(x, y)
     rx, ry = self.point(attrs['rx'], attrs['ry'], relative=1)
     t = Trafo(rx, 0, 0, ry, x, y)
     self._print('ellipse', t)
     style = attrs.get('style', '')
     if style:
         self.parse_style(style)
     self.set_loader_style()
     apply(self.loader.ellipse, t.coeff())