34 def dot(symb, c, r, size, ctype=None, fontFamily="helvetica", textAngle=None):
35 """Draw a symbol onto the specified DS9 frame at (col,row) = (c,r) [0-based coordinates] 41 @:Mxx,Mxy,Myy Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored) 42 An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored) 43 Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended 44 with other characteristics, e.g. "times bold italic". Text will be drawn rotated by textAngle (textAngle is 47 N.b. objects derived from BaseCore include Axes and Quadrupole. 52 color =
' # color=%s' % ctype
58 if isinstance(symb, afwGeom.ellipses.Axes):
59 regions.append(
'ellipse %g %g %gi %gi %g%s' % (c, r, symb.getA(), symb.getB(),
60 math.degrees(symb.getTheta()), color))
62 regions.append(
'line %g %g %g %g%s' % (c, r+size, c, r-size, color))
63 regions.append(
'line %g %g %g %g%s' % (c-size, r, c+size, r, color))
65 size = size/math.sqrt(2)
66 regions.append(
'line %g %g %g %g%s' %
67 (c+size, r+size, c-size, r-size, color))
68 regions.append(
'line %g %g %g %g%s' %
69 (c-size, r+size, c+size, r-size, color))
72 size60 = 0.5*math.sqrt(3)*size
73 regions.append(
'line %g %g %g %g%s' % (c+size, r, c-size, r, color))
74 regions.append(
'line %g %g %g %g%s' %
75 (c-size30, r+size60, c+size30, r-size60, color))
76 regions.append(
'line %g %g %g %g%s' %
77 (c+size30, r+size60, c-size30, r-size60, color))
79 regions.append(
'circle %g %g %gi%s' % (c, r, size, color))
81 color = re.sub(
"^ # ",
"", color)
84 if textAngle
is not None:
85 angle +=
" textangle=%.1f"%(textAngle)
88 if size != 2
or fontFamily !=
"helvetica":
89 fontFamily = fontFamily.split()
90 font +=
' font="%s %d' % (fontFamily.pop(0),
91 int(10*size/2.0 + 0.5))
94 fontFamily = [
"normal"]
95 font +=
" %s" %
" ".join(fontFamily)
98 if color
or angle
or font:
104 regions.append(
'text %g %g \"%s\"%s' % (c, r, symb, extra))
110 """!Draw a line by connecting the points 111 @param points a list of (col,row) 112 @param ctype the name of the desired colour (e.g. 'red', 'orchid') 118 color =
"# color=%s" % ctype
125 for (c, r)
in points[1:]:
128 regions.append(
'line %g %g %g %g %s' % (c0, r0, c, r, color))
def drawLines(points, ctype=None)
Draw a line by connecting the points.
def dot(symb, c, r, size, ctype=None, fontFamily="helvetica", textAngle=None)