bonus.py :  » Business-Application » ThanCad » thancad-0.0.9 » p_gchart » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » ThanCad 
ThanCad » thancad 0.0.9 » p_gchart » bonus.py
from math import sin,cos,pi
from types import *
from thanfonts import thanFontPrime1


def dashed_star(x, y, r, color, fill, size, chart):
    r *= 0.5
    th = 0.0
    for i in range(8):
        x1 = x + r*cos(th)
  y1 = y + r*sin(th)
  chart.curveAdd((x, x1),  (y, y1), color=color, fill=fill, style="dashedsym", size=size)
  th += pi*0.25

#=============================================================================

def thanSymbolLine7f(xz, yz, h, a, theta, tfont=thanFontPrime1, linefun=None):
        "Draws text using ThanCad's line fonts."

        assert h >= 1.0, "Text height must be > 1 pixel"

        hf = 7.0
        theta *= (pi/180.0)
        by = h / hf
        bx = by*cos(theta)
        by = by*sin(theta)
        hx2 = hf * bx
        hy2 = hf * by

#-------Transform the coordinates

        for c in a:                               # Loop of all the characters in text
            k = ord(c)
            if type(tfont[k]) is IntType: k = tfont[k]
            if k < 0 or k > 255:
                self.thanDebug("Character with code:" + str(k))
                return

            for pl in tfont[k]:                   # Loop of all polylines of a char
#                plr = [  (xz+xx*bx-yy*by, yz-(xx*by+yy*bx)) for (xx, yy) in pl ]
                xpp = [  xz+xx*bx-yy*by for (xx, yy) in pl ]
                ypp = [  yz+xx*by+yy*bx for (xx, yy) in pl ]
          linefun(xpp, ypp)

            xz += hx2     # Advance character position
            yz -= hy2
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.