30 """! Initialise the display 31 @param display The display object that we're providing the implementation for 32 @param verbose be chatty? 41 """!Close the display, cleaning up any allocated resources""" 42 if hasattr(self,
"verbose")
and self.
verbose and hasattr(self,
"display"):
43 print(
"virtual[%s]._close()" % (self.frame))
45 def _buffer(self, enable=True):
46 """!Enable or disable buffering of writes to the display 47 @param enable True or False, as appropriate 50 print(
"virtual[%s]._buffer(%s)" % (self.frame, enable))
52 def _dot(self, symb, c, r, size, ctype, *args, **kwargs):
53 """!Draw symbol a symbol at (c, r) 54 @param symb The desired symbol. See dot() for details 55 @param c (x) column position 56 @param r (y) row position 57 @param size Size of symbol, in pixels 58 @param ctype The desired colour, either e.g. afw.display.RED or a colour name known to X11 59 @param args Extra arguments 60 @param kwargs Extra keyword arguments 63 print(
"virtual[%s]._dot('%s', %.2f, %.2f, size=%g, ctype=%s, %s, %s)" %
64 (self.frame, symb, c, r, size, ctype, args, kwargs))
66 def _drawLines(self, points, ctype):
67 """!Draw line defined by the list points 68 @param points A list of 0-indexed positions [(x, y), (x, y), ...] 69 @param ctype The desired colour, either e.g. afw.display.RED or a colour name known to X11 72 print(
"virtual[%s]._drawLines(%s, ctype=%s)" %
73 (self.frame, points, ctype))
76 """!Erase all glyphs drawn on display 79 print(
"virtual[%s]._erase()" % (self.frame))
82 """!Flush any I/O buffers 85 print(
"virtual[%s]._flush()" % self.frame)
87 def _setCallback(self, what, func):
89 print(
"setCallback %s -> %s" % (what, func))
92 """Return an event generated by a keypress or mouse click 94 from .interface
import Event
98 print(
"virtual[%s]._getEvent() -> %s" % (self.frame, ev))
102 def _getMaskTransparency(self):
103 """Return the mask transparency for a display 106 print(
"virtual[%s]._getMaskTransparency()" % self.frame)
108 def _mtv(self, image, wcs=None, mask=None, title=""):
109 """Display an image and maybe a mask overlay on a display 110 @param image afwImage.Image to display 111 @param mask afwImage.Mask to display 112 @param wcs A Wcs to associate with data 113 @param title Name to display with the data 116 print(
"virtual[%s]._mtv(image=%s, mask=%s, wcs=%s, title=\"%s\")" %
117 (self.frame,
"Image" if image
else None,
118 "Mask" if mask
else None,
"Wcs" if wcs
else None, title))
120 def _setMaskTransparency(self, transparency, maskplane):
121 """Set the transparency of a maskplane 122 @param transparency The desired transparency, in the range [0, 100] 123 @param maskplane The maskplane to set (None: all) 126 print(
"virtual[%s]._setMaskTransparency(%g, maskplane=\"%s\")" %
127 (self.frame, transparency, maskplane))
129 def _scale(self, algorithm, min, max, unit=None, *args, **kwargs):
130 """Set the scaling from DN to displayed pixels 131 @param algorithm Scaling algorithm (e.g. linear) 132 @param min The minimum value of the stretch (or "zscale" or "minmax") 133 @param max The maximum value of the stretch 134 @param unit Units for min and max (e.g. Percent, Absolute, Sigma) 135 @param *args Optional arguments 136 @param **kwargs Optional keyword arguments 139 print(
"virtual[%s]._scale(%s, %s, %s, %s, %s, %s)" % (self.frame, algorithm,
140 min, max, unit, args, kwargs))
143 """Show the requested display 146 print(
"virtual[%s]._show()" % self.frame)
148 def _pan(self, r, c):
149 """Pan to (colc, rowc) 150 @param c Desired column (x) position 151 @param r Desired row (y) position 154 print(
"virtual[%s]._pan(%.2f, %.2f)" % (self.frame, r, c))
156 def _zoom(self, zoomfac):
158 @param zoomfac Zoom factor to use 161 print(
"virtual[%s]._zoom(%g)" % (self.frame, zoomfac))
def __init__(self, display, verbose=False)
Initialise the display.
A class to handle events such as key presses in image display windows.
def _close(self)
Close the display, cleaning up any allocated resources.