[GRASS-SVN] r61384 - grass/branches/releasebranch_7_0/gui/wxpython/mapwin

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 23 18:00:50 PDT 2014


Author: annakrat
Date: 2014-07-23 18:00:50 -0700 (Wed, 23 Jul 2014)
New Revision: 61384

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/mapwin/buffered.py
Log:
wxGUI/mapswipe: fix drawing cross in mirror mode reported in #2377 (merge from trunk, r61383)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/mapwin/buffered.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/mapwin/buffered.py	2014-07-24 00:58:21 UTC (rev 61383)
+++ grass/branches/releasebranch_7_0/gui/wxpython/mapwin/buffered.py	2014-07-24 01:00:50 UTC (rev 61384)
@@ -324,33 +324,44 @@
                 pdc.SetPen(pen)
                 pdc.DrawLinePoint(wx.Point(coords[0], coords[1]),wx.Point(coords[2], coords[3]))
                 pdc.SetIdBounds(drawid, wx.Rect(coords[0], coords[1], coords[2], coords[3]))
-        
-        elif pdctype == 'polyline': # draw a polyline on top of the map
+
+        # polyline is a series of connected lines defined as sequence of points
+        # lines are individual, not connected lines which must be drawn as 1 object (e.g. cross)
+        elif pdctype in ('polyline', 'lines'):
             if pen:
                 pdc.SetBrush(wx.Brush(wx.CYAN, wx.TRANSPARENT))
                 pdc.SetPen(pen)
                 if (len(coords) < 2):
                     return
-                i = 1
-                while i < len(coords):
-                    pdc.DrawLinePoint(wx.Point(coords[i-1][0], coords[i-1][1]),
-                                      wx.Point(coords[i][0], coords[i][1]))
-                    i += 1
-                
-                # get bounding rectangle for polyline
+                if pdctype == 'polyline':
+                    i = 1
+                    while i < len(coords):
+                        pdc.DrawLinePoint(wx.Point(coords[i - 1][0], coords[i - 1][1]),
+                                          wx.Point(coords[i][0], coords[i][1]))
+                        i += 1
+                else:
+                    for line in coords:
+                        pdc.DrawLine(line[0], line[1], line[2], line[3])
+
+                # get bounding rectangle for polyline/lines
                 xlist = []
                 ylist = []
                 if len(coords) > 0:
-                    for point in coords:
-                        x,y = point
-                        xlist.append(x)
-                        ylist.append(y)
+                    if pdctype == 'polyline':
+                        for point in coords:
+                            x, y = point
+                            xlist.append(x)
+                            ylist.append(y)
+                    else:
+                        for line in coords:
+                            x1, y1, x2, y2 = line
+                            xlist.extend([x1, x2])
+                            ylist.extend([y1, y2])
                     x1 = min(xlist)
                     x2 = max(xlist)
                     y1 = min(ylist)
                     y2 = max(ylist)
-                    pdc.SetIdBounds(drawid, wx.Rect(x1,y1,x2,y2))
-                    # self.ovlcoords[drawid] = [x1,y1,x2,y2]
+                    pdc.SetIdBounds(drawid, wx.Rect(x1, y1, x2, y2))
 
         elif pdctype == 'polygon':
             if pen:



More information about the grass-commit mailing list