graphics/SFC_Objects.py
changeset 283 c4199b88cf60
parent 263 549c413cefce
child 287 fab9a51d5b57
--- a/graphics/SFC_Objects.py	Mon Oct 13 16:07:52 2008 +0200
+++ b/graphics/SFC_Objects.py	Fri Oct 17 16:22:15 2008 +0200
@@ -101,6 +101,8 @@
         step.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             step.SetPosition(pos.x, pos.y)
+        else:
+            step.SetPosition(self.Pos.x, self.Pos.y)
         if self.Input:
             step.Input = self.Input.Clone(step)
         if self.Output:
@@ -109,6 +111,16 @@
             step.Action = self.Action.Clone(step)
         return step
     
+    def GetConnectorTranslation(self, element):
+        connectors = {}
+        if self.Input is not None:
+            connector[self.Input] = element.Input
+        if self.Output is not None:
+            connectors[self.Output] = element.Output
+        if self.Action is not None:
+            connectors[self.Action] = element.Action
+        return connectors
+    
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
@@ -589,12 +601,20 @@
         transition.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             transition.SetPosition(pos.x, pos.y)
+        else:
+            transition.SetPosition(self.Pos.x, self.Pos.y)
         transition.Input = self.Input.Clone(transition)
         transition.Output = self.Output.Clone(transition)
         if self.Type == "connection":
             transition.Condition = self.Condition.Clone(transition)
         return transition
     
+    def GetConnectorTranslation(self, element):
+        connectors = {self.Input : element.Input, self.Output : element.Output}
+        if self.Type == "connection" and self.Condition is not None:
+            connectors[self.Condition] = element.Condition
+        return connectors
+    
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
@@ -1023,10 +1043,15 @@
         divergence.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             divergence.SetPosition(pos.x, pos.y)
+        else:
+            divergence.SetPosition(self.Pos.x, self.Pos.y)
         divergence.Inputs = [input.Clone(divergence) for input in self.Inputs]
         divergence.Outputs = [output.Clone(divergence) for output in self.Outputs]
         return divergence
     
+    def GetConnectorTranslation(self, element):
+        return dict(zip(self.Inputs + self.Outputs, element.Inputs + element.Outputs))
+    
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
@@ -1453,9 +1478,14 @@
         jump.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             jump.SetPosition(pos.x, pos.y)
+        else:
+            jump.SetPosition(self.Pos.x, self.Pos.y)
         jump.Input = self.Input.Clone(jump)
         return jump
     
+    def GetConnectorTranslation(self, element):
+        return {self.Input : element.Input}
+    
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
@@ -1694,10 +1724,15 @@
         action_block.SetSize(self.Size[0], self.Size[1])
         if pos is not None:
             action_block.SetPosition(pos.x, pos.y)
+        else:
+            action_block.SetPosition(self.Pos.x, self.Pos.y)
         action_block.Input = self.Input.Clone(action_block)
         return action_block
     
-        # Returns the RedrawRect
+    def GetConnectorTranslation(self, element):
+        return {self.Input : element.Input}
+    
+    # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
         rect = rect.Union(self.Input.GetRedrawRect(movex, movey))