Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problem with links inside ContainerNodes (Read 1767 times)
roman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Feb 8th, 2011
Problem with links inside ContainerNodes
Feb 8th, 2011 at 8:39am
Print Post  
Hi Stoyo

Currently I'm evaluating your diagramming components for our System. We want to visualize our scripts as flowcharts. Therefore I'm using ContainerNodes to visualize the scopes. I can connect ShapeNodes to the container, if they are beyond the container, but if i want to connect the ContainerNode with the components in the ContainerNode, the link is always forced outside the container first, before it connects to the component in the container. It seems the link is no child-component of the container, because if i collapse the container, the link is drawn anyway.



How can i achieve this behaviour:



The following code reproduces the problem:

Code
Select All
ContainerNode container = flowchart.Factory.CreateContainerNode(0, 0, 0, 0, true);
container.AnchorPattern = new MindFusion.Diagramming.AnchorPattern(new AnchorPoint[2] {
 new AnchorPoint(50, 0),
 new AnchorPoint(50, 100) });

ShapeNode node1 = flowchart.Factory.CreateShapeNode(0, 0, 50, 10);
node1.Text = "Node 1";
ShapeNode node3 = flowchart.Factory.CreateShapeNode(0, 0, 50, 10);
node3.Text = "Node 3";

ShapeNode node2 = flowchart.Factory.CreateShapeNode(0, 0, 50, 10);
node2.Text = "Node 2";
container.Add(node2);
node2.AnchorPattern = new MindFusion.Diagramming.AnchorPattern(new AnchorPoint[2] {
 new AnchorPoint(50, 0),
 new AnchorPoint(50, 100) });

DiagramLink toContainer = flowchart.Factory.CreateDiagramLink(node1, container);
DiagramLink inContainer1 = flowchart.Factory.CreateDiagramLink(container, node2);
inContainer1.OriginAnchor = 0;
inContainer1.DestinationAnchor = 0;
DiagramLink inContainer2 = flowchart.Factory.CreateDiagramLink(node2, container);
inContainer2.OriginAnchor = 1;
inContainer2.DestinationAnchor = 1;
DiagramLink fromContainer = flowchart.Factory.CreateDiagramLink(container, node3);

FlowchartLayout layout = new FlowchartLayout();
layout.Orientation = MindFusion.Diagramming.Layout.Orientation.Vertical;
layout.Arrange(flowchart);

 



Thanks in advance
Roman
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with links inside ContainerNodes
Reply #1 - Feb 8th, 2011 at 9:38am
Print Post  
Hi Roman,

I could reproduce this by calling RouteAllLinks after the layout method while using GridRouter. Is that what you are doing? Otherwise it looked fine if not routing the links or if using the default router.

In any case, our developers have not considered such situation where a link would connect a node to its container, so if you must use such links you will have to implement some additional processing for them. E.g. hide or show them in response to the ContainerFolded and ContainerUnfolded events, and temporarily switch to QuickRouter and call link.Route just on them. If these links always connect the topmost and bottommost child to the container's anchor points, you can simply set their Style to Polyline and SegmentCount to 1 and avoid routing.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
roman
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Feb 8th, 2011
Re: Problem with links inside ContainerNodes
Reply #2 - Feb 8th, 2011 at 10:06am
Print Post  
Hi Stoyo

Thanks a lot.
Using the QuickRouter did the trick.
I'm not calling RouteAllLinks, but I was using GridRouter first. So i guess the GridRouter led to this behaviour.

Considering the drawing of the links, if the container is collapsed. I also thought so, that i have to handle the drawing in the ContainerFolded and ContainerUnfolded events.

Thanks again for the quick response Smiley
Roman
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint