[GRASS-SVN] r45109 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 20 13:32:13 EST 2011


Author: mmetz
Date: 2011-01-20 10:32:13 -0800 (Thu, 20 Jan 2011)
New Revision: 45109

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py
Log:
wxGUI Georectifier: add setting option for interpolation method (backport from trunk r45108)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py	2011-01-20 18:30:43 UTC (rev 45108)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcpmanager.py	2011-01-20 18:32:13 UTC (rev 45109)
@@ -802,6 +802,8 @@
 
         # polynomial order transformation for georectification
         self.gr_order = 1 
+        # interpolation method for georectification
+        self.gr_method = 'nearest'
         # region clipping for georectified map
         self.clip_to_region = False
         # number of GCPs selected to be used for georectification (checked)
@@ -1348,6 +1350,7 @@
                                   group = self.xygroup,
                                   extension = self.extension,
                                   order = self.gr_order,
+                                  method=self.gr_method,
                                   flags = flags)
 
             busy.Destroy()
@@ -2358,6 +2361,12 @@
         self.sdfactor = 0
 
         self.symbol = {}
+        
+        self.methods = ["nearest",
+                        "bilinear",
+                        "bilinear_f",
+                        "cubic", 
+                        "cubic_f"]
 
         # notebook
         notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT)
@@ -2592,14 +2601,26 @@
         sizer = wx.BoxSizer(wx.VERTICAL)
 
         # transformation order
-        self.rb_grmethod = wx.RadioBox(parent=panel, id=wx.ID_ANY,
-                                       label=" %s " % _("Select rectification method for rasters"),
+        self.rb_grorder = wx.RadioBox(parent=panel, id=wx.ID_ANY,
+                                       label=" %s " % _("Select rectification order"),
                                        choices=[_('1st order'), _('2nd order'), _('3rd order')],
                                        majorDimension=wx.RA_SPECIFY_COLS)
-        sizer.Add(item=self.rb_grmethod, proportion=0,
+        sizer.Add(item=self.rb_grorder, proportion=0,
                        flag=wx.EXPAND | wx.ALL, border=5)
-        self.rb_grmethod.SetSelection(self.parent.gr_order - 1)
+        self.rb_grorder.SetSelection(self.parent.gr_order - 1)
 
+        # interpolation method
+        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
+        gridSizer.AddGrowableCol(1)
+        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY, label=_('Select interpolation method:')),
+                       pos=(0,0), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
+        self.grmethod = wx.Choice(parent=panel, id=wx.ID_ANY,
+                                  choices = self.methods)
+        gridSizer.Add(item=self.grmethod, pos=(0,1),
+                       flag=wx.ALIGN_RIGHT, border=5)
+        self.grmethod.SetStringSelection(self.parent.gr_method)
+        sizer.Add(item=gridSizer, flag=wx.EXPAND | wx.ALL, border=5)
+
         # clip to region
         self.check = wx.CheckBox(parent=panel, id=wx.ID_ANY,
                                 label=_("clip to computational region in target location"))
@@ -2617,7 +2638,8 @@
 
         # bindings
         self.ext_txt.Bind(wx.EVT_TEXT, self.OnExtension)
-        self.Bind(wx.EVT_RADIOBOX, self.parent.OnGROrder, self.rb_grmethod)
+        self.Bind(wx.EVT_RADIOBOX, self.parent.OnGROrder, self.rb_grorder)
+        self.Bind(wx.EVT_CHOICE, self.OnMethod, self.grmethod)
         self.Bind(wx.EVT_CHECKBOX, self.OnClipRegion, self.check)
 
         panel.SetSizer(sizer)
@@ -2668,6 +2690,9 @@
         if not tmp_map == tgt_map:
             self.new_tgt_map = tmp_map
 
+    def OnMethod(self, event):
+        self.parent.gr_method = self.methods[event.GetSelection()]
+
     def OnClipRegion(self, event):
         self.parent.clip_to_region = event.IsChecked()
         



More information about the grass-commit mailing list