Page Index Toggle Pages: 1 [2]  Send TopicPrint
Very Hot Topic (More than 25 Replies) FlowLayout Exception (Read 18141 times)
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #15 - Apr 16th, 2009 at 3:07pm
Print Post  
Code
Select All
public class FlowLinkDiagramLink : MindFusion.Diagramming.DiagramLink
	  {
		#region Internal State
		private Link m_flowLink;
		#endregion

		#region Constructors
		static FlowLinkDiagramLink()
		{
		}
		public FlowLinkDiagramLink(Diagram diagram, Link flowLink, DiagramNode source, DiagramNode destination) : base(diagram,source,destination)
		{
		    diagram.Items.Add(this);
		    this.FlowLink = flowLink;
		    this.LayoutTraits[FlowLayoutTraits.LogicID] = "ControlFlow";
		    this.Brush = new MindFusion.Drawing.SolidBrush(Color.LightSkyBlue);
		    this.Pen = new MindFusion.Drawing.Pen(Color.DarkBlue);
		    this.HeadPen = new MindFusion.Drawing.Pen(Color.DarkBlue);
		    this.HeadShape = ArrowHead.Triangle;
		    this.TextStyle = LinkTextStyle.OverLongestSegment;
		    this.Style = LinkStyle.Polyline;
		}
		#endregion

		#region Override Shadow Rendering
		public override void DrawShadow(IGraphics graphics, RenderOptions options)
		{

		}
		#endregion

		#region Accessors
		public Link FlowLink
		{
		    set
		    {
			  m_flowLink = value;
			  this.Text = m_flowLink.ID.ToString();
		    }
		    get
		    {
			  return m_flowLink;
		    }
		}
		#endregion
	  }
 

  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #16 - Apr 16th, 2009 at 3:10pm
Print Post  
Right, above are the two custom nodes, you wont have the Link, FlowBlock, Node types and I cannot give them to you, you will have to strip these out of the objects.

Essentially I was using these custom nodes to encapsulate and associate our types with your diagram types.

eg.
a FlowBlock is contained and represented by a ContainerNode

a Node is contained and represented by a ShapeNode

a Link is contained and represented by a DiagramLink

  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #17 - Apr 16th, 2009 at 3:14pm
Print Post  
[quote author=Stoyo link=1239702777/0#12 date=1239884219]

Also, seems with that setup the layout cannot find any rules to follow, and just bends the links while preserving the node positions, which should not be different from applying OrthogonalRouter.

Stoyan[/quote]

How can I make it reposition the nodes in a better way, I don't intrinsically know what flow logic is being inferred by the links interconnecting the nodes. Although I could probably make some informed guess based on the node type and if the link is incoming or outgoing....

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #18 - Apr 17th, 2009 at 8:39am
Print Post  
Well, the control knows even less about what your diagrams show 8) FlowLayout is supposed to be used with something like sequence diagrams, and expects much guidance about what the nodes are used for. E.g. if the diagram shows some business process, with sequences of action nodes that describe some sub-processes displayed in different lanes, FlowLayout would expect you to specify the start and end nodes of the sub-processes, the index of the lane they should appear in, and the links in the sequence should be set as control-flow links. Some helper nodes that show associated data for the sub-process but are not part of the sequence could be displayed either above or below the control-flow line, as set through the sub-level positive/negative IDs.

We've also tried to adapt this class for arranging general flowcharts as in the Flow layout example, but that does not work that well. Now our developers are working on a new "FlowchartLayout" class that does some recursive decomposition of the graph and can recognize and arrange structures such as decisions and loops in program code. If your diagrams show something like flowcharts, we could send you a preview version of this layout if you wish to try it.

Stoyan
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #19 - Apr 17th, 2009 at 8:53am
Print Post  
I would love to try it Smiley

I'll add the control flow link property and see if that helps.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #20 - Apr 17th, 2009 at 9:56am
Print Post  
Here's a preview version:
https://mindfusion.eu/_beta/flowchartlt_preview.zip

The new class is called MindFusion.Diagramming.Layout.FlowchartLayout. It does not have any properties yet, so you can't customize node and layer distances, anchor points, etc. Also it is very strict on what kind of graphs it can arrange. E.g. it expects the flowchart to have only one start node (a vertex of zero in-degree), though if you have more than one, you can add a temporary start node that links them and the algorithm will find and use it as a decision node. The graphs should be susceptible to recursive decomposition, and links that lead to ambiguity would break the algorithm (such as a link that corresponds to a GOTO statement and jumps from one branch to another - the recursive function would not know whether it should follow that link or the normal control-flow sequence of the flowchart). Anyway we'll try to make it more forgiving for the official release, and add some keys that you could assign to LayoutTratis as hints for what to do in ambiguous situations. If the algorithm recognizes the graphs successfully as a flowchart, it will arrange it like this:



Stoyan
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #21 - Apr 17th, 2009 at 11:32am
Print Post  
well the results I got didn't look anything like your graph, you can try it with my test graph I sent you to see what I got...

It seemed to layout the first few nodes correctly because they have a very easy to follow flow although the everything after that was just placed where I originally created them.

Thanks for the test though, It might be that I'm missing an end point for the bit of the graph it failed to layout.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #22 - Apr 23rd, 2009 at 7:42pm
Print Post  
Seems the problem is caused by several double and triple links in your graph. Once we remove the duplicates, it runs much better. It's not perfect yet, but hopefully the released version will be Wink

Stoyan
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #23 - Apr 24th, 2009 at 9:26am
Print Post  
yes, I suspected something like that, unfortunatly the duplicate links are valid, our system that we are mapping has multiple links that connect the same origin and destination nodes, although represent different choices for the entry point to the destination node.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowLayout Exception
Reply #24 - Apr 24th, 2009 at 12:57pm
Print Post  
The latest version of FlowchartLayout arranges the graph as shown below, when the duplicated links are removed:
https://mindfusion.eu/_beta/fcnet_flowchartlt2.zip


If that looks close to what you need, we could ignore the duplicated links when analyzing the graph, and draw them at the same positions, but with a few pixels offset from each other when arranging.

Stoyan
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: FlowLayout Exception
Reply #25 - Apr 24th, 2009 at 2:57pm
Print Post  
Thats exactly what we need Cheesy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint