[GRASS-SVN] r57240 - in grass/trunk/gui/wxpython: core iclass lmgr mapdisp
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 21 12:01:24 PDT 2013
Author: wenzeslaus
Date: 2013-07-21 12:01:24 -0700 (Sun, 21 Jul 2013)
New Revision: 57240
Modified:
grass/trunk/gui/wxpython/core/render.py
grass/trunk/gui/wxpython/iclass/frame.py
grass/trunk/gui/wxpython/lmgr/layertree.py
grass/trunk/gui/wxpython/mapdisp/main.py
grass/trunk/gui/wxpython/mapdisp/mapwindow.py
Log:
wxGUI/mapwindow: removing call to layer tree by direct calls from tree to map object
Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py 2013-07-21 16:03:20 UTC (rev 57239)
+++ grass/trunk/gui/wxpython/core/render.py 2013-07-21 19:01:24 UTC (rev 57240)
@@ -1098,20 +1098,17 @@
return None
- def ReorderLayers(self, layerList):
- """!Reorder list to match layer tree
-
- @param layerList list of layers
- """
- self.layers = layerList
-
+ def SetLayers(self, layers):
+ self.layers = layers
+
+ # only for debug
+ # might be removed including message, it seems more than clear
layerNameList = ""
for layer in self.layers:
if layer.GetName():
layerNameList += layer.GetName() + ','
- Debug.msg (4, "Map.ReoderLayers(): layers=%s" % \
- (layerNameList))
-
+ Debug.msg(5, "Map.SetLayers(): layers=%s" % (layerNameList))
+
def ChangeLayer(self, layer, render = False, **kargs):
"""!Change map layer properties
Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py 2013-07-21 16:03:20 UTC (rev 57239)
+++ grass/trunk/gui/wxpython/iclass/frame.py 2013-07-21 19:01:24 UTC (rev 57240)
@@ -1252,7 +1252,7 @@
choice.SetSelection(0)
#layers.reverse()
- self.map.ReorderLayers(layers)
+ self.map.SetLayers(layers)
self.frame.Render(self.mapWindow)
def SetOpacity(self, name):
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2013-07-21 16:03:20 UTC (rev 57239)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2013-07-21 19:01:24 UTC (rev 57240)
@@ -1131,7 +1131,7 @@
# redraw map if auto-rendering is enabled
self.rerender = True
- self.reorder = True
+ self.Map.SetLayers(self.GetVisibleLayers())
if self.mapdisplay.GetToolbar('vdigit'):
self.mapdisplay.toolbars['vdigit'].UpdateListOfLayers (updateTool = True)
@@ -1215,7 +1215,7 @@
# redraw map if auto-rendering is enabled
self.rerender = True
- self.reorder = True
+ self.Map.SetLayers(self.GetVisibleLayers())
def OnCmdChanged(self, event):
"""!Change command string"""
@@ -1356,7 +1356,7 @@
# redraw map if auto-rendering is enabled
self.rerender = True
- self.reorder = True
+ self.Map.SetLayers(self.GetVisibleLayers())
# select new item
self.SelectItem(newItem)
@@ -1525,40 +1525,33 @@
active = True))
if nlayers < 2:
mapWin.ResetView()
-
- def ReorderLayers(self):
- """!Add commands from data associated with any valid layers
- (checked or not) to layer list in order to match layers in
- layer tree."""
+ def GetVisibleLayers(self):
# make a list of visible layers
- treelayers = []
-
+ layers = []
+
vislayer = self.GetFirstVisibleItem()
-
+
if not vislayer or self.GetPyData(vislayer) is None:
- return
-
+ return layers
+
itemList = ""
-
for item in range(self.GetCount()):
itemList += self.GetItemText(vislayer) + ','
- if self.GetLayerInfo(vislayer, key = 'type') != 'group':
- treelayers.append(self.GetLayerInfo(vislayer, key = 'maplayer'))
+ if self.GetLayerInfo(vislayer, key='type') != 'group':
+ layers.append(self.GetLayerInfo(vislayer, key='maplayer'))
if not self.GetNextVisible(vislayer):
break
else:
vislayer = self.GetNextVisible(vislayer)
-
- Debug.msg (4, "LayerTree.ReorderLayers(): items=%s" % \
- (itemList))
-
- # reorder map layers
- treelayers.reverse()
- self.Map.ReorderLayers(treelayers)
- self.reorder = False
-
+
+ Debug.msg(5, "LayerTree.GetVisibleLayers(): items=%s" %
+ (reversed(itemList)))
+
+ layers.reverse()
+ return layers
+
def ChangeLayer(self, item):
"""!Change layer"""
type = self.GetLayerInfo(item, key = 'type')
@@ -1594,10 +1587,11 @@
# if digitization tool enabled -> update list of available vector map layers
if self.mapdisplay.GetToolbar('vdigit'):
self.mapdisplay.GetToolbar('vdigit').UpdateListOfLayers(updateTool = True)
-
+
+ self.Map.SetLayers(self.GetVisibleLayers())
# redraw map if auto-rendering is enabled
- self.rerender = self.reorder = True
-
+ self.rerender = True
+
def OnCloseWindow(self, event):
pass
# self.Map.Clean()
Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py 2013-07-21 16:03:20 UTC (rev 57239)
+++ grass/trunk/gui/wxpython/mapdisp/main.py 2013-07-21 19:01:24 UTC (rev 57240)
@@ -170,7 +170,7 @@
else:
reorderedLayers[layersOrder[i]] = layer
- self.ReorderLayers(reorderedLayers)
+ self.SetLayers(reorderedLayers)
except IOError, e:
grass.warning(_("Unable to read cmdfile '%(cmd)s'. Details: %(det)s") % \
Modified: grass/trunk/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2013-07-21 16:03:20 UTC (rev 57239)
+++ grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2013-07-21 19:01:24 UTC (rev 57240)
@@ -628,10 +628,7 @@
#
# render background image if needed
#
- # update layer dictionary if there has been a change in layers
- if self.tree and self.tree.reorder:
- self.tree.ReorderLayers()
-
+
# reset flag for auto-rendering
if self.tree:
self.tree.rerender = False
@@ -1577,8 +1574,8 @@
@param render True to re-render display
"""
if not layers:
- layers = self.tree.GetSelectedLayer(multi = True, checkedOnly = False)
- layers = [self.tree.GetLayerInfo(layer, key = 'maplayer') for layer in layers]
+ layers = self._giface.GetLayerList().GetSelectedLayers(checkedOnly=False)
+ layers = [layer.maplayer for layer in layers]
if not layers:
return
More information about the grass-commit
mailing list