Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Questions about lauouts. (Read 1215 times)
oOAnriOo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 19
Joined: Oct 12th, 2009
Questions about lauouts.
Dec 14th, 2009 at 7:27am
Print Post  
Thanks for all your help so far.
I'm getting close to finishing my project but I have 2 unresolved issues you might be able to help me with.

When i use the TreeLayout i sometimes need to arrange a single level in more than one row. Is that possible.



My tree wil rarely be more than 2 levels deep, so it won't clutter on most occations.

---------

Is it possible for force the layouter to locate as much as possible on the visible area before drawing outside it. Often if I have many objects in level 2 of my treelayout, it locates nodes completely og partially outside the visibla area while there is still plenty of free space to draw on.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Questions about lauouts.
Reply #1 - Dec 14th, 2009 at 10:06am
Print Post  
Here is a possible way to do this:

Code
Select All
void ArrangeTree(int levelToSplit, DiagramNode root)
{
	List<DiagramLink> tempLinks = new List<DiagramLink>();
	List<DiagramNode> levelNodes = new List<DiagramNode>();
	GetLevel(levelToSplit, levelNodes, 0, root);

	for (int i = levelNodes.Count / 2; i < levelNodes.Count; ++i)
	{
		DiagramNode node = levelNodes[i];
		tempLinks.Add(diagram.Factory.CreateDiagramLink(
			levelNodes[i - levelNodes.Count / 2], node));
		node.IncomingLinks[0].IgnoreLayout = true;
	}

	// run it with your current settings
	new TreeLayout().Arrange(diagram);

	foreach (DiagramLink link in tempLinks)
	{
		link.Destination.IncomingLinks[0].IgnoreLayout = false;
		diagram.Links.Remove(link);
	}
}

void GetLevel(int level, List<DiagramNode> leveNodes, int currentLevel, DiagramNode node)
{
	if (currentLevel == level)
	{
		leveNodes.Add(node);
	}
	else
	{
		foreach (DiagramNode child in node.Query("outlinks/destination"))
			GetLevel(level, leveNodes, currentLevel + 1, child);
	}
}
 



You could call diagram.ResizetoFitItems after applying the layout, and then set Bounds to its union with the minimal diagram area size you need.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint