kieler / klayjs-d3

Bridge for KLayJS and D3.js
Eclipse Public License 1.0
61 stars 8 forks source link

Connecting ports within a node #10

Open Prashanth-LakshmiNarasimhan opened 7 years ago

Prashanth-LakshmiNarasimhan commented 7 years ago

Hi, I want to connect two ports of a node and I need the edge to be inside the node. Is there any way to achieve this ? (apart from creating a dummy child node). Thank you

Currently it is creating an edge outside the node. 1111

uruuru commented 7 years ago

There's a layout option for this: de.cau.cs.kieler.selfLoopInside: true. You have to set this for both the containing node and the specific edge that should be routed inside.

Prashanth-LakshmiNarasimhan commented 7 years ago

Thanks for the reply. But it seems that the option works only if the node has a child.

I tried the following two graphs. {"children":[{"edges":[{"sourcePort":"node..port2","id":"node..port2->node..port1","text":"port2 is depended on port1","source":"node","type":"dep","targetPort":"node..port1","target":"node","properties":{"de.cau.cs.kieler.selfLoopInside":true}}],"width":40.0,"id":"node","text":"node","ports":[{"id":"node..port1","text":"port1","type":"R","properties":{"de.cau.cs.kieler.portSide":"WEST"}},{"id":"node..port2","text":"port2","type":"P","properties":{"de.cau.cs.kieler.portSide":"EAST"}}],"properties":{"portConstraints":"FIXED_SIDE","de.cau.cs.kieler.selfLoopInside":true},"height":40.0}],"id":"","properties":{"portConstraints":"FIXED_SIDE"}} 1

{"children":[{"edges":[{"sourcePort":"node..port2","id":"node..port2->node..port1","text":"port2 is depended on port1","source":"node","type":"dep","targetPort":"node..port1","target":"node","properties":{"de.cau.cs.kieler.selfLoopInside":true}}],"width":40.0,"id":"node","text":"node","ports":[{"id":"node..port1","text":"port1","type":"R","properties":{"de.cau.cs.kieler.portSide":"WEST"}},{"id":"node..port2","text":"port2","type":"P","properties":{"de.cau.cs.kieler.portSide":"EAST"}}],"children":[{"id":"dummy"}],"properties":{"portConstraints":"FIXED_SIDE","de.cau.cs.kieler.selfLoopInside":true},"height":40.0}],"id":"","properties":{"portConstraints":"FIXED_SIDE"}} 2

uruuru commented 7 years ago

Could be expected behavior. @le-cds should be able to answer this.

le-cds commented 7 years ago

I believe this is not the case in the Java version. Back then, I had to implement the graph importer to properly handle the case of inside self loops without children. This modification needs to be made in the KLayJS graph importer as well.

chandusekhar commented 7 years ago

Is there any sample for hierarchy with ports?