1 from __future__
import absolute_import, division, print_function
2 from builtins
import object
32 """! Initialise the display 33 \param display The display object that we're providing the implementation for 34 \param verbose be chatty? 43 """!Close the display, cleaning up any allocated resources""" 44 if hasattr(self,
"verbose")
and self.
verbose and hasattr(self,
"display"):
45 print(
"virtual[%s]._close()" % (self.frame))
47 def _buffer(self, enable=True):
48 """!Enable or disable buffering of writes to the display 49 \param enable True or False, as appropriate 52 print(
"virtual[%s]._buffer(%s)" % (self.frame, enable))
54 def _dot(self, symb, c, r, size, ctype, *args, **kwargs):
55 """!Draw symbol a symbol at (c, r) 56 \param symb The desired symbol. See dot() for details 57 \param c (x) column position 58 \param r (y) row position 59 \param size Size of symbol, in pixels 60 \param ctype The desired colour, either e.g. afw.display.RED or a colour name known to X11 61 \param args Extra arguments 62 \param kwargs Extra keyword arguments 65 print(
"virtual[%s]._dot('%s', %.2f, %.2f, size=%g, ctype=%s, %s, %s)" %
66 (self.frame, symb, c, r, size, ctype, args, kwargs))
68 def _drawLines(self, points, ctype):
69 """!Draw line defined by the list points 70 \param points A list of 0-indexed positions [(x, y), (x, y), ...] 71 \param ctype The desired colour, either e.g. afw.display.RED or a colour name known to X11 74 print(
"virtual[%s]._drawLines(%s, ctype=%s)" %
75 (self.frame, points, ctype))
78 """!Erase all glyphs drawn on display 81 print(
"virtual[%s]._erase()" % (self.frame))
84 """!Flush any I/O buffers 87 print(
"virtual[%s]._flush()" % self.frame)
89 def _setCallback(self, what, func):
91 print(
"setCallback %s -> %s" % (what, func))
94 """Return an event generated by a keypress or mouse click 96 from .interface
import Event
100 print(
"virtual[%s]._getEvent() -> %s" % (self.frame, ev))
104 def _getMaskTransparency(self):
105 """Return the mask transparency for a display 108 print(
"virtual[%s]._getMaskTransparency()" % self.frame)
110 def _mtv(self, image, wcs=None, mask=None, title=""):
111 """Display an image and maybe a mask overlay on a display 112 \param image afwImage.Image to display 113 \param mask afwImage.Mask to display 114 \param wcs A Wcs to associate with data 115 \param title Name to display with the data 118 print(
"virtual[%s]._mtv(image=%s, mask=%s, wcs=%s, title=\"%s\")" %
119 (self.frame,
"Image" if image
else None,
120 "Mask" if mask
else None,
"Wcs" if wcs
else None, title))
122 def _setMaskTransparency(self, transparency, maskplane):
123 """Set the transparency of a maskplane 124 \param transparency The desired transparency, in the range [0, 100] 125 \param maskplane The maskplane to set (None: all) 128 print(
"virtual[%s]._setMaskTransparency(%g, maskplane=\"%s\")" %
129 (self.frame, transparency, maskplane))
131 def _scale(self, algorithm, min, max, unit=None, *args, **kwargs):
132 """Set the scaling from DN to displayed pixels 133 \param algorithm Scaling algorithm (e.g. linear) 134 \param min The minimum value of the stretch (or "zscale" or "minmax") 135 \param max The maximum value of the stretch 136 \param unit Units for min and max (e.g. Percent, Absolute, Sigma) 137 \param *args Optional arguments 138 \param **kwargs Optional keyword arguments 141 print(
"virtual[%s]._scale(%s, %s, %s, %s, %s, %s)" % (self.frame, algorithm,
142 min, max, unit, args, kwargs))
145 """Show the requested display 148 print(
"virtual[%s]._show()" % self.frame)
150 def _pan(self, r, c):
151 """Pan to (colc, rowc) 152 \param c Desired column (x) position 153 \param r Desired row (y) position 156 print(
"virtual[%s]._pan(%.2f, %.2f)" % (self.frame, r, c))
158 def _zoom(self, zoomfac):
160 \param zoomfac Zoom factor to use 163 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.