Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Disconnected Anchors with LayeredLayout (Read 1837 times)
arch
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Joined: Dec 12th, 2007
Disconnected Anchors with LayeredLayout
Dec 12th, 2007 at 4:16pm
Print Post  
When adding an AnchorPattern with a table column to a row in a TableNode and LayeredLayout is used to arrange elements, DiagramLinks point to the center of the TableNodes instead of the to the anchors.

DLL Versions:
MindFusion.Diagramming - 5.0.1.29794
MindFusion.Diagramming.WinForms - 5.0.1.29796

Steps to Reproduce:
1.  Create a windows forms project and add a Diagram and DiagramView.
2.  Create 2 methods in the main windows form as follows:
[code]
private AnchorPattern getAnchorPatternRow()
{
  AnchorPointCollection apc = new AnchorPointCollection();
  apc.Add(new AnchorPoint(25, 50, true, true));
  apc.Add(new AnchorPoint(75, 50, true, true));

  return new AnchorPattern(apc);
}

private AnchorPattern getAnchorPatternRowBroken()
{
  AnchorPointCollection apc = new AnchorPointCollection();
  apc.Add(new AnchorPoint(50, 50, true, true, Color.Green, 0));
  apc.Add(new AnchorPoint(50, 50, true, true, Color.Green, 1));

  return new AnchorPattern(apc);
}
[/code]

3.  In the Form_Load event, add this code (renaming as necessary for your diagram object name):
[code]
Factory f = new Factory(this.diagram1);

TableNode tn1 = f.CreateTableNode(new RectangleF(50, 50, 30, 30));
tn1.RedimTable(2, 5);
tn1.Rows[0].AnchorPattern = getAnchorPatternRow();

TableNode tn2 = f.CreateTableNode(new RectangleF(0, 0, 30, 30));
tn1.RedimTable(2, 5);
tn1.Rows[0].AnchorPattern = getAnchorPatternRowBroken();
[/code]

4.  Next add a button to your main form, and place the following code in the onclick event handler for the button:
[code]
LayeredLayout ll = new LayeredLayout();
ll.Anchoring = Anchoring.Keep;
ll.NodeDistance = 10;
ll.LayerDistance = 10;
ll.IgnoreNodeSize = false;

// note that the problem still occurs whether or not RouteAllLinks is called
diagram1.RouteAllLinks();
diagram1.ResizeToFitItems(10);
[/code]

5.  Next, make sure the properties of your diagram object are all set to the default for the control, except for the following:
[code]
AllowUnanchoredLinks = false
RouteLinks = true
SnapToAnchor = OnCreateOrModify
[/code]

6.  Run the program, and draw a link between the 2 TableNodes.  Click the button and watch as the TableNode with the green AnchorPoints now has the DiagramLink pointing to the center of the box.  The DiagramLink should be anchored to the green AnchorPoint it was previously connected to.

You can see that this doesn't occur if you do not create the AnchorPoints with a column value.

Please Advise.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Disconnected Anchors with LayeredLayout
Reply #1 - Dec 13th, 2007 at 10:26am
Print Post  
Thank you for reporting this issue - we will fix it in the 5.0.2 release. For now, you could call the ReassignAnchorPoints method for all links after applying the layout.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint