Changeset cd68f8c in sasview for guiframe/local_perspectives


Ignore:
Timestamp:
Jan 5, 2009 8:14:54 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
7ab9241
Parents:
8ff3ec1
Message:

working on box slicer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/local_perspectives/plotting/boxSlicer.py

    r8ff3ec1 rcd68f8c  
    126126        if self.left_line.has_move: 
    127127            print "left has moved" 
    128             self.left_line.update() 
    129             self.right_line.update() 
     128            self.left_line.update(mline= self.main_line,translation=True) 
     129            self.right_line.update(mline= self.main_line,translation=True) 
    130130            #self.right_line.update(xmin= self.left_line.x ,xmax=-1*self.left_line.x) 
    131             self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x) 
    132             self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x) 
     131            self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x, 
     132                                  mline= self.main_line,translation=True) 
     133            self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x, 
     134                                    mline= self.main_line,translation=True) 
    133135        if self.right_line.has_move: 
    134136            print "right has moved" 
    135             self.right_line.update() 
    136             self.left_line.update() 
     137            self.right_line.update(mline= self.main_line,translation=True) 
     138            self.left_line.update(mline= self.main_line,translation=True) 
    137139            #self.left_line.update(xmin= self.right_line.x ,xmax=-1*self.right_line.x) 
    138             self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x) 
    139             self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x) 
     140            self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x, 
     141                                  mline= self.main_line,translation=True) 
     142            self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x, 
     143                                    mline= self.main_line,translation=True) 
    140144             
    141145             
    142146        if self.bottom_line.has_move: 
    143147            print "bottom has moved" 
    144             self.bottom_line.update() 
    145             self.top_line.update(y= -1*self.top_line.y) 
    146             self.left_line.update( ymin= self.bottom_line.y ,ymax= self.top_line.y) 
    147             self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y) 
     148            self.bottom_line.update(mline= self.main_line,translation=True) 
     149            self.top_line.update(y= -1*self.top_line.y,translation=True) 
     150            self.left_line.update( ymin= self.bottom_line.y ,ymax= self.top_line.y, 
     151                                   mline= self.main_line,translation=True) 
     152            self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y, 
     153                                   mline= self.main_line,translation=True) 
    148154             
    149155        if self.top_line.has_move: 
    150156            print "top has moved" 
    151             self.top_line.update() 
     157            self.top_line.update(mline= self.main_line,translation=True) 
    152158            #self.bottom_line.update()xmin=None, xmax=None,y=None, mline=None): 
    153             self.bottom_line.update(y= -1*self.top_line.y ) 
    154             self.left_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y) 
    155             self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y) 
     159            self.bottom_line.update(y= -1*self.top_line.y,mline= self.main_line, 
     160                                    translation=True ) 
     161            self.left_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y, 
     162                                  mline= self.main_line,translation=True) 
     163            self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y, 
     164                                   mline= self.main_line,translation=True) 
    156165             
    157166     
     
    274283        self.phi_left= self.theta_left - self.theta2 
    275284        self.phi_right=  self.theta_right -  self.theta2  
    276         #print "phi left right", math.degrees(self.phi_left),math.degrees(self.phi_right) 
    277         print "theta left right ", math.degrees(self.theta_left),math.degrees(self.theta_right) 
     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) 
    278287         
    279288        self.line = self.axes.plot([self.xmin,self.xmax],[self.y,self.y], 
     
    306315        return 0 
    307316    
    308     def update(self,xmin=None, xmax=None,y=None, mline=None): 
     317    def update(self,xmin=None, xmax=None,y=None, mline=None,translation=False): 
    309318        """ 
    310319        Draw the new roughness on the graph. 
     
    331340            print x1,x2,y1,y2 
    332341            
    333         else: 
    334             self.line.set(xdata=[self.xmin,self.xmax], ydata=[self.y,self.y]) 
     342        #else: 
     343        #    self.line.set(xdata=[self.xmin,self.xmax], ydata=[self.y,self.y]) 
    335344      
    336345         
     
    364373        """ 
    365374        self.y=y 
    366         
     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  
    367383         
    368384        self.has_move=True 
     
    420436        self.phi_up= self.theta_up - self.theta2 
    421437        print "phi up down", math.degrees(self.phi_up),math.degrees(self.phi_down) 
    422         print "theta up down ", math.degrees(self.theta_up),math.degrees(self.theta_down) 
     438        #print "theta up down ", math.degrees(self.theta_up),math.degrees(self.theta_down) 
    423439        # Draw vertical line 
    424440        self.line = self.axes.plot([self.x,self.x],[self.ymin,self.ymax], 
     
    450466        return 0 
    451467     
    452     def update(self,x=None,ymin=None, ymax=None, mline=None): 
     468    def update(self,x=None,ymin=None, ymax=None, mline=None,translation=False): 
    453469        """ 
    454470        Draw the new roughness on the graph. 
     
    461477            self.ymax = ymax 
    462478        if mline !=None: 
     479             
    463480            self.theta2= mline.theta 
    464481            delta = mline.get_delta_angle() 
     482            if translation: 
     483                delta= 0 
    465484            # rotation 
    466485            x1 = self.radius1 * math.cos(self.phi_down +  delta) 
     
    472491            self.line.set(xdata=[x1,x2], ydata=[y1,y2])   
    473492            
    474         else: 
    475            self.line.set(xdata=[self.x,self.x], ydata=[self.ymin,self.ymax]) 
     493        #else: 
     494        #   self.line.set(xdata=[self.x,self.x], ydata=[self.ymin,self.ymax]) 
    476495      
    477496         
     
    506525        """ 
    507526        self.x = x 
     527        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.theta2 
     536        self.phi_up= self.theta_up - self.theta2 
     537        
    508538        self.has_move=True 
    509539        self.base.base.update() 
Note: See TracChangeset for help on using the changeset viewer.