Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Mixing node arrangement schemes in single diagram? (Read 2614 times)
Jeff Lindborg
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Jun 11th, 2012
Mixing node arrangement schemes in single diagram?
Jun 12th, 2012 at 6:08pm
Print Post  
Conceptual question on mixing arrangement types within the same diagram – fiddling a bit this morning I have a basic setup creating either a classic “mesh” network with X nodes (circular arrangement) or a hierarchical view (tree arrangement).

I’d like to be able to have a single presentation that can mix these – think a migration process of moving from mesh to hierarchy here – so a chunk of the nodes arranged with a circular arrangement (mesh) and a chunk of nodes arranged with a tree view (hierarchy) – connected via a bridgehead of sorts.  Nodes are migrated over one by one kind of a thing.

The arrangement seems to be applied at the diagram level and a single diagram view only accepts one diagram (although one diagram can span multiple diagram views) – so am I thinking of this incorrectly or is there a better approach to the problem I’m trying to solve?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mixing node arrangement schemes in single diagram?
Reply #1 - Jun 12th, 2012 at 6:43pm
Print Post  
You could use CompositeLayout, setting PartitionMethod to Custom and defining the chunks via the CustomPartition property. Then implement the CustomLayout delegate by calling either circular or tree layout on the provided items. Both custom partitioning and custom subgraph layouts are shown in the CompositeLayout sample project.

Alternatively, you could directly call layout.Arrange(items) for each chunk of items, changing diagram.Bounds in between to define the target subgraph position.

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


I Love MindFusion!

Posts: 6
Joined: Jun 11th, 2012
Re: Mixing node arrangement schemes in single diagram?
Reply #2 - Jun 12th, 2012 at 6:45pm
Print Post  
cool - I'll go wander through that example project for a bit.

thanks.
  
Back to top
 
IP Logged
 
Jeff Lindborg
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 6
Joined: Jun 11th, 2012
Re: Mixing node arrangement schemes in single diagram?
Reply #3 - Jun 12th, 2012 at 10:12pm
Print Post  
Well, that example code was a bit rough around the edges (no comments at all, mystery control names like “radiobutton4” that required popping back out to the form to figure out what’s going on, chunks of commented out code, hidden controls etc…) – couldn’t really figure out how to go about doing what I need to here – the example _seems_ to show all sub graphs applied to the same arrangement scheme.  I did get the composit method to sort of work but the circular mesh portion looks odd at best – not quite what I had in mind.  I’ll have to figure out how to manually do sub graphs on my own sometime when I have more cycles to burn.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Mixing node arrangement schemes in single diagram?
Reply #4 - Jun 15th, 2012 at 8:11am
Print Post  
Regarding mixing the layouts, CompositeLayout seems designed to apply the same layout for subgraphs indeed, but there is some built-in tree recognition and you can apply separate layouts by setting the SubtreeLayout and SubgraphLayout properties:

Code
Select All
var l = new CompositeLayout();
l.PartitionMethod = PartitionMethod.Custom;
l.CustomPartition = new List<DiagramNodeCollection> { set1, set2 };
//l.CustomLayout = new LayoutSubgraph(ArrangeSub);
l.MasterLayout = new LayeredLayout { Orientation = MindFusion.Diagramming.Layout.Orientation.Horizontal };
l.SubgraphLayout = new CircularLayout();
l.SubtreeLayout = new TreeLayout { Type = TreeLayoutType.Radial, IgnoreLinkDirection = true };
l.Arrange(diagram); 



Alternatively if using a custom layout delegate, you'd need some way to discover which set the provided items belong to:

Code
Select All
private bool ArrangeSub(Diagram diagram, DiagramItemCollection items)
{
	if (set1.Contains(items[0] as DiagramNode))
		new CircularLayout().Arrange(diagram, items);
	else
		new TreeLayout { Type=TreeLayoutType.Radial, IgnoreLinkDirection = true }.Arrange(diagram, items);
	return true;
} 



Both methods create the image below with these sets:

Code
Select All
set1 = new DiagramNodeCollection();
for (int i = 0; i < 10; i++)
	set1.Add(diagram.Factory.CreateShapeNode(0, 0, 8, 8));

for (int i = 0; i < 9; i++)
	for (int j = i + 1; j < 10; j++)
		diagram.Factory.CreateDiagramLink(set1[i], set1[j]);

set2 = new DiagramNodeCollection();
for (int i = 0; i < 20; i++)
	set2.Add(diagram.Factory.CreateShapeNode(0, 0, 8, 8));

for (int i = 1; i < 20; i++)
	diagram.Factory.CreateDiagramLink(set2[i / 2], set2[i]);

diagram.Factory.CreateDiagramLink(set1[0], set2[0]);
 



I'm not sure what you mean by "classic mesh network with X nodes (circular arrangement)" though, how it should be different form CircularLayout?
  

composite_test.png (Attachment deleted)
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint