Index: /inundation/ga/storm_surge/pmesh/mesh.py
===================================================================
--- /inundation/ga/storm_surge/pmesh/mesh.py	(revision 1106)
+++ /inundation/ga/storm_surge/pmesh/mesh.py	(revision 1107)
@@ -1237,20 +1237,47 @@
         self.userSegments.extend(newsegs)
         return newsegs
-    def autoSegmentFilter(self,):
-        pass
+    def autoSegmentFilter(self,raw_boundary=True,
+                    remove_holes=False,
+                    smooth_indents=False,
+                    expand_pinch=False):
+        """
+        Precon: There is a self.shape
+        """
+        #FIXME remove the precon.  Internally check
+        return self._boundary2mesh(raw_boundary=raw_boundary,
+                    remove_holes=remove_holes,
+                    smooth_indents=smooth_indents,
+                    expand_pinch=expand_pinch)
+        
     
     def autoSegment(self, alpha = None,
-                                 raw_boundary=True,
-                                 remove_holes=False,
-                                 smooth_indents=False,
-                                 expand_pinch=False): 
+                    raw_boundary=True,
+                    remove_holes=False,
+                    smooth_indents=False,
+                    expand_pinch=False): 
         """
         Precon: There must be 3 or more vertices in the userVertices structure
         """
-        
+        self._createBoundary(alpha=alpha)
+        return self._boundary2mesh(raw_boundary=raw_boundary,
+                    remove_holes=remove_holes,
+                    smooth_indents=smooth_indents,
+                    expand_pinch=expand_pinch)
+
+    def _createBoundary(self,alpha=None):
+        """
+        """
         points=[]
         for vertex in self.getUserVertices():
             points.append((vertex.x,vertex.y))
         self.shape = alpha_shape.alpha_shape.Alpha_Shape(points, alpha = alpha)
+
+    def _boundary2mesh(self, raw_boundary=True,
+                    remove_holes=False,
+                    smooth_indents=False,
+                    expand_pinch=False):
+        """
+        Precon there must be a shape object.
+        """
         self.shape.set_boundary_type(raw_boundary=raw_boundary,
                                  remove_holes=remove_holes,
Index: /inundation/ga/storm_surge/pmesh/pmesh.py
===================================================================
--- /inundation/ga/storm_surge/pmesh/pmesh.py	(revision 1106)
+++ /inundation/ga/storm_surge/pmesh/pmesh.py	(revision 1107)
@@ -657,18 +657,11 @@
         add Segments to bound all vertices
         
-        the parent attribute isn't used by this function.
-        need to userstand toolbarbutton.py to know how to
-        get rid of it.
         """
         if len(self.mesh.getUserVertices()) >= 3:
-            if alpha == None:
-                newsegs, ObjectsToVisuallyDelete, self.meshLastAlpha = self.mesh.autoSegment(remove_holes=remove_holes,
-                                 smooth_indents=smooth_indents,
-                                 expand_pinch=expand_pinch)
-            else:
-                newsegs, ObjectsToVisuallyDelete, self.meshLastAlpha = self.mesh.autoSegment(alpha=alpha, remove_holes=remove_holes,
-                                 smooth_indents=smooth_indents,
-                                 expand_pinch=expand_pinch)
-                
+            newsegs, ObjectsToVisuallyDelete, self.meshLastAlpha = \
+                     self.mesh.autoSegment(alpha=alpha,
+                                           remove_holes=remove_holes,
+                                           smooth_indents=smooth_indents,
+                                           expand_pinch=expand_pinch)
             #print "newsegs",newsegs
             #print "ObjectsToVisuallyDelete",ObjectsToVisuallyDelete
@@ -691,6 +684,23 @@
 
     def autoSegmentFilter (self):
-        dialog = autoSegmentFilterDialog(self.canvas)
-        dialog.use_optimum.get() == SET_ALPHA
+        dialog = AutoSegmentFilterDialog(self.canvas)
+        newsegs, ObjectsToVisuallyDelete, self.meshLastAlpha = \
+                 self.mesh.autoSegmentFilter(raw_boundary=dialog.raw_boundary.get(),
+                             remove_holes=dialog.remove_holes.get(),
+                             smooth_indents=dialog.smooth_indents.get(),
+                             expand_pinch=dialog.expand_pinch.get())
+        #print "newsegs",newsegs
+        #print "ObjectsToVisuallyDelete",ObjectsToVisuallyDelete
+            
+        for drawOb in ObjectsToVisuallyDelete:
+            self.UserMesh.unvisualise(drawOb, self.canvas)
+                
+        for segment in newsegs:
+            self.serial +=1
+            self.uniqueID = 'M*%d' % self.serial
+            self.Segments.visualise(segment,
+                                    self.uniqueID,
+                                    self.canvas,
+                                    self.SCALE)
         
     def joinVerticesButton (self, parent):
@@ -1602,6 +1612,5 @@
     Dialog box for adding segments
     """
-    def __init__(self, parent, alpha):
-        self.alpha = alpha
+    def __init__(self, parent):
         Dialog.__init__(self, parent)
         
@@ -1616,72 +1625,34 @@
                                    #  It doesn't
         self.boundary_type = IntVar()
-                                   
-        #self.use_optimum.set(NO_SELECTION) 
-        self.ck = Radiobutton(master, value = AUTO, variable=self.use_optimum) 
-        self.ck.grid(row=1, column=0)
-        Label(master, text='Use optimum alpha').grid(row=1, column=1, sticky=W)
-
-        self.ck2 = Radiobutton(master, value = SET_ALPHA,
-                               variable=self.use_optimum) 
-        self.ck2.grid(row=2, column=0)
-        
-        Label(master, text='alpha:').grid(row=2, column=1, sticky=W)
-        if (self.alpha):
-            alphaVar = StringVar()
-            alphaVar.set(self.alpha)
-            self.alpha_str  = Entry(master,
-                                     textvariable = alphaVar,
-                                     width = 16, name ="entry") 
-        else: 
-            self.alpha_str = Entry(master, width = 16, name ="entry")
-        
-        self.alpha_str.grid(row=2, column=3, sticky=W)
-
+                      
         #boundary type buttons
-        self.ck3 = Radiobutton(master, value = mesh.RAW,
-                               variable=self.boundary_type) 
+        self.raw_boundary = IntVar()
+        self.remove_holes = IntVar()
+        self.smooth_indents = IntVar()
+        self.expand_pinch = IntVar()
+        
+        self.ck3 = Checkbutton(master, state=NORMAL,
+                               variable=self.raw_boundary) 
         self.ck3.grid(row=3, column=0)
         Label(master, text='Raw boundary').grid(row=3, column=1, sticky=W)
         #
-        self.ck4 = Radiobutton(master, value = mesh.REMOVE_HOLES,
-                               variable=self.boundary_type) 
+        self.ck4 = Checkbutton(master, state=NORMAL,
+                               variable=self.remove_holes) 
         self.ck4.grid(row=4, column=0)
         Label(master, text='Remove small holes').grid(row=4,column=1, sticky=W)
         #
-        self.ck5 = Radiobutton(master, value = mesh.REMOVE_SHARP_INDENTS,
-                               variable=self.boundary_type) 
+        self.ck5 = Checkbutton(master,state=NORMAL,
+                               variable=self.smooth_indents) 
         self.ck5.grid(row=5, column=0)
         Label(master,
-              text='Remove small holes \n& sharp indents').grid(row=5,
-                                                              column=1,
-                                                              sticky=W)
+              text='Remove sharp indents').grid(row=5, column=1, sticky=W)
         #
-        self.ck6 = Radiobutton(master, value = mesh.REMOVE_PINCH_OFF,
-                               variable=self.boundary_type) 
+        self.ck6 = Checkbutton(master,state=NORMAL,
+                               variable=self.expand_pinch) 
         self.ck6.grid(row=6, column=0)
         Label(master,
-              text='Remove small holes & \nsharp indents & pinch off').grid( \
-                                                              row=6,
-                                                              column=1,
-                                                              sticky=W)
-
-        
-        self.alpha  = 0
-        self.alphaValueOk = False
-        
-
-    def apply(self):
-        """
-        check entered values
-        """
-        try:
-            self.alpha = float(self.alpha_str.get())
-            self.alphaValueOk = True
-            
-        except ValueError:
-            pass
-            #showerror('Bad Alpha value',
-            #                       'Alpha is negative.')
-
+              text='Remove pinch off').grid(row=6, column=1,  sticky=W)
+        
+        
 
 
