[GRASS-SVN] r42760 - grass-addons/gui/wxpython/wx.path

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 11 09:33:38 EDT 2010


Author: rashadkm
Date: 2010-07-11 13:33:38 +0000 (Sun, 11 Jul 2010)
New Revision: 42760

Modified:
   grass-addons/gui/wxpython/wx.path/wx.path.py
Log:
errors in display fixed

Modified: grass-addons/gui/wxpython/wx.path/wx.path.py
===================================================================
--- grass-addons/gui/wxpython/wx.path/wx.path.py	2010-07-11 05:06:27 UTC (rev 42759)
+++ grass-addons/gui/wxpython/wx.path/wx.path.py	2010-07-11 13:33:38 UTC (rev 42760)
@@ -256,7 +256,7 @@
         # Re-use dialogs
         #
 	self.mapname = 'roads@' + grass.gisenv()['MAPSET']
-	self.cmd= ['d.vect', str("map=" + self.mapname),'width=4']
+	self.cmd= ['d.vect', str("map=" + self.mapname),'width=1']
 	self.Map.AddLayer(type='vector', name=self.mapname, command=self.cmd)
 	self.MapWindow.UpdateMap(render=True)  
 
@@ -269,6 +269,7 @@
         self.decorationDialog = None # decoration/overlays
 
         #self.Maximize()
+	self.coords = []
 	self.points = []
 
 
@@ -277,12 +278,6 @@
 
     def OnButtonDClick(self,event): 
 
-	self.mapname = 'graph@' + grass.gisenv()['MAPSET']
-	self.Map.RemoveLayer(name=self.mapname)
-	self.MapWindow.UpdateMap(render=True)
-
-       # precision = int(UserSettings.Get(group = 'projection', key = 'format',
-          #                                   subkey = 'precision'))
         try:
             e, n = self.MapWindow.Pixel2Cell(event.GetPositionTuple())
 	    print e,n
@@ -290,50 +285,31 @@
             return
         
         self.counter = self.counter + 1
-        point =("%f|%f" %  ( e,  n))
-        self.points.append(point + '|point')
+        coord =("%f %f" %  ( e,  n))
+        self.coords.append(coord)
+
         if self.counter == 2:
-            f =open("tmp1",'w')
+	    self.points.append("1 ")
+       	    for p in self.coords:
+               self.points.append(p)
+            f =open("tmp",'w')
             for p in self.points:
-               f.write("%s\n" % p)
+               f.write("%s " % p)
             f.close()
 
-            f =open("tmp2",'w')
-            f.write("%d %d %d\n" %(1,1,2) )
-            f.close()
 
+            
+	    command=["v.net.path", 'input=roads', 'output=path','file=tmp','--overwrite']
+    	    gcmd.CommandThread(command).run()
 
-            command =["g.remove",'vect=path,vnet,startend']
-            gcmd.CommandThread(command,stdout=None,stderr=None).run()
-    
 
-#            command =["v.in.ascii",'input=tmp1','output=startend']
-            z =gcmd.RunCommand('v.in.ascii',input='tmp1',output='startend')
-
-  	    if z == 1:
-		print "error executing v.in.ascii"
-		return 1
-
-            #command=["v.net", "input=roads",'points=startend', 'output=vnet', 'op=connect', 'thresh=200']
-            y=gcmd.RunCommand('v.net', input='roads',points='startend', output='vnet', op='connect', thresh='200')
-	    if y == 1:
-		print "error executing v.net"
-		return 1
-
-
-            #command=["v.net.path", 'input=vnet', 'output=path','file=tmp2']
-            x= gcmd.RunCommand('v.net.path', input='vnet', output='path', file='tmp2')
-	    if x == 1:
-		print "error executing v.net.path"
-		return 1
-
-
             self.mapname = 'path@'+ grass.gisenv()['MAPSET']
             self.cmd= ['d.vect', str("map=" + self.mapname),'col=red','width=2']
             self.Map.AddLayer(type='vector', name=self.mapname, command=self.cmd)
             self.MapWindow.UpdateMap(render=True)
             self.counter =0
-            self.points=[]
+            self.coords=[]
+	    self.points=[]
 
 
 



More information about the grass-commit mailing list