V1:
Code: Alles auswählen
class Line(object):
def __init__(self, fid, points):
self.fid = fid
self.points = points
def __eq__(self, other):
return all(any(s == o for o in other.points) for s in self.points)
Code: Alles auswählen
return any(self.points[0] == o for o in other.points) and any(self.points[1] == o for o in other.points)
Code: Alles auswählen
return (self.points[0] == other.points[0] or self.points[0] == other.points[1])
and (self.points[1] == other.points[0] or self.points[1] == other.points[1])
create_points würde in etwa so aussehen:
Code: Alles auswählen
def create_points(data):
points = {}
for point_data in data:
fid = point_data[1][0][0]
points[fid] = Point(fid, point_data[1][0][1])
fid = point_data[1][1][0]
points[fid] = Point(fid, point_data[1][1][1])
return points