Index: guiframe/local_perspectives/plotting/boxSum.py
===================================================================
--- guiframe/local_perspectives/plotting/boxSum.py	(revision 0f6d05f8708140b1338625a6925337e321ad9ce6)
+++ guiframe/local_perspectives/plotting/boxSum.py	(revision 2a3a890770dc75b809711bc48f24646305f01fde)
@@ -21,10 +21,10 @@
          Select an annulus through a 2D plot
     """
-    def __init__(self,base,axes,color='black', zorder=3, x_min=0.0025, x_max=0.0025, y_min=0.0025, y_max=0.0025):
+    def __init__(self,base,axes,color='black', zorder=3, x_min=0.008, x_max=0.008, y_min=0.0025, y_max=0.0025):
         
         _BaseInteractor.__init__(self, base, axes, color=color)
         self.markers = []
         self.axes = axes
-        self.qmax = self.base.qmax
+        self.qmax = self.base.data2D.xmax
         self.connect = self.base.connect
         
@@ -34,6 +34,6 @@
         self.ymax=  y_max
         # center of the figure
-        self.center_x= 0.0
-        self.center_y= 0.0
+        self.center_x= 0.002
+        self.center_y= 0.003
        
         ## Number of points on the plot
@@ -41,34 +41,27 @@
         self.count=0
         self.error=0
-        
-        self.left_line = VerticalLine(self, self.base.subplot,color='blue', zorder=zorder, 
-                                        ymin= self.ymin, ymax= self.ymax,
-                                        x= self.xmin,
-                                        center_x= self.center_x,
-                                        center_y= self.center_y)
-        self.left_line.qmax = self.base.qmax
-        
-        self.right_line= VerticalLine(self, self.base.subplot,color='black', zorder=zorder,
-                                     ymin= self.ymin, ymax= self.ymax,
-                                     x=self.xmax,
-                                     center_x= self.center_x,
-                                     center_y= self.center_y)
-        self.right_line.qmax = self.base.qmax
-        
-        self.top_line= HorizontalLine(self, self.base.subplot,color='green', zorder=zorder,
+        self.has_move= False
+    
+        self.horizontal_lines= Horizontal_DoubleLine(self, self.base.subplot,color='blue',
+                                                      zorder=zorder,
                                     y= self.ymax,
-                                    xmin= self.xmin, xmax= self.xmax,
+                                    x= self.xmax,
                                     center_x= self.center_x,
                                     center_y= self.center_y)
-        self.top_line.qmax = self.base.qmax
-        
-        self.bottom_line= HorizontalLine(self, self.base.subplot,color='red', zorder=zorder,
-                                    y =self.ymin,
-                                    xmin= self.xmin, xmax= self.xmax,
+        self.horizontal_lines.qmax = self.qmax
+        
+        self.vertical_lines= Vertical_DoubleLine(self, self.base.subplot,color='black',
+                                                      zorder=zorder,
+                                    y= self.ymax,
+                                    x= self.xmax,
                                     center_x= self.center_x,
                                     center_y= self.center_y)
-        self.bottom_line.qmax = self.base.qmax
-        #self.outer_circle.set_cursor(self.base.qmax/1.8, 0)
-        
+        self.vertical_lines.qmax = self.qmax
+        self.center= PointInteractor(self, self.base.subplot,color='grey',
+                                                      zorder=zorder,
+                                    center_x= self.center_x,
+                                    center_y= self.center_y)
+      
+            
         self.connect_markers([])
                       
@@ -107,8 +100,7 @@
     def clear(self):
         self.clear_markers()
-        self.left_line.clear()
-        self.right_line.clear()
-        self.top_line.clear()
-        self.bottom_line.clear()
+        self.horizontal_lines.clear()
+        self.vertical_lines.clear()
+        self.center.clear()
         
         #self.base.connect.disconnect()
@@ -120,45 +112,24 @@
         resetting the widgets.
         """
-        if self.left_line.has_move:
-            print "left has moved"
-            self.left_line.update(mline=[self.center_x, self.center_y],translation=True)
-            
-            #self.right_line.update(mline= [self.center_x, self.center_y],translation=True)
-            self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x,
-                                  mline= [self.center_x, self.center_y],translation=True)
-            self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x,
-                                    mline= [self.center_x, self.center_y],translation=True)
-        if self.right_line.has_move:
+        if self.center.has_move:
+            print "center has move"
+            self.center.update()
+            self.horizontal_lines.update( center= self.center)
+            self.vertical_lines.update( center= self.center)
+            
+        if self.horizontal_lines.has_move:
+            print "top has moved"
+            self.horizontal_lines.update()
+            self.vertical_lines.update(y1=self.horizontal_lines.y1,
+                                       y2=self.horizontal_lines.y2,
+                                       height= self.horizontal_lines.half_height )
+        if self.vertical_lines.has_move:
             print "right has moved"
-            self.right_line.update(mline= [self.center_x, self.center_y],translation=True)
-            #self.left_line.update(mline=[self.center_x, self.center_y],translation=True)
-            #self.left_line.update(xmin= self.right_line.x ,xmax=-1*self.right_line.x)
-            self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x,
-                                  mline= [self.center_x, self.center_y],translation=True)
-            self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x,
-                                    mline= [self.center_x, self.center_y],translation=True)
-            
-            
-        if self.bottom_line.has_move:
-            print "bottom has moved"
-            self.bottom_line.update(mline= [self.center_x, self.center_y],translation=True)
-            #self.top_line.update(y= -1*self.top_line.y,translation=True)
-            self.left_line.update( ymin= self.bottom_line.y ,ymax= self.top_line.y,
-                                   mline= [self.center_x, self.center_y],translation=True)
-            self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y,
-                                   mline= [self.center_x, self.center_y],translation=True)
-            
-        if self.top_line.has_move:
-            print "top has moved"
-            self.top_line.update(mline= [self.center_x, self.center_y],translation=True)
-            
-            #self.bottom_line.update(y= -1*self.top_line.y,mline= [self.center_x, self.center_y],
-            #                        translation=True )
-            self.left_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y,
-                                  mline= [self.center_x, self.center_y],translation=True)
-            self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y,
-                                   mline= [self.center_x, self.center_y],translation=True)
-            
-    
+            self.vertical_lines.update()
+            self.horizontal_lines.update(x1=self.vertical_lines.x1,
+                                         x2=self.vertical_lines.x2,
+                                         width=self.vertical_lines.half_width)
+            
+
     def save(self, ev):
         """
@@ -167,9 +138,12 @@
         """
         self.base.freeze_axes()
-        self.inner_circle.save(ev)
-        self.outer_circle.save(ev)
-
+        self.horizontal_lines.save(ev)
+        self.vertical_lines.save(ev)
+        self.center.save(ev)
+        
     def _post_data(self):
         # Compute data
+        print 
+        """
         data = self.base.data2D
         from DataLoader.manipulations import  Boxavg
@@ -182,5 +156,5 @@
         self.count, self.error = box(self.base.data2D)
         print "count, error",self.count, self.error
-        
+        """
                                        
     def moveend(self, ev):
@@ -194,5 +168,5 @@
         
         wx.PostEvent(self.base.parent, event)
-
+      
         self._post_data()
             
@@ -201,15 +175,13 @@
         Restore the roughness for this layer.
         """
-        self.inner_circle.restore()
-        self.outer_circle.restore()
-
+        self.horizontal_lines.restore()
+        self.vertical_lines.restore()
+        self.center.restore()
     def move(self, x, y, ev):
         """
         Process move to a new position, making sure that the move is allowed.
         """
-        print "in move"
-        if self.xmin <= x and x <= self.xmax:
-            print "has move whole", x
-        
+        pass
+    
     def set_cursor(self, x, y):
         pass
@@ -217,10 +189,13 @@
     def get_params(self):
         params = {}
-        params["x_min"] = self.left_line.x 
-        params["x_max"] = self.right_line.x 
-        params["y_min"] = self.bottom_line.y
-        params["y_max"] = self.top_line.y
+       
+        params["x"] = math.fabs(self.horizontal_lines.half_width)
+        params["y"] = math.fabs(self.vertical_lines.half_height) 
+        
+        params["center_x"] = self.center.x
+        params["center_y"] =self.center.y
         params["count"] = self.count
         params["errors"]= self.error
+        
         return params
     
@@ -238,21 +213,25 @@
     def set_params(self, params):
         
-        x_min = -math.fabs(params["x_min"] )
-        x_max = math.fabs(params["x_max"] )
-        y_min = -math.fabs(params["y_min"])
-        y_max = math.fabs(params["y_max"]) 
-        
-        self.left_line.update(ymin= y_min ,ymax= y_max , x= x_min)
-        self.right_line.update(ymin= y_min ,ymax= y_max, x= x_max)
-        self.top_line.update( xmin= x_min ,xmax= x_max, y= y_max)
-        self.bottom_line.update(xmin= x_min ,xmax= x_max, y=y_min)
-        """
-        self.left_line.update(mline= [center_x, center_y],ymin= y_min ,ymax= y_max)
-        self.right_line.update(mline= [center_x, center_y],ymin= y_min ,ymax= y_max)
-        self.top_line.update(mline= [center_x, center_y], xmin= x_min ,xmax= xmax)
-        self.bottom_line.update(mline= [center_x, center_y],xmin= xmin ,xmax= xmax)
-        """
+        x_max = math.fabs(params["x"] )
+        y_max = math.fabs(params["y"] )
+        
+        self.center_x=params["center_x"] 
+        self.center_y=params["center_y"]
+        
+        self.center.update(center_x=self.center_x,center_y=self.center_y)
+       
+        self.horizontal_lines.update(center= self.center,
+                                     width=x_max,
+                                     height=y_max)
+        
+        
+        self.vertical_lines.update(center= self.center,
+                                    width=x_max,
+                                    height=y_max)
         
         self._post_data()
+        
+        
+        
     def freeze_axes(self):
         self.base.freeze_axes()
@@ -263,11 +242,138 @@
     def draw(self):
         self.base.draw()
-
-class HorizontalLine(_BaseInteractor):
+class PointInteractor(_BaseInteractor):
     """
          Select an annulus through a 2D plot
     """
-    def __init__(self,base,axes,color='black', zorder=5, y=0.5,
-                 xmin=0.0,xmax=0.5,
+    def __init__(self,base,axes,color='black', zorder=5,
+                 center_x= 0.0,
+                 center_y= 0.0):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        # center
+        self.x = center_x
+        self.y = center_y
+        
+        self.save_x = center_x
+        self.save_y = center_y
+         
+        
+        try:
+            self.center_marker = self.axes.plot([self.x],[self.y], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          pickradius=5, label="pick", 
+                                          zorder=zorder, # Prefer this to other lines
+                                          visible=True)[0]
+        except:
+            self.center_marker = self.axes.plot([self.x],[self.y], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          label="pick", 
+                                          visible=True)[0]
+            message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n"
+            message += "Get the SVN version that is at least as recent as June 1, 2007"
+            
+            #raise "Version error", message
+            
+        # line
+        self.center = self.axes.plot([self.x],[self.y],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+    
+        self.npts = 30
+        self.has_move=False    
+        self.connect_markers([self.center_marker])
+        self.update()
+
+
+    def set_layer(self, n):
+        self.layernum = n
+        self.update()
+        
+    def clear(self):
+        self.clear_markers()
+        try:
+            self.center.remove()
+        except:
+            # Old version of matplotlib
+            for item in range(len(self.axes.lines)):
+                del self.axes.lines[0]
+        
+    def get_radius(self):
+        
+        return 0
+   
+    def update(self, center_x=None,center_y=None):
+        """
+        Draw the new roughness on the graph.
+        """
+        if center_x !=None: self.x= center_x
+        if center_y !=None: self.y= center_y
+   
+        self.center_marker.set(xdata=[self.x], ydata=[self.y])
+        self.center.set(xdata=[self.x], ydata=[self.y])
+        
+        
+        
+        
+    def save(self, ev):
+        """
+        Remember the roughness for this layer and the next so that we
+        can restore on Esc.
+        """
+        self.save_x= self.x
+        self.save_y= self.y
+        
+        self.base.freeze_axes()
+
+    def moveend(self, ev):
+        
+        self.has_move=False
+        self.base.moveend(ev)
+            
+    def restore(self):
+        """
+        Restore the roughness for this layer.
+        """
+        self.y= self.save_y
+        self.x= self.save_x
+        
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        self.x= x
+        self.y= y
+       
+        self.has_move=True
+        self.base.base.update()
+        
+    def set_cursor(self, x, y):
+        self.move(x, y, None)
+        self.update()
+        
+        
+    def get_params(self):
+        params = {}
+        params["x"] = self.x
+        params["y"] = self.y
+        
+        return params
+    
+    def set_params(self, params):
+        center_x = params["x"] 
+        center_y = params["y"] 
+        self.update(center_x=center_x,center_y=center_y)
+       
+        
+class Vertical_DoubleLine(_BaseInteractor):
+    """
+         Select an annulus through a 2D plot
+    """
+    def __init__(self,base,axes,color='black', zorder=5, x=0.5,y=0.5,
                  center_x= 0.0,
                  center_y= 0.0):
@@ -280,23 +386,61 @@
         self.center_y = center_y
         
-        self.y= y - self.center_y
-        self.save_y= y- self.center_y
-        
-        self.xmin = xmin - self.center_x
-        self.save_xmin = xmin - self.center_x
-        self.xmax = xmax - self.center_x
-        self.save_xmax = xmax - self.center_x
-        
-       
-        self.line = self.axes.plot([self.xmin,self.xmax],[self.y,self.y],
+       
+        
+        self.y1     = y + self.center_y
+        self.save_y1= self.y1
+        
+        delta= self.y1- self.center_y
+        self.y2= self.center_y - delta
+        self.save_y2= self.y2
+        
+        self.x1      = x + self.center_x
+        self.save_x1 = self.x1
+         
+        delta= self.x1- self.center_x
+        self.x2= self.center_x - delta
+        self.save_x2 = self.x2
+        
+        self.color=color
+        
+        self.half_height= math.fabs(y)
+        self.save_half_height= math.fabs(y)
+        
+        self.half_width= math.fabs(x)
+        self.save_half_width=math.fabs(x)
+        
+        try:
+            self.right_marker = self.axes.plot([self.x1],[0], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          pickradius=5, label="pick", 
+                                          zorder=zorder, # Prefer this to other lines
+                                          visible=True)[0]
+        except:
+            self.right_marker = self.axes.plot([self.x1],[0], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          label="pick", 
+                                          visible=True)[0]
+            message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n"
+            message += "Get the SVN version that is at least as recent as June 1, 2007"
+            
+            #raise "Version error", message
+            
+        # line
+        self.right_line = self.axes.plot([self.x1,self.x1],[self.y1,self.y2],
                                       linestyle='-', marker='',
                                       color=self.color,
                                       visible=True)[0]
- 
-
-        self.npts = 20
-        self.has_move=False
-        self.connect_markers([self.line])
-        self.update()
+        self.left_line = self.axes.plot([self.x2,self.x2],[self.y1,self.y2],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+    
+        self.npts = 30
+        self.has_move=False    
+        self.connect_markers([self.right_marker])
+        self.update()
+
 
     def set_layer(self, n):
@@ -307,6 +451,6 @@
         self.clear_markers()
         try:
-            
-            self.line.remove()
+            self.right_line.remove()
+            self.left_line.remove()
         except:
             # Old version of matplotlib
@@ -318,18 +462,40 @@
         return 0
    
-    def update(self,xmin=None, xmax=None,y=None, mline=None,translation=False):
+    def update(self,x1=None,x2=None, y1=None,y2=None,width=None, height=None, center=None):
         """
         Draw the new roughness on the graph.
         """
-        #print "update main line", self.has_move
-        if xmin !=None:
-            self.xmin = xmin # - self.center_x
-        if xmax !=None:
-            self.xmax = xmax #- self.center_x
-        if y !=None:
-            self.y = y #- self.center_y
-        
-        self.line.set(xdata=[self.xmin,self.xmax], ydata=[self.y,self.y])
-     
+        if width!=None:
+            self.half_width= width
+        if height!=None:
+            self.half_height= height
+        if center!=None:
+            self.center_x= center.x
+            self.center_y= center.y
+            
+            self.x1 = self.half_width + self.center_x
+            self.x2= -self.half_width + self.center_x
+            
+            self.y1 = self.half_height + self.center_y
+            self.y2= -self.half_height + self.center_y
+         
+            self.right_marker.set(xdata=[self.x1],ydata=[self.center_y])
+            self.right_line.set(xdata=[self.x1,self.x1], ydata=[self.y1,self.y2])
+            self.left_line.set(xdata=[self.x2,self.x2], ydata=[self.y1,self.y2])
+            return 
+        if x1 !=None: 
+            self.x1= x1
+        if x2 !=None: 
+            self.x2= x2
+        if y1 !=None: 
+            self.y1= y1
+        if y2 !=None: 
+            self.y2= y2
+        
+       
+       
+        self.right_marker.set(xdata=[self.x1],ydata=[self.center_y])
+        self.right_line.set(xdata=[self.x1,self.x1], ydata=[self.y1,self.y2])
+        self.left_line.set(xdata=[self.x2,self.x2], ydata=[self.y1,self.y2])
         
         
@@ -339,8 +505,12 @@
         can restore on Esc.
         """
-        self.save_xmin= self.xmin
-        self.save_xmax= self.xmax
-       
-        self.save_y= self.y
+        self.save_x2= self.x2
+        self.save_y2= self.y2
+        
+        self.save_x1= self.x1
+        self.save_y1= self.y1
+        
+        self.save_half_height= self.half_height
+        self.save_half_width =  self.half_width
         self.base.freeze_axes()
 
@@ -354,5 +524,12 @@
         Restore the roughness for this layer.
         """
-        self.y= self.save_y
+        self.y2= self.save_y2
+        self.x2= self.save_x2
+        
+        self.y1= self.save_y1
+        self.x1= self.save_x1
+        
+        self.half_height= self.save_half_height
+        self.half_width= self.save_half_width
        
     def move(self, x, y, ev):
@@ -360,6 +537,9 @@
         Process move to a new position, making sure that the move is allowed.
         """
-        self.y= y - self.center_y
-        
+        self.x1= x
+        delta= self.x1- self.center_x
+        self.x2= self.center_x - delta
+        
+        self.half_width= math.fabs(self.x1)-self.center_x
         self.has_move=True
         self.base.base.update()
@@ -372,52 +552,84 @@
     def get_params(self):
         params = {}
-        params["radius"] = self.xmin
-        params["theta"] = self.xmax
+        params["x"] = self.x1
+        params["y"] = self.y1
         
         return params
     
     def set_params(self, params):
-
-        x = params["radius"] 
-        self.set_cursor(x, self._inner_mouse_y)
-        
-
-
-
-class VerticalLine(_BaseInteractor):
+        x = params["x"] 
+        y = params["y"] 
+        self.update(x=x, y=y, center_x=None,center_y=None)
+
+class Horizontal_DoubleLine(_BaseInteractor):
     """
          Select an annulus through a 2D plot
     """
-    def __init__(self,base,axes,color='black', zorder=5, ymin=0.0, 
-                 ymax=0.5,x= 0.5,
-                   center_x= 0,
-                 center_y= 0):
+    def __init__(self,base,axes,color='black', zorder=5, x=0.5,y=0.5,
+                 center_x= 0.0,
+                 center_y= 0.0):
         
         _BaseInteractor.__init__(self, base, axes, color=color)
         self.markers = []
         self.axes = axes
-        # x coordinate of the vertical line
-        self.center_x= center_x
-        self.center_y= center_y
-        self.x = x - center_x
-        self.save_x = x - center_x
-        # minimum value of y coordinate of the vertical line 
-        self.ymin = ymin - center_y
-        self.save_ymin = ymin - center_y
-        # maximum value of y coordinate of the vertical line 
-        self.ymax= ymax - center_y
-        self.save_ymax= ymax - center_y
-        
-        # Draw vertical line
-        self.line = self.axes.plot([self.x,self.x],[self.ymin,self.ymax],
+        # center
+        self.center_x = center_x
+        self.center_y = center_y
+        
+        self.y1     = y + self.center_y
+        self.save_y1= self.y1
+        
+        delta= self.y1- self.center_y
+        self.y2=  self.center_y - delta
+        self.save_y2= self.y2
+        
+        self.x1      = x + self.center_x
+        self.save_x1 = self.x1
+        
+        delta= self.x1- self.center_x
+        self.x2=  self.center_x - delta
+        self.save_x2 = self.x2
+        
+        self.color=color
+        
+        self.half_height= math.fabs(y)
+        self.save_half_height= math.fabs(y)
+        
+        self.half_width= math.fabs(x)
+        self.save_half_width=math.fabs(x)
+    
+        try:
+            self.top_marker = self.axes.plot([0],[self.y1], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          pickradius=5, label="pick", 
+                                          zorder=zorder, # Prefer this to other lines
+                                          visible=True)[0]
+        except:
+            self.top_marker = self.axes.plot([0],[self.y1], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          label="pick", 
+                                          visible=True)[0]
+            message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n"
+            message += "Get the SVN version that is at least as recent as June 1, 2007"
+            
+            #raise "Version error", message
+            
+        # line
+        self.top_line = self.axes.plot([self.x1,-self.x1],[self.y1,self.y1],
                                       linestyle='-', marker='',
                                       color=self.color,
                                       visible=True)[0]
-      
-        self.npts = 20
-        # Check vertical line motion
-        self.has_move=False
-        self.connect_markers([self.line])
-        self.update()
+        self.bottom_line = self.axes.plot([self.x1,-self.x1],[self.y2,self.y2],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+    
+        self.npts = 30
+        self.has_move=False    
+        self.connect_markers([self.top_marker])
+        self.update()
+
 
     def set_layer(self, n):
@@ -428,6 +640,6 @@
         self.clear_markers()
         try:
-            
-            self.line.remove()
+            self.bottom_line.remove()
+            self.top_line.remove()
         except:
             # Old version of matplotlib
@@ -436,19 +648,43 @@
         
     def get_radius(self):
+        
         return 0
-    
-    def update(self,x=None,ymin=None, ymax=None, mline=None,translation=False):
+   
+    def update(self,x1=None,x2=None, y1=None,y2=None,width=None,height=None, center=None):
         """
         Draw the new roughness on the graph.
         """
-        if x!=None:
-            self.x = x #-self.center_x
-        if ymin !=None:
-            self.ymin = ymin #- self.center_y
-        if ymax !=None:
-            self.ymax = ymax #- self.center_y
-        
-        self.line.set(xdata=[self.x,self.x], ydata=[self.ymin,self.ymax])
-     
+        if width!=None:
+            self.half_width= width
+        if height!=None:
+            self.half_height= height
+        if center!=None:
+            self.center_x= center.x
+            self.center_y= center.y
+            
+            self.x1 = self.half_width + self.center_x
+            self.x2= -self.half_width + self.center_x
+            
+            self.y1 = self.half_height + self.center_y
+            self.y2= -self.half_height + self.center_y
+            
+            self.top_marker.set(xdata=[self.center_x],ydata=[self.y1])
+            self.top_line.set(xdata=[self.x1,self.x2], ydata=[self.y1,self.y1])
+            self.bottom_line.set(xdata=[self.x1,self.x2], ydata=[self.y2,self.y2])
+            return 
+        if x1 !=None: 
+            self.x1= x1
+        if x2 !=None: 
+            self.x2= x2
+        if y1 !=None: 
+            self.y1= y1
+        if y2 !=None: 
+            self.y2= y2
+       
+             
+        self.top_marker.set(xdata=[self.center_x],ydata=[self.y1])
+        self.top_line.set(xdata=[self.x1,self.x2], ydata=[self.y1,self.y1])
+        self.bottom_line.set(xdata=[self.x1,self.x2], ydata=[self.y2,self.y2])
+       
         
         
@@ -458,9 +694,14 @@
         can restore on Esc.
         """
-        self.save_x= self.x
-        self.save_ymin= self.ymin
-        self.save_ymax= self.ymax
-        
+        self.save_x2= self.x2
+        self.save_y2= self.y2
+        
+        self.save_x1= self.x1
+        self.save_y1= self.y1
+        
+        self.save_half_height= self.half_height
+        self.save_half_width =  self.half_width
         self.base.freeze_axes()
+
 
     def moveend(self, ev):
@@ -473,18 +714,23 @@
         Restore the roughness for this layer.
         """
-        self.x = self.save_x
-        
-        self.ymin=self.save_ymin
-        self.ymax=self.save_ymax
+        self.y2= self.save_y2
+        self.x2= self.save_x2
+        
+        self.y1= self.save_y1
+        self.x1= self.save_x1
+        self.half_height= self.save_half_height
+        self.half_width= self.save_half_width
+        
     def move(self, x, y, ev):
         """
         Process move to a new position, making sure that the move is allowed.
         """
-        self.x = x - self.center_x
-       
+        self.y1= y
+        delta= self.y1- self.center_y
+        self.y2=  self.center_y - delta
+        self.half_height=  math.fabs(self.y1)-self.center_y
         self.has_move=True
         self.base.base.update()
         
-        
     def set_cursor(self, x, y):
         self.move(x, y, None)
@@ -494,21 +740,12 @@
     def get_params(self):
         params = {}
-        params["x"] = self.xmin
-        params["ymin"] = self.ymin
-        params["ymax"] = self.ymax
+        params["x"] = self.x
+        params["y"] = self.y
+        
         return params
     
     def set_params(self, params):
-        """
-            Draw a vertical line given some value of params
-            @param params: a dictionary containing value for x, ymin , ymax to draw 
-            a vertical line
-        """
         x = params["x"] 
-        ymin = params["ymin"] 
-        ymax = params["ymax"] 
-        #self.set_cursor(x, self._inner_mouse_y)
-        self.update(self,x =x,ymin =ymin, ymax =ymax)
-        
-
+        y = params["y"] 
+        self.update(x=x, y=y, center_x=None,center_y=None)
          
