[GRASS-SVN] r56791 - grass/trunk/gui/wxpython/location_wizard

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 18 23:34:36 PDT 2013


Author: hamish
Date: 2013-06-18 23:34:35 -0700 (Tue, 18 Jun 2013)
New Revision: 56791

Modified:
   grass/trunk/gui/wxpython/location_wizard/wizard.py
Log:
present estimated +proj4 terms for Georef'd files and WKT creation
options (merge from devbr6), sync some whitespace with devbr6 for
easier patches.


Modified: grass/trunk/gui/wxpython/location_wizard/wizard.py
===================================================================
--- grass/trunk/gui/wxpython/location_wizard/wizard.py	2013-06-19 05:58:22 UTC (rev 56790)
+++ grass/trunk/gui/wxpython/location_wizard/wizard.py	2013-06-19 06:34:35 UTC (rev 56791)
@@ -225,7 +225,7 @@
                                              "georeferenced data file"))
         self.radio4 = wx.RadioButton(parent = self, id = wx.ID_ANY,
                                      label = _("Read projection and datum terms from a "
-                                             "WKT or PRJ file"))
+                                             "Well Known Text (WKT) .prj file"))
         self.radio5 = wx.RadioButton(parent = self, id = wx.ID_ANY,
                                      label = _("Specify projection and datum terms using custom "
                                              "PROJ.4 parameters"))
@@ -994,7 +994,7 @@
         TitledPage.__init__(self, wizard, _("Specify ellipsoid"))
 
         self.parent = parent
-        
+
         self.ellipse = ''
         self.ellipsedesc = ''
         self.ellipseparams = ''
@@ -1231,12 +1231,12 @@
     for setting coordinate system parameters"""
 
     def __init__(self, wizard, parent):
-        TitledPage.__init__(self, wizard, _("Select WKT or PRJ file"))
+        TitledPage.__init__(self, wizard, _("Select Well Known Text (WKT) .prj file"))
 
         self.wktfile = ''
 
         # create controls
-        self.lfile= self.MakeLabel(_("WKT or PRJ file:"))
+        self.lfile= self.MakeLabel(_("WKT .prj file:"))
         self.tfile = self.MakeTextCtrl(size = (300,-1))
         self.bbrowse = self.MakeButton(_("Browse"))
 
@@ -1288,7 +1288,7 @@
     def OnBrowse(self, event):
         """!Choose file"""
         dlg = wx.FileDialog(parent = self,
-                            message = _("Select WKT or PRJ file"),
+                            message = _("Select Well Known Text (WKT) .prj file"),
                             defaultDir = os.getcwd(),
                             wildcard = "PRJ files (*.prj)|*.prj|Files (*.*)|*.*",
                             style = wx.OPEN)
@@ -1567,12 +1567,12 @@
                               style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
                 event.Veto()
                 return
-            
+
             if out:
                 dtrans = ''
                 # open a dialog to select datum transform number
                 dlg = SelectTransformDialog(self.parent.parent, transforms = out)
-                
+
                 if dlg.ShowModal() == wx.ID_OK:
                     dtrans = dlg.GetTransform()
                     if dtrans == '':
@@ -1706,28 +1706,38 @@
         global coordsys
 
         #print coordsys,proj4string
-        if coordsys in ('proj', 'epsg'):
+        if coordsys in ('proj', 'epsg', 'wkt', 'file'):
+            extra_opts = {}
+            extra_opts['location'] = 'location'
+            extra_opts['getErrorMsg'] = True
+            extra_opts['read'] = True
+
             if coordsys == 'proj':
                 addl_opts = {}
                 if len(datum) > 0:
-                    addl_opts['datum'] = '%s' % datum
-                    addl_opts['datum_trans'] = dtrans
+                    extra_opts['datum'] = '%s' % datum
+                    extra_opts['datum_trans'] = dtrans
 
                 ret, projlabel, err = RunCommand('g.proj',
                                                  flags = 'jf',
                                                  proj4 = proj4string,
-                                                 location = location,
-                                                 getErrorMsg = True,
-                                                 read = True,
-                                                 **addl_opts)
+                                                 **extra_opts)
             elif coordsys == 'epsg':
                 ret, projlabel, err = RunCommand('g.proj',
                                                  flags = 'jft',
                                                  epsg = epsgcode,
                                                  datum_trans = dtrans,
-                                                 location = location,
-                                                 getErrorMsg = True,
-                                                 read = True)
+                                                 **extra_opts)
+            elif coordsys == 'file':
+                ret, projlabel, err = RunCommand('g.proj',
+                                                 flags = 'jft',
+                                                 georef = self.parent.filepage.georeffile,
+                                                 **extra_opts)
+            elif coordsys == 'wkt':
+                ret, projlabel, err = RunCommand('g.proj',
+                                                 flags = 'jft',
+                                                 wkt = self.parent.wktpage.wktfile,
+                                                 **extra_opts)
 
             finishButton = wx.FindWindowById(wx.ID_FORWARD)
             if ret == 0:
@@ -1750,22 +1760,27 @@
         
         label = ''
         if coordsys == 'epsg':
-            label = 'EPSG code %s (%s)' % (self.parent.epsgpage.epsgcode, self.parent.epsgpage.epsgdesc)
+            label = 'EPSG code %s (%s)' % (self.parent.epsgpage.epsgcode,
+                                           self.parent.epsgpage.epsgdesc)
         elif coordsys == 'file':
             label = 'matches file %s' % self.parent.filepage.georeffile
-            self.lproj4string.SetLabel("")
+
         elif coordsys == 'wkt':
             label = 'matches file %s' % self.parent.wktpage.wktfile
-            self.lproj4string.SetLabel("")
+
         elif coordsys == 'proj':
             label = ('%s, %s %s' % (projdesc, datumdesc, ellipsedesc))
+
         elif coordsys == 'xy':
             label = ('XY coordinate system (not projected).')
             self.lproj4string.SetLabel("")
+
         elif coordsys == 'custom':
             label = _("custom")
-            combo_str = self.parent.custompage.customstring + self.parent.custompage.custom_dtrans_string
+            combo_str = self.parent.custompage.customstring + \
+                        self.parent.custompage.custom_dtrans_string
             self.lproj4string.SetLabel(('%s' % combo_str.replace(' +', os.linesep + '+')))
+
         self.lprojection.SetLabel(label)
         
     def OnFinish(self, event):
@@ -1814,7 +1829,8 @@
         #
         # define wizard pages
         #
-        self.wizard = WizardWithHelpButton(parent, id = wx.ID_ANY, title = _("Define new GRASS Location"),
+        self.wizard = WizardWithHelpButton(parent, id = wx.ID_ANY,
+                                           title = _("Define new GRASS Location"),
                                            bitmap = wizbmp)
         self.wizard.Bind(wiz.EVT_WIZARD_HELP, self.OnHelp)
 
@@ -2145,7 +2161,7 @@
         # creating PROJ.4 string
         #
         proj4string = '%s %s' % (proj, proj4params)
-        
+
         # set ellipsoid parameters
         if ellipse != '':
             proj4string = '%s +ellps=%s' % (proj4string, ellipse)
@@ -2162,7 +2178,7 @@
                 proj4string = '%s +%s' % (proj4string,item)
 
         proj4string = '%s +no_defs' % proj4string
-        
+
         return proj4string
 
     def OnHelp(self, event):



More information about the grass-commit mailing list