[GRASS-SVN] r50722 - grass/branches/develbranch_6/gui/wxpython/mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 8 04:11:04 EST 2012


Author: annakrat
Date: 2012-02-08 01:11:04 -0800 (Wed, 08 Feb 2012)
New Revision: 50722

Modified:
   grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py
Log:
wxGUI: redraw decorations #1567 (merge from trunk, r50721)

Modified: grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py	2012-02-08 09:04:04 UTC (rev 50721)
+++ grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py	2012-02-08 09:11:04 UTC (rev 50722)
@@ -443,7 +443,34 @@
         ibuffer = wx.EmptyBitmap(max(1, width), max(1, height))
         self.Map.Render(force = True, windres = True)
         img = self.GetImage()
+        self.pdc.RemoveAll()
         self.Draw(self.pdc, img, drawid = 99)
+        
+        # compute size ratio to move overlay accordingly
+        cSize = self.GetClientSizeTuple()
+        ratio = float(width) / cSize[0], float(height) / cSize[1]
+        
+        # redraw lagend, scalebar
+        for img in self.GetOverlay():
+            # draw any active and defined overlays
+            if self.imagedict[img]['layer'].IsActive():
+                id = self.imagedict[img]['id']
+                coords = int(ratio[0] * self.overlays[id]['coords'][0]),\
+                         int(ratio[1] * self.overlays[id]['coords'][1])
+                self.Draw(self.pdc, img = img, drawid = id,
+                          pdctype = self.overlays[id]['pdcType'], coords = coords)
+                          
+        # redraw text labels
+        for id in self.textdict.keys():
+            textinfo = self.textdict[id]
+            oldCoords = textinfo['coords']
+            textinfo['coords'] = ratio[0] * textinfo['coords'][0],\
+                                 ratio[1] * textinfo['coords'][1]
+            self.Draw(self.pdc, img = self.textdict[id], drawid = id,
+                      pdctype = 'text')
+            # set back old coordinates
+            textinfo['coords'] = oldCoords
+            
         dc = wx.BufferedPaintDC(self, ibuffer)
         dc.Clear()
         self.PrepareDC(dc)



More information about the grass-commit mailing list