Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Layout Problem (Read 4516 times)
sydneyos
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Layout Problem
Mar 19th, 2009 at 1:19am
Print Post  
I am having the following problems w/Flow Layout using the following settings:

dgSteps.RoutingOptions.CrossingCost = 10;
dgSteps.RoutingOptions.NodeVicinitySize = 5;
dgSteps.RoutingOptions.NodeVicinityCost = 10;
dgSteps.RoutingOptions.DontOptimizeLongRoutes = true;

//FlowLayout flowLayout = new FlowLayout();
//flowLayout.AutoRoute = true;
//flowLayout.LaneDistance = 10;
//flowLayout.HorizontalGroupOffset = 10;
//flowLayout.VerticalGroupOffset = 20;
//flowLayout.NodeDistance = 10;
//flowLayout.Margins = new SizeF(10, 10);
//flowLayout.Anchoring = Anchoring.Ignore;

//flowLayout.LayoutRules.PreferredRules = PreferredRules.ConnectorRules;

1. Some nodes overlap completely.
2. The flow does not run in a completely top-to-bottom direction - at some point it starts to add nodes going upward. I assume this is because I have a shared End node that is linked to by several flows of varying lengths, but I want the End node to be at the end with long links to it.
3. I can't move nodes horizontally


What should I do?

Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Problem
Reply #1 - Mar 19th, 2009 at 1:23pm
Print Post  
Have you set the LayoutTraits[FlowLayoutTraits.LogcId] for all nodes in your diagram? the layout has further requirements that nodes that should be laid our horizontally are linked with links whose LogicID is set to the MainConnectorId.

Stoyan
  
Back to top
 
IP Logged
 
sydneyos
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Re: Layout Problem
Reply #2 - Mar 19th, 2009 at 5:39pm
Print Post  
Yes, I have.  Also, I have no nodes that I want to layout horizonally.  I want strict top-to-bottom layout.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Problem
Reply #3 - Mar 19th, 2009 at 6:46pm
Print Post  
Can't you use LayeredLayout for that? If you email us a sample diagram of yours, possibly arranged manually to show what kind of layout you need, our developer will try to find some settings that create a similar result.
  
Back to top
 
IP Logged
 
sydneyos
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Re: Layout Problem
Reply #4 - Mar 25th, 2009 at 5:28pm
Print Post  
I will email the diagram - I don't understand Layered Layout - the documentation I see doesn't tell me much about it.  What's the best way for me to learn about this?  Can you point to an example or somewhere in the documentation that would give me an idea of when and how to use it?

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Problem
Reply #5 - Mar 25th, 2009 at 7:12pm
Print Post  
TreeLayout with some link post-processing seems to come close to your screenshot:

Code
Select All
TreeLayout tl = new TreeLayout();
tl.Type = TreeLayoutType.Centered;
tl.LinkStyle = TreeLayoutLinkType.Straight;
tl.Arrange(diagram);

foreach (DiagramLink link in diagram.Links)
{
	// route this link if it has not been processed by TreeLayout
	PointCollection pts = link.ControlPoints;
	PointF p1 = pts[0];
	PointF p2 = pts[pts.Count - 1];
	if (Math.Abs(p1.Y - p2.Y) > 50)
	{
		link.Style = LinkStyle.Cascading;
		link.Route();
	}
}

diagram.ResizeToFitItems(20);
 



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


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Re: Layout Problem
Reply #6 - Mar 25th, 2009 at 8:04pm
Print Post  
Actually, what seems to work best is no Layout at all.  Just using coordinates and auto-links.  So, I'm very close, now.  The only remaining things are:

1.  Sometimes, when I load my diagram, I can't scroll all the way to the bottom.  Either part of my diagram is hidden at the bottom but the vert scroll is maxed out OR I can't scroll down below the bottom to add more stuff.

2.  Sometimes, when I select a node and try to move it, I get what appears to be a copy of the node (the copy moves).  Yet, if I delete it, under the covers, my original node gets deleted (though still shows up on the diagram until I save and reload to find my node and all link info have been deleted).

Any ideas on these items?

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Problem
Reply #7 - Mar 26th, 2009 at 5:35am
Print Post  
Hi,

1. Call Diagram.ResizeToFitItems() after creating all items.

2. Might happen if somehow you have added a node twice to Diagram.Nodes. For example, if you call Factory.CreateShapeNode(), the method creates a node and automatically adds it to Diagram.Nodes, so you should not call Diagram.Nodes.Add to add it. You must call Nodes.Add only when you create a node using the new operator.

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


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Re: Layout Problem
Reply #8 - Mar 26th, 2009 at 6:31pm
Print Post  
I just tried that but still have the bottom nodes not displaying - tried FloatBorderGap of 10 and 20 - no difference.

Also, I have diagram.AlignToGrid = true, but when I load my objects, they are not snapped to the grid.  I assume this is because I am setting their coordinates, but is there a way I could then make them snap to the grid programmatically?

And finally, I tried to use the Ruler.dll from the VS2008 (.NET 3.5) folder, getting the MindFusion.Diagramming.WinForms.dll from the same place, and get this compile error:

Assembly 'Ruler, Version=5.2.0.34238, Culture=neutral, PublicKeyToken=21bf4734c13246ea' uses 'MindFusion.Diagramming.WinForms, Version=5.2.0.34236, Culture=neutral, PublicKeyToken=21bf4734c13246ea' which has a higher version than referenced assembly 'MindFusion.Diagramming.WinForms, Version=5.2.0.34079, Culture=neutral, PublicKeyToken=21bf4734c13246ea'd:\Program Files\MindFusion\FlowChart.NET Trial Version\Bin\Ruler.dllStepFlow

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Problem
Reply #9 - Mar 26th, 2009 at 6:48pm
Print Post  
Hi,

Perhaps you are moving some nodes after calling ResizeToFitItems?

You can use the AlignPointToGird method to align items to the grid programmatically.

Remove all MindFusion* dlls from the references section in Solution Explorer and add them again. There might be some other assembly that depends on the winforms.dll.

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


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Re: Layout Problem
Reply #10 - Mar 26th, 2009 at 8:14pm
Print Post  
Thanks - it works if I do ResizeToFitItems AFTER setting the diagram on the view, but not before.

As for AlignPointToGrid, I am not getting that to work either before or after. This is what I tried:

foreach (StepNode o in ActiveDiagram.Nodes)
ActiveDiagram.AlignPointToGrid(o.Bounds.Location);

Removing all dlls worked.

Thanks
« Last Edit: Mar 26th, 2009 at 9:22pm by sydneyos »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layout Problem
Reply #11 - Mar 27th, 2009 at 7:04am
Print Post  
Try this:

o.Bounds = new RectangleF(
     ActiveDiagram.AlignPointToGrid(o.Bounds.Location),
     o.Bounds.Size);

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


I love YaBB 1G - SP1!

Posts: 28
Joined: Mar 7th, 2009
Re: Layout Problem
Reply #12 - Mar 27th, 2009 at 6:49pm
Print Post  
That does it - thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint