Commit 4c9265a3 authored by Michael Büsch's avatar Michael Büsch

gui/fup_grid: Return set from collision check

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 51427375
...@@ -221,9 +221,9 @@ class FupGrid(object): ...@@ -221,9 +221,9 @@ class FupGrid(object):
with another wire line. with another wire line.
excludeWires => Iterable if FupWire()s to exclude from the check. excludeWires => Iterable if FupWire()s to exclude from the check.
lineSeg => The LineSeg2D() that should be drawn. lineSeg => The LineSeg2D() that should be drawn.
Returns a list of colliding self.Line() instances. Returns a set of colliding self.Line() instances.
""" """
collisions = [] collisions = set()
for line in self.__lines: for line in self.__lines:
if line.wire in excludeWires: if line.wire in excludeWires:
continue continue
...@@ -234,7 +234,7 @@ class FupGrid(object): ...@@ -234,7 +234,7 @@ class FupGrid(object):
# Make a shallow copy of Line and add the Inter2D. # Make a shallow copy of Line and add the Inter2D.
line = line.dup() line = line.dup()
line.inter = inter line.inter = inter
collisions.append(line) collisions.add(line)
return collisions return collisions
def drawWireLine(self, painter, wire, lineSeg): def drawWireLine(self, painter, wire, lineSeg):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment