Show edges hidden behind agents
Fri Feb 17 18:03:32 WET 2006 Miguel Vilaca <jmvilaca@di.uminho.pt>
* Show edges hidden behind agents
Interaction Nets allow an edge to connect two ports of the same agent.
The tool allowed that but this edge was hidden behind the agent.
Now a viaPoint is added to make it visible.
{
hunk ./src/Network.hs 470
- , edgeVia = [], edgeInfo = blank }
+ , edgeVia = if fromNodeNr /= toNodeNr then [] else [point2EdgeInNode fromNodeNr fromPort toPort network]
+ , edgeInfo = blank }
hunk ./src/Network.hs 609
+
+point2EdgeInNode :: NodeNr -> Maybe Port -> Maybe Port -> Network g n e -> DoublePoint
+point2EdgeInNode nodeNr (Just fromPort) (Just toPort) network = [_$_]
+ g (portZone fromPort) (portZone toPort)
+ where g Ztop Ztop = top [_$_]
+ g Zbottom Zbottom = bottom [_$_]
+ g Zleft Zleft = left
+ g Zright Zright = right
+ g Ztop Zbottom = right
+ g Zbottom Ztop = right
+ g Zleft Zright = top
+ g Zright Zleft = top
+ g Ztop Zleft = q2
+ g Ztop Zright = q1
+ g Zbottom Zleft = q3
+ g Zbottom Zright = q4
+ g Zleft Ztop = q2
+ g Zleft Zbottom = q3
+ g Zright Ztop = q1
+ g Zright Zbottom = q4
+
+ param = 2.0
+ f x y = translate (getNodePosition network nodeNr) $ DoublePoint (x * param) (y * param)
+
+ top = f 0 (-1) [_$_]
+ bottom = f 0 1
+ left = f (-1) 0
+ right = f 1 0
+ q1 = f 1 (-1)
+ q2 = f (-1) (-1)
+ q3 = f (-1) 1
+ q4 = f 1 1
+point2EdgeInNode _ _ _ _ = error "unexpected case"
+ [_$_]
}