Пример #1
0
    def _set_reference_point(self, pt):
        '''
             assumes no rotation of the reference frames
             only scale and translate
        '''
        rp = ReferencePoint(pt)
        info = rp.edit_traits()
        if info.result:
            plot = self.plot
            self.points.append(((rp.x, rp.y), pt))


#            if not self.reference_pt1:
#                self.reference_pt1 = (rp.x, rp.y), pt
#            else:
#                # calculate bounds
#                dp1, sp1 = self.reference_pt1
#                dp2, sp2 = (rp.x, rp.y), pt
#
#
#                w = plot.width
#                h = plot.height
#                if sp1[0] < sp2[0]:
#                    sx1, sx2 = sp1[0], sp2[0]
#                    x1, x2 = dp1[0], dp2[0]
#                else:
#                    sx2, sx1 = sp1[0], sp2[0]
#                    x2, x1 = dp1[0], dp2[0]
#
#                if sp1[1] < sp2[1]:
#                    sy1, sy2 = sp1[1], sp2[1]
#                    y1, y2 = dp1[1], dp2[1]
#                else:
#                    sy2, sy1 = sp1[1], sp2[1]
#                    y2, y1 = dp1[1], dp2[1]
#
#                pxperunit = abs((sx2 - sx1) / (x2 - x1))
#
#                li = x1 - sx1 / pxperunit
#                hi = x2 + (w - sx2) / pxperunit
#                lv = y1 - sy1 / pxperunit
#                hv = y2 + (h - sy2) / pxperunit
#
#                plot.index_range.low_setting = li
#                plot.index_range.high_setting = hi
#                plot.value_range.low_setting = lv
#                plot.value_range.high_setting = hv
#
            plot.request_redraw()
Пример #2
0
    def _set_reference_point(self, pt):
        '''
             assumes no rotation of the reference frames
             only scale and translate
        '''
        rp = ReferencePoint(pt)
        info = rp.edit_traits()
        if info.result:
            plot = self.plot
            self.points.append(((rp.x, rp.y), pt))

            #            if not self.reference_pt1:
            #                self.reference_pt1 = (rp.x, rp.y), pt
            #            else:
            #                # calculate bounds
            #                dp1, sp1 = self.reference_pt1
            #                dp2, sp2 = (rp.x, rp.y), pt
            #
            #
            #                w = plot.width
            #                h = plot.height
            #                if sp1[0] < sp2[0]:
            #                    sx1, sx2 = sp1[0], sp2[0]
            #                    x1, x2 = dp1[0], dp2[0]
            #                else:
            #                    sx2, sx1 = sp1[0], sp2[0]
            #                    x2, x1 = dp1[0], dp2[0]
            #
            #                if sp1[1] < sp2[1]:
            #                    sy1, sy2 = sp1[1], sp2[1]
            #                    y1, y2 = dp1[1], dp2[1]
            #                else:
            #                    sy2, sy1 = sp1[1], sp2[1]
            #                    y2, y1 = dp1[1], dp2[1]
            #
            #                pxperunit = abs((sx2 - sx1) / (x2 - x1))
            #
            #                li = x1 - sx1 / pxperunit
            #                hi = x2 + (w - sx2) / pxperunit
            #                lv = y1 - sy1 / pxperunit
            #                hv = y2 + (h - sy2) / pxperunit
            #
            #                plot.index_range.low_setting = li
            #                plot.index_range.high_setting = hi
            #                plot.value_range.low_setting = lv
            #                plot.value_range.high_setting = hv
            #
            plot.request_redraw()
Пример #3
0
 def _get_point(self, sp):
     rp = ReferencePoint(sp)
     info = rp.edit_traits()
     if info.result:
         refp = rp.x, rp.y
         return refp, sp
Пример #4
0
 def _get_point(self, sp):
     rp = ReferencePoint(sp)
     info = rp.edit_traits()
     if info.result:
         refp = rp.x, rp.y
         return refp, sp