Changeset b5de88e in sasview for src/sas/guiframe/local_perspectives/plotting/Edge.py
- Timestamp:
- Mar 5, 2015 2:49:03 PM (10 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 7d56795
- Parents:
- 824e488
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/local_perspectives/plotting/Edge.py
r79492222 rb5de88e 1 import math 2 from BaseInteractor import _BaseInteractor 1 3 2 import math3 #import wx4 #from copy import deepcopy5 from BaseInteractor import _BaseInteractor6 #from sas.guiframe.events import NewPlotEvent7 #from sas.guiframe.events import StatusEvent8 #from sas.guiframe.events import SlicerParameterEvent9 #from sas.guiframe.events import EVT_SLICER_PARS10 11 4 12 5 class RadiusInteractor(_BaseInteractor): … … 15 8 """ 16 9 def __init__(self, base, axes, color='black', zorder=5, arc1=None, 17 arc2=None, theta=math.pi /8):10 arc2=None, theta=math.pi / 8): 18 11 """ 19 12 """ … … 23 16 self.r1 = arc1.get_radius() 24 17 self.r2 = arc2.get_radius() 25 #print "radius init", self.r1, self.r226 18 self.theta = theta 27 19 self.save_theta = theta 28 #self.scale = 10.029 20 self.move_stop = False 30 21 self.theta_left = None … … 32 23 self.arc1 = arc1 33 24 self.arc2 = arc2 34 #raise "Version error", message35 25 x1 = self.r1 * math.cos(self.theta) 36 26 y1 = self.r1 * math.sin(self.theta) … … 38 28 y2 = self.r2 * math.sin(self.theta) 39 29 self.line = self.axes.plot([x1, x2], [y1, y2], 40 41 42 30 linestyle='-', marker='', 31 color=self.color, 32 visible=True)[0] 43 33 self.phi = theta 44 34 self.npts = 20 … … 46 36 self.connect_markers([self.line]) 47 37 self.update() 48 38 49 39 def set_layer(self, n): 50 40 """ … … 52 42 self.layernum = n 53 43 self.update() 54 44 55 45 def clear(self): 56 46 """ … … 63 53 for item in range(len(self.axes.lines)): 64 54 del self.axes.lines[0] 65 55 66 56 def get_angle(self): 67 57 """ 68 58 """ 69 59 return self.theta 70 60 71 61 def update(self, r1=None, r2=None, theta=None): 72 62 """ … … 79 69 if theta != None: 80 70 self.theta = theta 81 #print "in the edge r1, r2",self.r1,self.r2,math.degrees(self.theta)82 71 x1 = self.r1 * math.cos(self.theta) 83 72 y1 = self.r1 * math.sin(self.theta) 84 73 x2 = self.r2 * math.cos(self.theta) 85 y2 = self.r2 * math.sin(self.theta) 74 y2 = self.r2 * math.sin(self.theta) 86 75 self.line.set(xdata=[x1, x2], ydata=[y1, y2]) 87 76 88 77 def save(self, ev): 89 78 """ … … 91 80 can restore on Esc. 92 81 """ 93 self.save_theta = math.atan2(ev.y,ev.x) 94 #self.save_theta= self.theta 82 self.save_theta = math.atan2(ev.y, ev.x) 95 83 self.base.freeze_axes() 96 84 97 85 def moveend(self, ev): 98 86 """ … … 100 88 self.has_move = False 101 89 self.base.moveend(ev) 102 90 103 91 def restore(self, ev): 104 92 """ … … 114 102 self.has_move = True 115 103 self.base.base.update() 116 104 117 105 def set_cursor(self, r_min, r_max, theta): 118 106 """ … … 122 110 self.r2 = r_max 123 111 self.update() 124 112 125 113 def get_params(self): 126 114 """ … … 131 119 params["theta"] = self.theta 132 120 return params 133 121 134 122 def set_params(self, params): 135 123 """ 136 124 """ 137 #print "when here set curcor arc" 138 x1 = params["radius1"] 139 x2 = params["radius2"] 140 theta= params["theta"] 125 x1 = params["radius1"] 126 x2 = params["radius2"] 127 theta = params["theta"] 141 128 self.set_cursor(x1, x2, theta) 142 143
Note: See TracChangeset
for help on using the changeset viewer.