示例#1
0
def render_circle(Matrix, Point0, Point1, Color):
    setLineWidth(Glbs.get_context('lineWidth'))
    X0, Y0 = world_coord(Matrix, Point0)
    X1, Y1 = world_coord(Matrix, Point1)
    Radii = max(abs(X0 - X1), abs(Y0 - Y1))
    draw_circle((X0, Y0), Radii, Color, 1)
    return
示例#2
0
def render_arc(Matrix, Point0, Point1, Point2, Color):
    setLineWidth(Glbs.get_context('lineWidth'))
    P0 = world_coord(Matrix, Point0)
    P1 = world_coord(Matrix, Point1)
    P2 = world_coord(Matrix, Point2)
    print('arc %s %s %s %s' % (P0, P1, P2, Color))
    draw_arc(P0, P1, P2, Color)
    return
示例#3
0
def render_line(Matrix, Line, Color):
    setLineWidth(Glbs.get_context('lineWidth'))
    X0 = Line[0][0]
    Y0 = Line[0][1]
    for i in range(len(Line) - 1):
        X1 = X0 + Line[i + 1][0]
        Y1 = Y0 + Line[i + 1][1]
        (X2, Y2) = world_coord(Matrix, (X0, Y0))
        (X3, Y3) = world_coord(Matrix, (X1, Y1))
        draw_line((X2, Y2), (X3, Y3), Color)
        X0 = X1
        Y0 = Y1
示例#4
0
def render_text(Matrix, Text, XY, Rot, Size, Color, Align):
    if Glbs.get_context('useVectorText'):
        setLineWidth(Glbs.get_context('vectorTextWidth'))
        render_vector_text(Matrix, Text, XY, Rot, Size, Color, Align)
        return

    [A, A1, _, B1, B, _] = Matrix
    Min = min(abs(A), abs(B))
    if Min < 0.1:
        Min = min(abs(A1), abs(B1))
    Size1 = 3 * Min * Size
    P0 = world_coord(Matrix, tuple(XY))
    draw_text(Text, P0[0], P0[1], Color, 'left', Size1)
示例#5
0
def render_text(Matrix, Text, XY, Rot, Size, Color, Align):
    if Glbs.useVectorText:
        setLineWidth(Glbs.get_context('vectorTextWidth'))
        render_vector_text(Matrix, Text, XY, Rot, Size, Color, Align)
        return

    [A, A1, _, B1, B, _] = Matrix
    Min = min(abs(A), abs(B))
    if Min < 0.1:
        Min = min(abs(A1), abs(B1))
    Size1 = Min * Size
    P0 = world_coord(Matrix, XY)
    if Glbs.useVectorText:
        P1 = world_coord(Matrix, (XY[0] + 10, XY[1]))
        Dx = signme(P1[0] - P0[0])
        Dy = signme(P1[1] - P0[1])
        draw_vector_text(Text, P0[0], P0[1], Color, Align, Size1, Dx, Dy)
    else:
        draw_label(Text, P0[0], P0[1], Color, 'left', Size)
示例#6
0
def render_frect(Matrix, Rect, Color):
    setLineWidth(Glbs.get_context('lineWidth'))
    X0, Y0 = world_coord(Matrix, Rect[0])
    X1, Y1 = world_coord(Matrix, Rect[1])
    draw_frect(X0, Y0, X1, Y1, Color)
示例#7
0
def render_fcircle(Matrix, Point0, Point1, Color):
    setLineWidth(Glbs.get_context('lineWidth'))
    X0, Y0 = world_coord(Matrix, Point0)
    X1, Y1 = world_coord(Matrix, Point1)
    draw_fcircle((X0, Y0), abs(X1 - X0), Color)
    return
示例#8
0
def render_aline(Matrix, Line, Color):
    setLineWidth(Glbs.get_context('lineWidth'))
    for i in range(len(Line) - 1):
        P0 = world_coord(Matrix, Line[i])
        P1 = world_coord(Matrix, Line[i + 1])
        draw_line(P0, P1, Color)