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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 19 03:35:30 EDT 2009


Author: cmbarton
Date: 2009-10-19 03:35:28 -0400 (Mon, 19 Oct 2009)
New Revision: 39576

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py
Log:
Fixed missing datum problem

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py	2009-10-19 06:46:07 UTC (rev 39575)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/location_wizard.py	2009-10-19 07:35:28 UTC (rev 39576)
@@ -43,6 +43,7 @@
 import wx.lib.mixins.listctrl as listmix
 import wx.wizard as wiz
 import wx.lib.scrolledpanel as scrolled
+import time
 
 import gcmd
 import globalvar
@@ -851,7 +852,7 @@
         self.parent = parent
         self.datum = ''
         self.datumdesc = ''
-        self.ellipsoid = ''
+        self.ellipse = ''
         self.datumparams = ''
         self.proj4params = ''
 
@@ -910,17 +911,18 @@
 
     def OnPageChanging(self, event):
         self.proj4params = ''
+        proj = self.parent.projpage.p4proj
+                
         if event.GetDirection():
             if self.datum not in self.parent.datums:
                 event.Veto()
             else:
                 # check for datum tranforms            
-                proj4string = self.parent.CreateProj4String() + ' +datum=%s' % self.datum
+#                proj4string = self.parent.CreateProj4String() + ' +datum=%s' % self.datum
                 ret = gcmd.RunCommand('g.proj',
                                       read = True,
-                                      proj4 = proj4string, 
+                                      proj4 = '%s +datum=%s' % (proj, self.datum), 
                                       datumtrans = '-1')
-                
                 if ret != '':
                     dtrans = ''
                     # open a dialog to select datum transform number
@@ -939,8 +941,9 @@
                     
                     self.parent.datumtrans = dtrans
                 
-        self.GetNext().SetPrev(self)
-        self.parent.ellipsepage.ellipseparams = self.parent.ellipsoids[self.ellipsoid][1]
+            self.GetNext().SetPrev(self)
+            self.parent.ellipsepage.ellipse = self.ellipse
+            self.parent.ellipsepage.ellipseparams = self.parent.ellipsoids[self.ellipse][1]
 
     def OnEnterPage(self,event):
         self.parent.datumtrans = 0
@@ -960,11 +963,22 @@
         if len(self.datum) == 0 or self.datum not in self.parent.datums:
             nextButton.Enable(False)
         else:
-            self.ellipsoid = self.parent.datums[self.datum][0]
+            self.ellipse = self.parent.datums[self.datum][0]
             self.datumdesc = self.parent.datums[self.datum][1]
             self.datumparams = self.parent.datums[self.datum][2]
-            for p in self.datumparams:
-                if p in ['dx=0.0','dy=0.0','dz=0.0']: self.datumparams.remove(p)
+            try:
+                self.datumparams.remove('dx=0.0')
+            except:
+                pass
+            try:
+                self.datumparams.remove('dy=0.0')
+            except:
+                pass
+            try:
+                self.datumparams.remove('dz=0.0')
+            except:
+                pass
+            
             nextButton.Enable(True)
             
         self.Update()    
@@ -2034,7 +2048,7 @@
                 
         datum = self.datumpage.datum
         if self.datumpage.datumdesc:
-            datumdesc = self.datumpage.datumdesc +' - ' + self.datumpage.ellipsoid
+            datumdesc = self.datumpage.datumdesc +' - ' + self.datumpage.ellipse
         else:
             datumdesc = ''
         datumparams = self.datumpage.datumparams        
@@ -2048,13 +2062,16 @@
         proj4string = '%s %s' % (proj, proj4params)
                             
         # set ellipsoid parameters
+        if ellipse != '': proj4string = '%s +ellps=%s' % (proj4string, ellipse)
         for item in ellipseparams:
             if item[:4] == 'f=1/':
-                item = '+rf='+item[4:]
+                item = ' +rf='+item[4:]
             else:
-                item = '+'+item
+                item = ' +'+item
             proj4string = '%s %s' % (proj4string, item)
+            
         # set datum and transform parameters if relevant
+        if datum != '': proj4string = '%s +datum=%s' % (proj4string, datum)
         if datumparams:
             for item in datumparams:
                 proj4string = '%s +%s' % (proj4string,item)



More information about the grass-commit mailing list