Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Layout of TableNode with table and row anchors ignores anchoring (Read 2946 times)
Chris Smith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Feb 20th, 2012
Layout of TableNode with table and row anchors ignores anchoring
Feb 20th, 2012 at 12:59pm
Print Post  
Hi All,

I have created a diagram programmatically that looks like example_001.png. There are two table nodes. Each table has an AnchorPattern with two anchor points, one on either side of the caption. Each table consists of multiple rows with AnchorPoints on either side. There are three links, all attached to anchor points. The first one is connected between the two nodes. The second is connected from the first node to the 3rd row in the second node. The third is connected from the 3rd row in the first node to the 3rd row in the second node.

I've attached an xml output of the diagram (example.txt).

When i apply any layout to the graph it seems to either reassign the anchor points (even tho i always set Anchoring = Keep) or ignore the Cascading style and make the links diagonal.

(see the zip for some examples).

Am I doing something wrong? Is there a type of layout that will respect the anchoring for table nodes?

Thanks for any help,

Chris
  

example_001.png (Attachment deleted)
example.txt (Attachment deleted)
Layouts.zip (Attachment deleted)
Back to top
 
IP Logged
 
Chris Smith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Feb 20th, 2012
Re: Layout of TableNode with table and row anchors ignores anchoring
Reply #1 - Feb 21st, 2012 at 3:20am
Print Post  
Mmm - the more i poke this, the more it seems like a bug.

I'm concentrating on FlowchartLayout for now.

So I copied "Link 1" another couple of times and gave then the names "Link 1.5" and "Link 1.7" and then applied the flowchart layout and now i find that link 1 has it's anchoring removed but all the other links perform as expected.

It seems like the anchoring on the first link (in the drawing?) is ignored.

Attached are screenshots of before and after the layout - you can see that link one becomes detached from its anchors. If i change the order that the links are created in then whatever the first link is always becomes detached.

Cheers,
Chris
  

BeforeLayout.png (Attachment deleted)
AfterLayout.png (Attachment deleted)
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Layout of TableNode with table and row anchors ignores anchoring
Reply #2 - Feb 21st, 2012 at 9:21am
Print Post  
Hi,

Most layouts (FlowChartLayout included) modify the style of the links in the diagram. This is intentional and is done to accommodate the links to the layout logic. We have made some adjustments to the FlowChartLayout class to force him to preserve the cascading style of the links when possible as well as honor the Anchoring property (which was previously ignored to avoid breaking orthogonality). The adjustments are already available in the 5.8 Beta, which can be downloaded from here.

I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Chris Smith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Feb 20th, 2012
Re: Layout of TableNode with table and row anchors ignores anchoring
Reply #3 - Feb 21st, 2012 at 11:40pm
Print Post  
Thanks Mappy, yes, the beta seems to have improved FlowchartLayout - it now gives me the result attached (FixedFlowchartLayout.png).

There are still some issues tho unfortunately. If i change Anchoring.Keep to Anchoring.Reassign then it doesnt respect the anchor grouping when reassigning the anchors (ie the start points for links 1 -> 2 should have been either side of the top of the table but it's actually used some of the row anchor points instead). AnchoringReassign.png shows this. Are my expectations incorrect here? Maybe i need to do some custom validation to restrict the anchor points to ones within the same AnchorPattern?

Re "modify the style of the links", I guess my expectations were that the layout would move the nodes around and reroute the links but that the anchoring and properties of the links would otherwise be respected. Is that the intention?

Thanks for your help,
Chris
  

FixedFlowchartLayout.png (Attachment deleted)
AnchoringReassign.png (Attachment deleted)
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Layout of TableNode with table and row anchors ignores anchoring
Reply #4 - Feb 22nd, 2012 at 2:53pm
Print Post  
It appears that the current implementation of Layout.Anchoring does not take into consideration whether a link was attached to a table or an individual table row. However (as you have suggested) it is possible to control the anchoring of a link during layout by handling the Diagram.ValidateAnchorPoint event. The following code illustrates how:

Code
Select All
void diagram1_ValidateAnchorPoint(object sender, LinkValidationEventArgs e)
{
	if (!layouting)
		return;

	if (e.ChangingOrigin)
	{
		if (e.Link.OriginIndex == -1)
		{
			// Attached to the table, we want to keep it this way
			if (e.TableRow != -1)
			{
				e.Cancel = true;
				return;
			}
		}
		else
		{
			// Attached to a row, ensure that the link preserves its row
			if (e.Link.OriginIndex != e.TableRow)
			{
				e.Cancel = true;
				return;
			}
		}
	}
	else if (e.ChangingDestination)
	{
		if (e.Link.DestinationIndex == -1)
		{
			// Attached to the table, we want to keep it this way
			if (e.TableRow != -1)
			{
				e.Cancel = true;
				return;
			}
		}
		else
		{
			// Attached to a row, ensure that the link preserves its row
			if (e.Link.DestinationIndex != e.TableRow)
			{
				e.Cancel = true;
				return;
			}
		}
	}
} 


The check at the start of the event handler ensures that this logic will execute only during layouts and it will not affect common interactions with the control. The layouting field is set to true immediately before the Arrange call and set back to false right after.

I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint