Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) mark link branch (Read 17825 times)
NiceGuy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: Feb 13th, 2017
mark link branch
Feb 13th, 2017 at 9:58am
Print Post  
We are using your software since several years and we are really happy with it.

We would request a new feature or try to implement it ourself.

We draw a lot of links between nodes and use your flow chart similar to Matlab Simulink. When links cross each other we use the "cut links" to show that the links are not connected. But now we need the possibility to draw a round dot on branches where two links from the same source are splitting, or two links with the same destination are joining. We think, that you might have an easy possibility to do that because you already distinguish between overlapping lines an crossing lines in your "cut links" algorithm. May be it's easy for you to add this feature. I think a lot of your customers will appreciate ist. It makes data flow diagrams much more readable.

The second question is if you have an suggestion how to implement a routing were lines from the same source or with the same destination routed as long as possible above each other while all other lines are routed normally.

We also thought already about your ternary sample, but this is not the right solution for us, because we need links between nodes without any additionally help nodes.

best regards
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #1 - Feb 13th, 2017 at 10:50am
Print Post  
You can show branching dot with some custom-drawing like this -
Code
Select All
void diagram_DrawLink(object sender, DrawLinkEventArgs e)
{
    if (e.Shadow)
        return;
    var node = e.Link.Origin;
    var links = new List<DiagramLink>();

    foreach (var link in node.OutgoingLinks)
    {
        if (link.StartPoint == e.Link.StartPoint)
            links.Add(link);
    }

    if (links.Count < 2)
        return;

    links.Sort((l1, l2) =>
    {
        var s1 = l1.StartPoint;
        var e1 = l1.ControlPoints[1];
        var s2 = l2.StartPoint;
        var e2 = l2.ControlPoints[1];
        var d1 = Utilities.Distance(s1, e1);
        var d2 = Utilities.Distance(s2, e2);
        return d1.CompareTo(d2);
    });

    if (e.Link != links[links.Count - 1])
    {
    	var ec = e.Points[1];
        using (var elipseBrush = new System.Drawing.SolidBrush(Color.Red))
        {
            e.Graphics.FillEllipse(
                elipseBrush, ec.X - 2, ec.Y - 2, 4, 4);
        }
    }
} 



You might want to keep the point coordinates in some kind of cache data structure and update the cache from modify / create events. We'll have it in mind as a built-in feature for next release.

Best regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #2 - Feb 13th, 2017 at 11:02am
Print Post  
* that code assumes 'cascading' links and does not check if segments lie on same line apart from comparing first points. If you need same feature for polylines at arbitrary angles, you will also have to check for collinearity.
  
Back to top
 
IP Logged
 
NiceGuy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: Feb 13th, 2017
Re: mark link branch
Reply #3 - Feb 13th, 2017 at 5:27pm
Print Post  
Thank you for your help !

We implemented an tested your code. To make it work we changed the „node.OutgoingLinks“ with "node.GetAllOutgoingLinks()“ then it worked. The code snippet created the blue dots. One of them is correct. The one in the in the yellow circle is not. We need all the red dots. We think you already have all those positions, because it is identical to all points where two lines meet or branch and you do not draw the "cut links".

We have a lot of lines - thats why performance matters. When do you expect to release a version with this feature ?

What do you recommend for the second part of our question. We need a routing algorithm, where the links from the same source or with the same destination are routed as long as possible above each other while all other lines are routed normally.

Please see the attached image ...

Best regards an thank you
  

Links.png ( 3 KB | 156 Downloads )
Links.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #4 - Feb 14th, 2017 at 8:08am
Print Post  
Right, we hadn't considered branching could happen further along the link path and code above was handling only first segments. This should look for common points in next segments too -

Code
Select All
int LastCommonPoint(DiagramLink l1, DiagramLink l2)
{
	int cpi = 1;
	while (
		l1.ControlPoints[cpi] == l2.ControlPoints[cpi] &&
		cpi < l1.ControlPoints.Count - 1 &&
		cpi < l2.ControlPoints.Count - 1)
	{
		cpi++;
	}
	return cpi - 1;
}

void diagram_DrawLink(object sender, DrawLinkEventArgs e)
{
	if (e.Shadow)
		return;
	var node = e.Link.Origin;
	var links = new List<DiagramLink>();

	foreach (var link in node.OutgoingLinks)
	{
		if (link.StartPoint == e.Link.StartPoint)
			links.Add(link);
	}

	if (links.Count < 2)
		return;

	links.Sort((l1, l2) =>
	{
		return l1.Length.CompareTo(l2.Length);
	});

	var longest = links[links.Count - 1];
	if (e.Link != longest)
	{
		int cpi = LastCommonPoint(e.Link, longest);
		var cp1 = e.Link.ControlPoints;
		var cp2 = longest.ControlPoints;
		if (cpi < cp1.Count - 1)
		{
			var dx1 = cp1[cpi + 1].X - cp1[cpi].X;
			var dy1 = cp1[cpi + 1].Y - cp1[cpi].Y;
			var dx2 = cp2[cpi + 1].X - cp2[cpi].X;
			var dy2 = cp2[cpi + 1].Y - cp2[cpi].Y;
			var ec = Math.Sign(dx1) == Math.Sign(dx2) && Math.Sign(dy1) == Math.Sign(dy2) ?
				cp1[cpi + 1] : cp1[cpi];
			using (var elipseBrush = new System.Drawing.SolidBrush(Color.Red))
			{
				e.Graphics.FillEllipse(
					elipseBrush, ec.X - 2, ec.Y - 2, 4, 4);
			}
		}
	}
} 



I guess we could add some post-processing step for routing algorithm that pulls together segments of links from same origin. We'll need to think of some criteria for whether such link go in same general direction to do that.
  
Back to top
 
IP Logged
 
NiceGuy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: Feb 13th, 2017
Re: mark link branch
Reply #5 - Feb 14th, 2017 at 10:48am
Print Post  
Thank you. We will be able to implement the point algorithm in our code. Can you please answer our other two questions.

- When do you think will this feature be released in a new version ?

- What are your suggestions in relation to the routing

(copied from older post)
What do you recommend for the second part of our question. We need a routing algorithm, where the links from the same source or with the same destination are routed as long as possible above each other while all other lines are routed normally.

Thank you again for your help...
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #6 - Feb 14th, 2017 at 1:33pm
Print Post  
From reply above Quote:
I guess we could add some post-processing step for routing algorithm that pulls together segments of links from same origin. We'll need to think of some criteria for whether such link go in same general direction to do that.


you could implement it as post-routing step of some kind too if you can think of good way to determine for how long links should overlap. I guess it could be based on distance of segments from each other after routing - set first elements of ControlPoints to same coordinates until the initial routes diverge too far by some threshold value.
  
Back to top
 
IP Logged
 
NiceGuy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: Feb 13th, 2017
Re: mark link branch
Reply #7 - Feb 15th, 2017 at 9:28am
Print Post  
Thank you for your reply!  Sorry also, that i missed your hint for the routing.

We think routing is not so easy especially in our case with a lot of links. Thats why we hope you could integrate this feature. We searched a lo in the forum and we think any customer, who uses your software for information or dataflow routing will greatly benefit from it.

What do you think ?

Best regards & thank you.

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #8 - Feb 15th, 2017 at 12:53pm
Print Post  
Yes, we'll have in mind both branching indication and merged routes for link with same StartPoint for next release.
  
Back to top
 
IP Logged
 
NiceGuy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: Feb 13th, 2017
Re: mark link branch
Reply #9 - Feb 16th, 2017 at 2:02am
Print Post  
Thats really good news - thank you very much !!!

Can you give us a hint when you expect your next release. We don't want to push you, but we need it for our internal planning.

Best regards and Thank you very much !
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #10 - Feb 16th, 2017 at 10:22am
Print Post  
In 2-3 months; we might have a preview / beta build earlier.
  
Back to top
 
IP Logged
 
NiceGuy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: Feb 13th, 2017
Re: mark link branch
Reply #11 - Feb 16th, 2017 at 10:27am
Print Post  
Thank you! That would be great !
We are looking forward to it.

May be we can get an early version and support you by testing it.

Best regards...
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #12 - Apr 11th, 2017 at 1:25pm
Print Post  
Try the LinkBranchIndicator, BranchIndicatorSize and BranchIndicatorColor properties here -
https://mindfusion.eu/_beta/fcnet_branchind.zip

These work only for Cascading link shape. Setting diagram.LinkBranchIndicator to BranchIndicator.Arrow looks like this -

  
Back to top
 
IP Logged
 
NiceGuy
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: Feb 13th, 2017
Re: mark link branch
Reply #13 - May 12th, 2017 at 9:49am
Print Post  
Hi, thanks for your support.

Your current beta works pretty well, except the positioning of the dot. We expect the dot on the junction of two lines, but it appears on the edge above. Please see the image attached.

Best regards
  

Question.png ( 26 KB | 149 Downloads )
Question.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: mark link branch
Reply #14 - May 12th, 2017 at 5:01pm
Print Post  
Hi,

It actually only looks for branch points where links diverge, not junction ones where they merge. We'll add separate properties for junctions in a few days.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint