~ubuntu-branches/debian/sid/pyx/sid

« back to all changes in this revision

Viewing changes to pyx/path.py

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2011-05-20 00:13:52 UTC
  • mto: (9.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110520001352-odcuqpdezuusbbw1
Tags: upstream-0.11.1
Import upstream version 0.11.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: ISO-8859-1 -*-
2
 
#
3
 
#
4
 
# Copyright (C) 2002-2006 J�rg Lehmann <joergl@users.sourceforge.net>
 
1
# -*- encoding: utf-8 -*-
 
2
#
 
3
#
 
4
# Copyright (C) 2002-2006 Jörg Lehmann <joergl@users.sourceforge.net>
5
5
# Copyright (C) 2003-2005 Michael Schindler <m-schindler@users.sourceforge.net>
6
 
# Copyright (C) 2002-2006 Andr� Wobst <wobsta@users.sourceforge.net>
 
6
# Copyright (C) 2002-2011 André Wobst <wobsta@users.sourceforge.net>
7
7
#
8
8
# This file is part of PyX (http://pyx.sourceforge.net/).
9
9
#
21
21
# along with PyX; if not, write to the Free Software
22
22
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
23
23
 
24
 
from __future__ import nested_scopes
25
 
 
26
24
import math
27
 
from math import cos, sin, tan, acos, pi
28
 
try:
29
 
    from math import radians, degrees
30
 
except ImportError:
31
 
    # fallback implementation for Python 2.1
32
 
    def radians(x): return x*pi/180
33
 
    def degrees(x): return x*180/pi
34
 
 
 
25
from math import cos, sin, tan, acos, pi, radians, degrees
35
26
import trafo, unit
36
27
from normpath import NormpathException, normpath, normsubpath, normline_pt, normcurve_pt
37
28
import bbox as bboxmodule
41
32
# normpath's invalid is available as an external interface
42
33
from normpath import invalid
43
34
 
44
 
try:
45
 
    sum([])
46
 
except NameError:
47
 
    # fallback implementation for Python 2.2 and below
48
 
    def sum(list):
49
 
        return reduce(lambda x, y: x+y, list, 0)
50
 
 
51
 
try:
52
 
    enumerate([])
53
 
except NameError:
54
 
    # fallback implementation for Python 2.2 and below
55
 
    def enumerate(list):
56
 
        return zip(xrange(len(list)), list)
57
 
 
58
35
# use new style classes when possible
59
36
__metaclass__ = type
60
37
 
327
304
        file.write("closepath\n")
328
305
 
329
306
 
 
307
class pdfmoveto_pt(normline_pt):
 
308
 
 
309
    def outputPDF(self, file, writer):
 
310
        pass
 
311
 
 
312
 
330
313
class moveto_pt(pathitem):
331
314
 
332
315
    """Start a new subpath and set current point to (x_pt, y_pt) (coordinates in pts)"""
349
332
    def createnormpath(self, epsilon=_marker):
350
333
        if epsilon is _marker:
351
334
            return normpath([normsubpath([normline_pt(self.x_pt, self.y_pt, self.x_pt, self.y_pt)])])
 
335
        elif epsilon is None:
 
336
            return normpath([normsubpath([pdfmoveto_pt(self.x_pt, self.y_pt, self.x_pt, self.y_pt)],
 
337
                                         epsilon=epsilon)])
352
338
        else:
353
339
            return normpath([normsubpath([normline_pt(self.x_pt, self.y_pt, self.x_pt, self.y_pt)],
354
340
                                         epsilon=epsilon)])