Changeset 78ed1ad in sasview for guiframe/local_perspectives
- Timestamp:
- Jan 6, 2009 5:16:32 PM (16 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:
- 86c1832
- Parents:
- 7ab9241
- Location:
- guiframe/local_perspectives/plotting
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/boxSlicer.py
r7ab9241 r78ed1ad 44 44 self.left_line = VerticalLine(self, self.base.subplot,color='blue', zorder=zorder, 45 45 ymin= self.ymin, ymax= self.ymax, 46 x = self.xmin,46 xmin= self.xmin,xmax= self.xmin, 47 47 theta2= self.theta2) 48 48 self.left_line.qmax = self.base.qmax … … 50 50 self.right_line= VerticalLine(self, self.base.subplot,color='black', zorder=zorder, 51 51 ymin= self.ymin, ymax= self.ymax, 52 x =self.xmax,52 xmin=self.xmax,xmax=self.xmax, 53 53 theta2= self.theta2) 54 54 self.right_line.qmax = self.base.qmax … … 127 127 print "left has moved" 128 128 self.left_line.update(mline= self.main_line,translation=True) 129 self.right_line.update( mline= self.main_line,translation=True)129 self.right_line.update(x=-1*self.left_line.x,mline= self.main_line,translation=True) 130 130 #self.right_line.update(xmin= self.left_line.x ,xmax=-1*self.left_line.x) 131 131 self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x, … … 136 136 print "right has moved" 137 137 self.right_line.update(mline= self.main_line,translation=True) 138 self.left_line.update( mline= self.main_line,translation=True)138 self.left_line.update(x=-1*self.right_line.x,mline= self.main_line,translation=True) 139 139 #self.left_line.update(xmin= self.right_line.x ,xmax=-1*self.right_line.x) 140 140 self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x, … … 219 219 def get_params(self): 220 220 params = {} 221 params["x_min"] = self.left_line.x 222 params["x_max"] = self.right_line.x 221 params["x_min"] = self.left_line.xmin 222 params["x_max"] = self.right_line.xmax 223 223 params["y_min"] = self.bottom_line.y 224 224 params["y_max"] = self.top_line.y … … 264 264 self.axes = axes 265 265 266 self.y 266 self.y= y 267 267 self.save_y = y 268 268 … … 271 271 self.xmax = xmax 272 272 self.save_xmax = xmax 273 273 274 self.theta2 = theta2 274 self.radius1 = math.sqrt(math.pow(self.xmin, 2)+ math.pow(self.y, 2)) 275 self.radius2 = math.sqrt(math.pow(self.xmax, 2)+ math.pow(self.y, 2)) 276 277 278 #print "phi and theta2", math.degrees(math.atan2(self.y, self.xmax)) 279 280 self.theta_right= math.atan2(self.y,self.xmin) 281 self.theta_left= math.atan2(self.y,self.xmax) 282 283 self.phi_left= self.theta_left - self.theta2 284 self.phi_right= self.theta_right - self.theta2 285 print "phi left right", math.degrees(self.phi_left),math.degrees(self.phi_right) 286 #print "theta left right ", math.degrees(self.theta_left),math.degrees(self.theta_right) 287 288 self.line = self.axes.plot([self.xmin,self.xmax],[self.y,self.y], 275 276 277 x1= self.xmin*math.cos(self.theta2)- self.y*math.sin(self.theta2) 278 y1= self.xmin*math.sin(self.theta2)+ self.y*math.sin(self.theta2) 279 280 x2= self.xmax*math.cos(self.theta2)- self.y*math.sin(self.theta2) 281 y2= self.xmax*math.sin(self.theta2)+ self.y*math.sin(self.theta2) 282 print "x1, y1", x1, y1, x2,y2 283 self.line = self.axes.plot([x1,x2],[y1,y2], 289 284 linestyle='-', marker='', 290 285 color=self.color, … … 329 324 self.theta2= mline.theta 330 325 delta = mline.get_delta_angle() 331 # rotation332 x1 = self.radius1 * math.cos(self.phi_left + delta)333 y1= self. radius1 * math.sin(self.phi_left + delta)334 335 x2= -1*self.radius2 * math.cos( self.phi_right + delta)336 y2= -1*self.radius2 * math.sin(self.phi_right + delta)326 327 x1= self.xmin*math.cos(self.theta2)- self.y*math.sin(self.theta2) 328 y1= self.xmin*math.sin(self.theta2)+ self.y*math.sin(self.theta2) 329 330 x2= self.xmax*math.cos(self.theta2)- self.y*math.sin(self.theta2) 331 y2= self.xmax*math.sin(self.theta2)+ self.y*math.sin(self.theta2) 337 332 338 333 self.line.set(xdata=[x1,x2], ydata=[y1,y2]) … … 373 368 """ 374 369 self.y=y 375 #self.radius1= math.sqrt(math.pow(self.xmin, 2)+ math.pow(self.y, 2)) 376 #self.radius2= math.sqrt(math.pow(self.xmax, 2)+ math.pow(self.y, 2)) 377 378 #self.theta_right= math.atan2(self.y,self.xmin) 379 #self.theta_left= math.atan2(self.y,self.xmax) 380 381 #self.phi_left= self.theta_left - self.theta2 382 #self.phi_right= self.theta_right - self.theta2 370 383 371 384 372 self.has_move=True … … 409 397 """ 410 398 def __init__(self,base,axes,color='black', zorder=5, ymin=0.0, 411 ymax=0.5,x =0.5,399 ymax=0.5,xmin= 0.5,xmax=0.5, 412 400 theta2= math.pi/3 ): 413 401 … … 416 404 self.axes = axes 417 405 # x coordinate of the vertical line 418 self.x = x 419 self.save_x = x 406 self.xmin = xmin 407 self.save_xmin = xmin 408 self.xmax = xmax 409 self.save_xmax = xmax 420 410 # minimum value of y coordinate of the vertical line 421 411 self.ymin = ymin … … 425 415 self.save_ymax=ymax 426 416 #insure rotation 427 self.radius1= math.sqrt(math.pow(self.x , 2)+ math.pow(self.ymin, 2))428 self.radius2= math.sqrt(math.pow(self.x , 2)+ math.pow(self.ymax, 2))429 430 431 self.theta_down = math.atan2(self.ymin, self.x )432 self.theta_up = math.atan2(self.ymax, self.x )417 self.radius1= math.sqrt(math.pow(self.xmin, 2)+ math.pow(self.ymin, 2)) 418 self.radius2= math.sqrt(math.pow(self.xmax, 2)+ math.pow(self.ymax, 2)) 419 420 421 self.theta_down = math.atan2(self.ymin, self.xmin) 422 self.theta_up = math.atan2(self.ymax, self.xmax) 433 423 self.theta2= theta2 434 424 … … 438 428 #print "theta up down ", math.degrees(self.theta_up),math.degrees(self.theta_down) 439 429 # Draw vertical line 440 self.line = self.axes.plot([self.x,self.x],[self.ymin,self.ymax], 430 self.xmin= self.xmin* math.cos(self.theta2)-self.ymin *math.sin(self.theta2) 431 self.xmax= self.xmax* math.cos(self.theta2)-self.ymax *math.sin(self.theta2) 432 433 self.ymin= self.xmin* math.sin(self.theta2)+self.ymin *math.cos(self.theta2) 434 self.ymax= self.xmax* math.sin(self.theta2)+self.ymax *math.cos(self.theta2) 435 436 self.line = self.axes.plot([self.xmin,self.xmax],[self.ymin,self.ymax], 441 437 linestyle='-', marker='', 442 438 color=self.color, … … 488 484 x2= -1*self.radius2 * math.cos( self.phi_up + delta) 489 485 y2= -1*self.radius2 * math.sin(self.phi_up + delta) 490 491 self.line.set(xdata=[x1,x2], ydata=[y1,y2]) 486 self.xmin= x1 487 self.xmax=x2 488 self.ymin= y1 489 self.ymax= y2 490 self.line.set(xdata=[self.xmin,self.xmax], ydata=[self.ymin,self.ymax]) 492 491 493 492 #else: … … 501 500 can restore on Esc. 502 501 """ 503 self.save_x= self.x 502 #self.save_x= self.x 503 self.save_xmin= self.xmin 504 self.save_xmax= self.xmax 504 505 self.save_ymin= self.ymin 505 506 self.save_ymax= self.ymax … … 516 517 Restore the roughness for this layer. 517 518 """ 518 self.x = self.save_x519 519 self.xmin = self.save_xmin 520 self.xmax = self.save_xmax 520 521 self.ymin=self.save_ymin 521 522 self.ymax=self.save_ymax 523 524 522 525 def move(self, x, y, ev): 523 526 """ 524 527 Process move to a new position, making sure that the move is allowed. 525 528 """ 526 self.x = x527 self.radius1= math.sqrt(math.pow(self.x, 2)+ math.pow(self.ymin, 2))528 self.radius2= math.sqrt(math.pow(self.x, 2)+ math.pow(self.ymax, 2))529 530 531 self. theta_down = math.atan2(self.ymin, self.x)532 self. theta_up = math.atan2(self.ymax, self.x)533 534 535 self. phi_down= self.theta_down - self.theta2536 self.phi_up= self.theta_up - self.theta2537 529 delta_xmin = x- self.save_xmin 530 delta_xmax = x- self.save_xmax 531 delta_ymin = y- self.save_ymin 532 delta_ymax = y- self.save_ymax 533 534 self.xmin= self.xmin + delta_xmin 535 self.xmax= self.xmax + delta_xmax 536 537 self.ymin= self.ymin +delta_ymin 538 self.ymax= self.ymax +delta_ymax 539 540 538 541 self.has_move=True 539 542 self.base.base.update()
Note: See TracChangeset
for help on using the changeset viewer.