1 from __future__
import absolute_import, division, print_function
35 def dot(symb, c, r, size, ctype=None, fontFamily="helvetica", textAngle=None):
36 """Draw a symbol onto the specified DS9 frame at (col,row) = (c,r) [0-based coordinates] 42 @:Mxx,Mxy,Myy Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored) 43 An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored) 44 Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended 45 with other characteristics, e.g. "times bold italic". Text will be drawn rotated by textAngle (textAngle is 48 N.b. objects derived from BaseCore include Axes and Quadrupole. 53 color =
' # color=%s' % ctype
59 if isinstance(symb, afwGeom.ellipses.Axes):
60 regions.append(
'ellipse %g %g %gi %gi %g%s' % (c, r, symb.getA(), symb.getB(),
61 math.degrees(symb.getTheta()), color))
63 regions.append(
'line %g %g %g %g%s' % (c, r+size, c, r-size, color))
64 regions.append(
'line %g %g %g %g%s' % (c-size, r, c+size, r, color))
66 size = size/math.sqrt(2)
67 regions.append(
'line %g %g %g %g%s' %
68 (c+size, r+size, c-size, r-size, color))
69 regions.append(
'line %g %g %g %g%s' %
70 (c-size, r+size, c+size, r-size, color))
73 size60 = 0.5*math.sqrt(3)*size
74 regions.append(
'line %g %g %g %g%s' % (c+size, r, c-size, r, color))
75 regions.append(
'line %g %g %g %g%s' %
76 (c-size30, r+size60, c+size30, r-size60, color))
77 regions.append(
'line %g %g %g %g%s' %
78 (c+size30, r+size60, c-size30, r-size60, color))
80 regions.append(
'circle %g %g %gi%s' % (c, r, size, color))
82 color = re.sub(
"^ # ",
"", color)
85 if textAngle
is not None:
86 angle +=
" textangle=%.1f"%(textAngle)
89 if size != 2
or fontFamily !=
"helvetica":
90 fontFamily = fontFamily.split()
91 font +=
' font="%s %d' % (fontFamily.pop(0),
92 int(10*size/2.0 + 0.5))
95 fontFamily = [
"normal"]
96 font +=
" %s" %
" ".join(fontFamily)
99 if color
or angle
or font:
105 regions.append(
'text %g %g \"%s\"%s' % (c, r, symb, extra))
111 """!Draw a line by connecting the points 112 \param points a list of (col,row) 113 \param ctype the name of the desired colour (e.g. 'red', 'orchid') 119 color =
"# color=%s" % ctype
126 for (c, r)
in points[1:]:
129 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)