Procházet zdrojové kódy

Modified Point init to accept a tuple of coordinates as well, for easy testing. Should be backwards compatible.

Jayke Meijer před 14 roky
rodič
revize
c6ab9323ba
1 změnil soubory, kde provedl 7 přidání a 3 odebrání
  1. 7 3
      src/Point.py

+ 7 - 3
src/Point.py

@@ -1,4 +1,8 @@
 class Point:
 class Point:
-    def __init__(self, corner):
-        self.x = corner.getAttribute("x")
-        self.y = corner.getAttribute("y")
+    def __init__(self, corner = None, coordinates = None):
+        if corner != None:
+            self.x = corner.getAttribute("x")
+            self.y = corner.getAttribute("y")
+        elif coordinates != None:
+            self.x = coordinates[0]
+            self.y = coordinates[1]