Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Layouts (Read 4613 times)
kkt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 1st, 2007
Layouts
Feb 13th, 2007 at 3:26pm
Print Post  
Hi,

I have the beta 4.3 . Does the grid layout method need a rectangular "cell" size to work. Is there a way to specify a grid cell that is not rectangular?

Also, is there a way to force the tree layout (which I use in left to right direction) to place the root at extreme left of my document?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouts
Reply #1 - Feb 13th, 2007 at 5:29pm
Print Post  
Hi,

At this time GridLayout supports only rectangular cells. I am not sure how exactly you need this to work, but scaling the item coordinates after the layout in proportion to their distance to one of the grid corners might help.

You can move the tree root node to any position you like and run the TreeLayout with KeepRootPos enabled.

Stoyan
  
Back to top
 
IP Logged
 
kkt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 1st, 2007
Re: Layouts
Reply #2 - Feb 15th, 2007 at 5:54am
Print Post  
Well, if your shapes are not symmetric (i.e. the proportion of width to height is big) then the grid layout must either overlap shapes if the size of the grid is small or leave big gaps between shapes along the y - axis (our shapes our wide) if the size is big enough to fit the width. I suppose scaling the coordinates as you suggest will solve the problem. Will try that out.

Now another question. Please, let me know if I can make the layered layout algorithm display cascading arrows. When I apply this layout method my arrows turn to straight lines, althouh their style is cascading.

[code]
Private Sub LayeredLayout()
With New LayeredLayout
.KeepGroupLayout = True
.Anchoring = Anchoring.Keep
.Orientation = MindFusion.Diagramming.WinForms.Layout.Orientation.Horizontal
.SplitLayers = True
.LayerDistance = _TABLE_WIDTH_ / 5
.NodeDistance = _TABLE_WIDTH_
.Arrange(theGraph)
End With
End Sub
[/code]

Also, I would like to ask you if there is a way to find out if a diagram structure is a tree or not. I can write this myself of course but just wondering if the control can answer that. In most of my cases (I represent graphically, the workflow of documents in an ERP system) the structure is a tree. Every node originates back to an entry-level node (say an order document for example). In a minority of cases this is not the case. What the control does in those cases when I apply the tree layout, is that it draws a part of the diagram as a tree (vire nicely) and the shapes that it cannot handle are left overlapping on others (can send you a simple screenshot if you can't make sense of my writing) and also those shapes are connected to others with straight arrows (as opposed to cascading used in all other connections).
I was thinking that in such a case the layered layout approach would produce better results, but first of all it turns my arrows to straight lines and secondly I need to distinguish these cases (hence my question about finding if a structure is a tree)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouts
Reply #3 - Feb 15th, 2007 at 6:59am
Print Post  
All layouts change the ArrowStyle to one our developers deemed would look best. TreeLayout also changes it, but at least gives you a property to select the style yourself.

With LayeredLayout you can change the style yourself after calling Arrange, but you will need to preserve the points through which arrows pass or otherwise they might cross a node, e.g.

Code
Select All
LayeredLayout ll = new LayeredLayout();
ll.Arrange(fc);

foreach (Arrow a in fc.Arrows)
{
	PointCollection keyPoints = a.ControlPoints.Clone();

	a.Style = ArrowStyle.Cascading;
	a.CascadeOrientation = Orientation.Vertical;
	a.SegmentCount = (short)((keyPoints.Count - 1) * 3);

	for (int i = 0; i < keyPoints.Count - 1; ++i)
	{
		PointF point = keyPoints[i];
		PointF next = keyPoints[i + 1];

		a.ControlPoints[3*i] = point;
		a.ControlPoints[3*i + 1] = new PointF(point.X, (point.Y + next.Y) / 2);
		a.ControlPoints[3*i + 2] = new PointF(next.X, (point.Y + next.Y) / 2);
	}

	a.ControlPoints[a.ControlPoints.Count - 1] = keyPoints[keyPoints.Count - 1];
	a.UpdateFromPoints();
}
 



Or you could use the TreeLayout and call the Arrow.Route method for arrows that go up in the tree, so they do not cross nodes.

A not very nice way to detect if the graph is a tree is to create a TreeEnumerator using the "strict" option and call its MoveNext method in a try/catch block. If you get an exception, you will know the graph is not a tree.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Layouts
Reply #4 - Feb 15th, 2007 at 7:09am
Print Post  
That code was for a vertical layered layout. You must swap the X/Y for point/next if using a horizontal one. I got the following results with the vertical one -

  
Back to top
 
IP Logged
 
kkt
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Feb 1st, 2007
Re: Layouts
Reply #5 - Feb 15th, 2007 at 7:38am
Print Post  
Great. I will give it a try. I suppose it could be a function of the control to allow you to specify arrow looks in layout algorithms. Would make our lifes simpler.

Well done guys. It will be a sale soon enough (just waiting for the analysts to see the outcome)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint