[GRASS-SVN] r65301 - in grass/trunk/gui/wxpython: core mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 21 10:42:05 PDT 2015


Author: martinl
Date: 2015-05-21 10:42:05 -0700 (Thu, 21 May 2015)
New Revision: 65301

Modified:
   grass/trunk/gui/wxpython/core/render.py
   grass/trunk/gui/wxpython/mapdisp/main.py
Log:
wxGUI: avoid double rendering for new map layers (standalone wx monitors)


Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py	2015-05-21 17:39:23 UTC (rev 65300)
+++ grass/trunk/gui/wxpython/core/render.py	2015-05-21 17:42:05 UTC (rev 65301)
@@ -53,7 +53,7 @@
     - For overlays use Overlay class.
     """
     def __init__(self, ltype, cmd, Map, name=None,
-                 active=True, hidden=False, opacity=1.0, mapfile=None):
+                 active=True, hidden=False, opacity=1.0, mapfile=None, render=True):
         """Create new instance
 
         .. todo::
@@ -103,7 +103,7 @@
         self.hidden  = hidden
         self.opacity = opacity
 
-        self.forceRender = True
+        self.forceRender = render
 
         self.render_env = { "GRASS_RENDER_FILE": self.mapfile }
         

Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py	2015-05-21 17:39:23 UTC (rev 65300)
+++ grass/trunk/gui/wxpython/mapdisp/main.py	2015-05-21 17:42:05 UTC (rev 65301)
@@ -137,7 +137,12 @@
 
             # next number in rendering order
             next_layer = 0
+            mapFile = None
             for line in lines:
+                if line.startswith('#') and 'GRASS_RENDER_FILE' in line:
+                    mapFile = line.split('=', 1)[1].strip()
+                    continue
+            
                 cmd = utils.split(line.strip())
                 
                 ltype = None
@@ -159,7 +164,7 @@
                     args['ltype'] = ltype
                 
                 mapLayer = classLayer(name = name, cmd = cmd, Map = None,
-                                      hidden = True, **args)
+                                      hidden = True, render = False, mapfile = mapFile, **args)
                 mapLayer.GetRenderMgr().updateProgress.connect(self.GetRenderMgr().ReportProgress)
 
                 exists = False
@@ -183,7 +188,7 @@
                     continue
                 
                 newLayer = self._addLayer(mapLayer)
-                
+                                
                 existingLayers.append(newLayer)
                 self.ownedLayers.append(newLayer)
                 
@@ -218,7 +223,7 @@
         Debug.msg(1, "Map.GetLayersFromCmdFile(): cmdfile=%s, nlayers=%d" % \
                   (self.cmdfile, nlayers))
         
-        self._giface.updateMap.emit()
+        self._giface.updateMap.emit(render=False)
         
     def Render(self, *args, **kwargs):
         """Render layer to image.
@@ -420,8 +425,8 @@
         # FIXME: hack to solve dependency
         self._giface._mapframe = self.mapFrm
         
-        self.mapFrm.GetMapWindow().SetAlwaysRenderEnabled(True)
-        
+        self.mapFrm.GetMapWindow().SetAlwaysRenderEnabled(False)
+
         self.Map.saveToFile.connect(lambda cmd: self.mapFrm.DOutFile(cmd))
         self.Map.dToRast.connect(lambda cmd: self.mapFrm.DToRast(cmd))
         self.Map.query.connect(lambda ltype, maps: \



More information about the grass-commit mailing list