def panset(self, fitsimage, chinfo, paninfo): x, y = fitsimage.get_pan() points = fitsimage.get_pan_rect() # calculate pan position point radius image = paninfo.panimage.get_image() width, height = image.get_size() edgew = math.sqrt(width**2 + height**2) radius = int(0.015 * edgew) # Mark pan rectangle and pan position try: obj = paninfo.panimage.getObjectByTag(paninfo.panrect) if obj.kind != 'compound': return True point, bbox = obj.objects self.logger.debug("starting panset") point.x, point.y = x, y point.radius = radius bbox.points = points paninfo.panimage.redraw(whence=3) except KeyError: paninfo.panrect = paninfo.panimage.add( CanvasTypes.CompoundObject( CanvasTypes.Point(x, y, radius=radius), CanvasTypes.Polygon(points)))
def add_mark(self, data_x, data_y, radius=None, color=None, style=None): if not radius: radius = self.mark_radius if not color: color = self.mark_color if not style: style = self.mark_style self.logger.debug("Setting mark at %d,%d" % (data_x, data_y)) self.mark_index += 1 tag = 'mark%d' % (self.mark_index) tag = self.canvas.add(CanvasTypes.CompoundObject( CanvasTypes.Point(data_x, data_y, self.mark_radius, style=style, color=color, linestyle='solid'), CanvasTypes.Text(data_x + 10, data_y, "%d" % (self.mark_index), color=color)), tag=tag) self.marks.append(tag) self.w.marks.append_text(tag) self.select_mark(tag, pan=False)