--- a/graphics/GraphicCommons.py Tue Jun 18 09:38:20 2019 +0200
+++ b/graphics/GraphicCommons.py Tue Jun 18 13:58:45 2019 +0200
@@ -1967,7 +1967,21 @@
def SetPoints(self, points, merge_segments=True):
- self.Points = [wx.Point(x, y) for x, y in points]
+ # filter duplicates, add corner to diagonals + ex, ey = lx == x, ly == y + if (lx,ly) != (None,None) and not ex and not ey: + self.Points.append(wx.Point(lx, y)) + self.Points.append(wx.Point(x, y)) # Calculate the start and end directions
self.StartPoint = [None, vector(self.Points[0], self.Points[1])]
self.EndPoint = [None, vector(self.Points[-1], self.Points[-2])]
@@ -1988,12 +2002,6 @@
segment = vector(self.Points[i], self.Points[i + 1])
- if is_null_vector(segment):
- # next point is the same, no need to rollback
# merge segment if requested
if merge_segments and 0 < i and \
self.Segments[-1] == segment:
@@ -2003,12 +2011,6 @@
- # add point to make a corner in case of diagonal segment
- if segment not in [EAST, NORTH, WEST, SOUTH]:
- self.Points.insert(i + 1, wx.Point(
- self.Points[i].x, self.Points[i + 1].y))
# remove corner when two segments are in opposite direction
next = vector(self.Points[i + 1], self.Points[i + 2])
@@ -2020,7 +2022,6 @@
self.RefreshBoundingBox()