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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 10 10:04:31 EST 2009


Author: martinl
Date: 2009-01-10 10:04:31 -0500 (Sat, 10 Jan 2009)
New Revision: 35315

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
Log:
wxGUI/nviz: error pressing "All" button (trac #300)
	    (merge from trunk, r35314)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-10 15:00:16 UTC (rev 35314)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-10 15:04:31 UTC (rev 35315)
@@ -527,7 +527,8 @@
             self.Map.DeleteLayer(layer)
 
         # delete tmp lines
-        if self.MapWindow.mouse["use"] in ["measure", "profile"]:
+        if self.MapWindow.mouse["use"] in ("measure",
+                                           "profile"):
             self.MapWindow.polycoords = []
             self.MapWindow.ClearLines()
         

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-01-10 15:00:16 UTC (rev 35314)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-01-10 15:04:31 UTC (rev 35315)
@@ -44,6 +44,17 @@
                  style=wx.NO_FULL_REPAINT_ON_RESIZE,
                  Map=None, tree=None, gismgr=None):
         self.parent = parent # MapFrame
+ 
+        #
+        # mouse attributes -- position on the screen, begin and end of
+        # dragging, and type of drawing
+        #
+        self.mouse = {
+            'begin': [0, 0], # screen coordinates
+            'end'  : [0, 0],
+            'use'  : "pointer",
+            'box'  : "point"
+            }
         
     def EraseMap(self):
         """
@@ -176,20 +187,6 @@
         self.zoomhistory = [] # list of past zoom extents
         self.currzoom = 0 # current set of extents in zoom history being used
 
-        #
-        # mouse attributes like currently pressed buttons, position on
-        # the screen, begin and end of dragging, and type of drawing
-        #
-        self.mouse = {
-            'l'    : False,
-            'r'    : False,
-            'm'    : False,
-            'begin': [0, 0], # screen coordinates
-            'end'  : [0, 0],
-            'use'  : "pointer",
-            'box'  : "point"
-            }
-
         self.zoomtype = 1   # 1 zoom in, 0 no zoom, -1 zoom out
         self.hitradius = 10 # distance for selecting map decorations
         self.dialogOffset = 5 # offset for dialog (e.g. DisplayAttributesDialog)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py	2009-01-10 15:00:16 UTC (rev 35314)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py	2009-01-10 15:04:31 UTC (rev 35315)
@@ -1221,6 +1221,18 @@
         
         return layerName
     
+    def GetLayerData(self, type, name):
+        """Return layer item data
+
+        @return {} if no layer item found
+        """
+        for item in self.layers:
+            mapLayer = self.tree.GetPyData(item)[0]['maplayer'].GetName()
+            if mapLayer == name:
+                return self.tree.GetPyData(item)[0]['nviz']
+        
+        return {}
+    
     def GetLayerId(self, type, name):
         """Get layer object id or -1"""
         if len(name) < 1:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2009-01-10 15:00:16 UTC (rev 35314)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2009-01-10 15:04:31 UTC (rev 35315)
@@ -418,9 +418,8 @@
                       flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                       border=5)
 
-        all = wx.Button(panel, id=wx.ID_ANY, label=_("All"))
-        all.SetToolTipString(_("Use for all loaded surfaces"))
-        # self.win['reset'] = reset.GetId()
+        all = wx.Button(panel, id=wx.ID_ANY, label=_("Set to all"))
+        all.SetToolTipString(_("Use draw settings for all loaded surfaces"))
         all.Bind(wx.EVT_BUTTON, self.OnSurfaceModeAll)
         gridSizer.Add(item=all, flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       pos=(2, 4))
@@ -1720,10 +1719,30 @@
 
     def OnSurfaceModeAll(self, event):
         """Set draw mode (including wire color) for all loaded surfaces"""
-        self.SetSurfaceMode(all=True)
-        self.SetSurfaceResolution(all=True)
-        ### color = self.FindWindowById(self.win['surface']['draw']['wire-color']).GetColour()
-
+        value, desc = self.SetSurfaceMode()
+        coarse = self.FindWindowById(self.win['surface']['draw']['res-coarse']).GetValue()
+        fine = self.FindWindowById(self.win['surface']['draw']['res-fine']).GetValue()
+        color = self.FindWindowById(self.win['surface']['draw']['wire-color']).GetColour()
+        cvalue = self._getColorString(color)
+        
+        for name in self.mapWindow.GetLayerNames(type='raster'):
+            data = self.mapWindow.GetLayerData(type='raster', name=name)
+            if not data:
+                continue # shouldy no happen
+            
+            data['surface']['draw']['mode'] = { 'value' : value,
+                                                'desc' : desc,
+                                                'update' : None, }
+            data['surface']['draw']['resolution'] = { 'coarse' : coarse,
+                                                      'fine' : fine,
+                                                      'update' : None, }
+            data['surface']['draw']['wire-color'] = { 'value' : cvalue,
+                                                      'update' : None }
+            
+            # update properties
+            event = wxUpdateProperties(data=data)
+            wx.PostEvent(self.mapWindow, event)
+            
         if apply and self.parent.autoRender.IsChecked():
             self.mapWindow.Refresh(False)
 



More information about the grass-commit mailing list