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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 8 06:51:37 EDT 2008


Author: martinl
Date: 2008-04-08 06:51:37 -0400 (Tue, 08 Apr 2008)
New Revision: 30904

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/render.py
Log:
wxGUI (render): not force to re-render all map layer on querying


Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-04-08 09:55:42 UTC (rev 30903)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-04-08 10:51:37 UTC (rev 30904)
@@ -967,11 +967,9 @@
     def OnDataDrawSelected(self, event):
         """Reload table description"""
         if self.map and self.mapdisplay:
-            # list.lastTurnSelectedCats[:] != list.selectedCats[:]:
-
             # add map layer with higlighted vector features
             self.AddQueryMapLayer()
-            self.mapdisplay.MapWindow.UpdateMap(render=True)
+            self.mapdisplay.MapWindow.UpdateMap(render=False, renderVector=False)
 
         event.Skip()
 
@@ -1634,13 +1632,13 @@
 
         Return True if map has been redrawn, False if no map is given
         """
-        if self.qlayer:
-            self.mapdisplay.Map.DeleteLayer(self.qlayer)
-
         list = self.FindWindowById(self.layerPage[self.layer]['data'])
         cats = list.GetSelectedItems() # FIXME: category can be hiden in list
 
-        self.qlayer = self.mapdisplay.AddTmpVectorMapLayer(self.vectmap, cats)
+        if self.qlayer:
+            self.qlayer.SetCmd(self.mapdisplay.AddTmpVectorMapLayer(self.vectmap, cats, addLayer=False))
+        else:
+            self.qlayer = self.mapdisplay.AddTmpVectorMapLayer(self.vectmap, cats)
                 
     def UpdateDialog(self, layer):
         """Updates dialog layout for given layer"""

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-04-08 09:55:42 UTC (rev 30903)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-04-08 10:51:37 UTC (rev 30904)
@@ -556,7 +556,7 @@
             render = True
 
         #
-        # initialize process bar
+        # initialize process bar (only on 'render')
         #
         if render is True or renderVector is True:
             self.parent.onRenderGauge.Show()
@@ -575,8 +575,11 @@
                 # use computation region resolution for rendering
                 windres = True
             self.mapfile = self.Map.Render(force=True, mapWindow=self.parent, windres=windres)
-            self.img = self.GetImage() # id=99
-
+        else:
+            self.mapfile = self.Map.Render(force=False, mapWindow=self.parent)
+            
+        self.img = self.GetImage() # id=99
+            
         #
         # clear pseudoDcs
         #
@@ -2989,19 +2992,20 @@
         if self.dialogs['attributes'].mapDBInfo and line:
             # highlight feature & re-draw map
             if qlayer:
-                qlayer.cmdlist = self.AddTmpVectorMapLayer(mapName, line,
-                                                           useId=True,
-                                                           addLayer=False)
+                qlayer.SetCmd(self.AddTmpVectorMapLayer(mapName, line,
+                                                        useId=True,
+                                                        addLayer=False))
             else:
                 self.AddTmpVectorMapLayer(mapName, line, useId=True)
-            self.MapWindow.UpdateMap(render=True)
+
+            self.MapWindow.UpdateMap(render=False, renderVector=False)
             # digitClass.driver.SetSelected([line])
             if not self.dialogs['attributes'].IsShown():
                 self.dialogs['attributes'].Show()
         else:
             if qlayer:
                 self.Map.DeleteLayer(qlayer)
-                self.MapWindow.UpdateMap(render=True)
+                self.MapWindow.UpdateMap(render=False, renderVector=False)
             if self.dialogs['attributes'].IsShown():
                 self.dialogs['attributes'].Hide()
 
@@ -3028,10 +3032,11 @@
         @param name name of map layer
         @param useId use feature id instead of category 
         """
+        # color settings from ATM
         color = UserSettings.Get(group='atm', key='highlight', subkey='color')
         colorStr = str(color[0]) + ":" + \
         str(color[1]) + ":" + \
-        str(color[2]) + ":"
+        str(color[2])
 
         cmd = ["d.vect",
                "map=%s" % name,

Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2008-04-08 09:55:42 UTC (rev 30903)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2008-04-08 10:51:37 UTC (rev 30904)
@@ -95,8 +95,8 @@
         if len(self.cmdlist) == 0:
             return None
 
-        Debug.msg (3, "Layer.Render(): type=%s" % \
-                       (self.type))
+        Debug.msg (3, "Layer.Render(): type=%s, name=%s" % \
+                       (self.type, self.name))
 
         #
         # to be sure, set temporary file with layer and mask
@@ -193,7 +193,12 @@
     def SetActive(self, enable=True):
         """Active or deactive layer"""
         self.active = enable
-            
+
+    def SetCmd(self, cmd):
+        """Set new command for layer"""
+        self.cmdlist = cmd
+        Debug.msg(3, "Layer.SetCmd(): cmd='%s'" % self.GetCmd(string=True))
+        
 class MapLayer(Layer):
     """Represents map layer in the map canvas"""
     def __init__(self, type, cmd, name=None,
@@ -710,19 +715,21 @@
 
         # render map layers
         for layer in self.layers + self.overlays:
-            # skip if not active
+            # skip dead or disabled map layers
             if layer == None or layer.active == False:
                 continue
             
             # render if there is no mapfile
-            if layer.mapfile == None:
+            if layer.mapfile == None or \
+                   (not os.path.isfile(layer.mapfile) or not os.path.getsize(layer.mapfile)):
                 layer.Render()
                     
-            # process bar
+            # update process bar
             if mapWindow is not None:
                 mapWindow.onRenderCounter += 1
 
             wx.Yield()
+            
             # redraw layer content
             if force:
                 if not layer.Render():



More information about the grass-commit mailing list