[GRASS-SVN] r32840 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 17 10:59:19 EDT 2008


Author: martinl
Date: 2008-08-17 10:59:19 -0400 (Sun, 17 Aug 2008)
New Revision: 32840

Modified:
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: fix bug in layering and rendering, update r32831
code removed from r32465 recovered 
(merge from devbr6, r32839)


Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-08-17 14:55:38 UTC (rev 32839)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-08-17 14:59:19 UTC (rev 32840)
@@ -644,8 +644,6 @@
         # render background image if needed
         #
         if render:
-            # walk layer tree and update current layers
-            self.tree.ReorderLayers()
             # update display size
             self.Map.ChangeMapSize(self.GetClientSize())
             windres = False

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-17 14:55:38 UTC (rev 32839)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-17 14:59:19 UTC (rev 32840)
@@ -496,7 +496,7 @@
         """Rename layer"""
         self.EditLabel(self.layer_selected)
 
-    def AddLayer(self, ltype, lname=None, lchecked=None, \
+    def AddLayer(self, ltype, lname=None, lchecked=None,
                  lopacity=None, lcmd=None, lgroup=None, lnviz=None):
         """Add new item to the layer tree, create corresponding MapLayer instance.
         Launch property dialog if needed (raster, vector, etc.)
@@ -658,7 +658,23 @@
                                     'propwin' : None}, 
                                    None))
 
-            maplayer = self.Map.AddLayer(type=ltype, command=self.GetPyData(layer)[0]['cmd'], name=name,
+            # find previous map layer instance 
+            prevItem = self.GetFirstChild(self.root)[0]
+            prevMapLayer = None 
+            pos = -1
+            while prevItem and prevItem.IsOk() and prevItem != layer: 
+                if self.GetPyData(prevItem)[0]['maplayer']: 
+                    prevMapLayer = self.GetPyData(prevItem)[0]['maplayer'] 
+                
+                prevItem = self.GetNextSibling(prevItem) 
+                
+                if prevMapLayer: 
+                    pos = self.Map.GetLayerIndex(prevMapLayer)
+                else: 
+                    pos = -1
+            
+            maplayer = self.Map.AddLayer(pos=pos,
+                                         type=ltype, command=self.GetPyData(layer)[0]['cmd'], name=name,
                                          l_active=checked, l_hidden=False,
                                          l_opacity=opacity, l_render=render)
             self.GetPyData(layer)[0]['maplayer'] = maplayer



More information about the grass-commit mailing list