graphics/LD_Objects.py
changeset 283 c4199b88cf60
parent 269 34eff05909b0
child 327 7fd5233ce5ce
--- a/graphics/LD_Objects.py	Mon Oct 13 16:07:52 2008 +0200
+++ b/graphics/LD_Objects.py	Fri Oct 17 16:22:15 2008 +0200
@@ -61,6 +61,8 @@
         powerrail.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             powerrail.SetPosition(pos.x, pos.y)
+        else:
+            powerrail.SetPosition(self.Pos.x, self.Pos.y)
         powerrail.Connectors = []
         for connector in self.Connectors:
             if connector is not None:
@@ -69,6 +71,10 @@
                 powerrail.Connectors.append(None)
         return powerrail
     
+    def GetConnectorTranslation(self, element):
+        return dict(zip([connector for connector in self.Connectors if connector is not None],
+                        [connector for connector in element.Connectors if connector is not None]))
+    
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
@@ -434,10 +440,15 @@
         contact.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             contact.SetPosition(pos.x, pos.y)
+        else:
+            contact.SetPosition(self.Pos.x, self.Pos.y)
         contact.Input = self.Input.Clone(contact)
         contact.Output = self.Output.Clone(contact)
         return contact
     
+    def GetConnectorTranslation(self, element):
+        return {self.Input : element.Input, self.Output : element.Output}
+    
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
@@ -714,10 +725,15 @@
         coil.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             coil.SetPosition(pos.x, pos.y)
+        else:
+            coil.SetPosition(self.Pos.x, self.Pos.y)
         coil.Input = self.Input.Clone(coil)
         coil.Output = self.Output.Clone(coil)
         return coil
     
+    def GetConnectorTranslation(self, element):
+        return {self.Input : element.Input, self.Output : element.Output}
+    
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)