Page Index Toggle Pages: 1 ... 9 10 [11] 12 13 ... 21 Send TopicPrint
Locked Topic Link between two nodes (Read 157314 times)
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #150 - Jul 4th, 2014 at 8:50am
 
Fine Its solved.
  
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #151 - Jul 4th, 2014 at 12:43pm
 
Stoyo wrote on Jul 4th, 2014 at 8:25am:
Right, OrthogonalLayout handles two-node subgraphs separately and it did not consider nodes' size, only Padding value. This version should fix that:

https://mindfusion.eu/_beta/netdiag521.zip

I hope that helps,
Stoyan


Again some Issues in diagrams i m using your latest version, please check attached diagrams.
The behavior of diagrams is not consistent, some are in proper and some not.
  

XMLwithPDF.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link between two nodes
Reply #152 - Jul 4th, 2014 at 12:54pm
 
It's not the same XML as from PDF output, but I think it shows the problem with doubled links we discussed before. For time being either remove the doubles or copy their points:

Code
Select All
// find doubles
var doubles = new Dictionary<DiagramLink, DiagramLink>();
foreach (var node in diagram.Nodes)
{
	for (int i = 0; i < node.OutgoingLinks.Count; i++)
	{
		var li = node.OutgoingLinks[i];
		for (int j = i + 1; j < node.OutgoingLinks.Count; j++)
		{
			var lj = node.OutgoingLinks[j];
			if (li.Destination == lj.Destination &&
				!doubles.ContainsKey(lj))
			{
				doubles[lj] = li;
				lj.IgnoreLayout = true;
			}
		}
	}
}

OrthogonalLayout ol = new OrthogonalLayout();
ol.Padding = 20;
ol.Arrange(diagram);

foreach (var link in doubles.Keys)
{
	var l = doubles[link];
	link.ControlPoints.Clear();
	link.ControlPoints.AddRange(l.ControlPoints);
	link.UpdateFromPoints();
} 

  
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #153 - Jul 7th, 2014 at 4:13am
 
Stoyo wrote on Jul 4th, 2014 at 12:54pm:
It's not the same XML as from PDF output, but I think it shows the problem with doubled links we discussed before. For time being either remove the doubles or copy their points:

Code
Select All
// find doubles
var doubles = new Dictionary<DiagramLink, DiagramLink>();
foreach (var node in diagram.Nodes)
{
	for (int i = 0; i < node.OutgoingLinks.Count; i++)
	{
		var li = node.OutgoingLinks[i];
		for (int j = i + 1; j < node.OutgoingLinks.Count; j++)
		{
			var lj = node.OutgoingLinks[j];
			if (li.Destination == lj.Destination &&
				!doubles.ContainsKey(lj))
			{
				doubles[lj] = li;
				lj.IgnoreLayout = true;
			}
		}
	}
}

OrthogonalLayout ol = new OrthogonalLayout();
ol.Padding = 20;
ol.Arrange(diagram);

foreach (var link in doubles.Keys)
{
	var l = doubles[link];
	link.ControlPoints.Clear();
	link.ControlPoints.AddRange(l.ControlPoints);
	link.UpdateFromPoints();
} 



First thing its not issue of doubly links, and some links are proper and some not can u tell me exact cause behind this.
I have attached new XML is of PDF.please check.

another one thing why some arrows using orthogonal styles and some as directs?
  

s2tadmin_SourceSystemDiagram_04Jul2014_055847PM.txt (Attachment deleted)
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #154 - Jul 7th, 2014 at 4:45am
 
Please check diagram properly and i have mentioned some comments in red square for your understanding.
  

BRLD_001.jpg (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link between two nodes
Reply #155 - Jul 7th, 2014 at 10:19am
 
Ok, we were missing doubled links in opposite directions. Try code below instead. We'll try to add built-in support in next few days, along with some code to pull apart the doubles, as they overlap with the current work-around.

I hope that helps,
Stoyan

Code
Select All
// find doubles
var doubles = new Dictionary<DiagramLink, DiagramLink>();
foreach (var node in diagram.Nodes)
{
	var links = node.GetAllLinks();
	for (int i = 0; i < links.Count; i++)
	{
		var li = links[i];
		if (li.Origin == li.Destination)
		{
			li.IgnoreLayout = true;
			continue;
		}
		if (doubles.ContainsKey(li))
			continue;
		for (int j = i + 1; j < links.Count; j++)
		{
			var lj = links[j];
			if (!doubles.ContainsKey(lj) && SameNodes(li, lj))
			{
				doubles[lj] = li;
				lj.IgnoreLayout = true;
			}
		}
	}
}

OrthogonalLayout ol = new OrthogonalLayout();
ol.Padding = 20;
ol.MultipleGraphsPlacement = MultipleGraphsPlacement.MinimalArea;
ol.Arrange(diagram);

foreach (var li in diagram.Links)
{
	if (li.Origin == li.Destination)
	{
		var p = li.Origin.Bounds.Location;
		li.ControlPoints.Clear();
		li.ControlPoints.Add(new PointF(p.X, p.Y + 2));
		li.ControlPoints.Add(new PointF(p.X - 5, p.Y + 2));
		li.ControlPoints.Add(new PointF(p.X - 5, p.Y - 5));
		li.ControlPoints.Add(new PointF(p.X + 5, p.Y - 5));
		li.ControlPoints.Add(new PointF(p.X + 5, p.Y));
		li.UpdateFromPoints();
	}
}
foreach (var link in doubles.Keys)
{
	var l = doubles[link];
	link.ControlPoints.Clear();

	if (link.Origin == l.Origin)
		link.ControlPoints.AddRange(l.ControlPoints);
	else
		link.ControlPoints.AddRange(l.ControlPoints.Reverse());
	link.UpdateFromPoints();
} 

  
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #156 - Jul 7th, 2014 at 10:39am
 
Stoyo wrote on Jul 7th, 2014 at 10:19am:
Ok, we were missing doubled links in opposite directions. Try code below instead. We'll try to add built-in support in next few days, along with some code to pull apart the doubles, as they overlap with the current work-around.

I hope that helps,
Stoyan

Code
Select All
// find doubles
var doubles = new Dictionary<DiagramLink, DiagramLink>();
foreach (var node in diagram.Nodes)
{
	var links = node.GetAllLinks();
	for (int i = 0; i < links.Count; i++)
	{
		var li = links[i];
		if (li.Origin == li.Destination)
		{
			li.IgnoreLayout = true;
			continue;
		}
		if (doubles.ContainsKey(li))
			continue;
		for (int j = i + 1; j < links.Count; j++)
		{
			var lj = links[j];
			if (!doubles.ContainsKey(lj) && SameNodes(li, lj))
			{
				doubles[lj] = li;
				lj.IgnoreLayout = true;
			}
		}
	}
}

OrthogonalLayout ol = new OrthogonalLayout();
ol.Padding = 20;
ol.MultipleGraphsPlacement = MultipleGraphsPlacement.MinimalArea;
ol.Arrange(diagram);

foreach (var li in diagram.Links)
{
	if (li.Origin == li.Destination)
	{
		var p = li.Origin.Bounds.Location;
		li.ControlPoints.Clear();
		li.ControlPoints.Add(new PointF(p.X, p.Y + 2));
		li.ControlPoints.Add(new PointF(p.X - 5, p.Y + 2));
		li.ControlPoints.Add(new PointF(p.X - 5, p.Y - 5));
		li.ControlPoints.Add(new PointF(p.X + 5, p.Y - 5));
		li.ControlPoints.Add(new PointF(p.X + 5, p.Y));
		li.UpdateFromPoints();
	}
}
foreach (var link in doubles.Keys)
{
	var l = doubles[link];
	link.ControlPoints.Clear();

	if (link.Origin == l.Origin)
		link.ControlPoints.AddRange(l.ControlPoints);
	else
		link.ControlPoints.AddRange(l.ControlPoints.Reverse());
	link.UpdateFromPoints();
} 



what is SameNodes ? Its giving error is it function?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link between two nodes
Reply #157 - Jul 7th, 2014 at 10:42am
 
Add this method:

Code
Select All
bool SameNodes(DiagramLink l1, DiagramLink l2)
{
    if (l1.Origin == l2.Origin && l1.Destination == l2.Destination) return true;
    if (l1.Origin == l2.Destination && l1.Destination == l2.Origin) return true;
    return false;
} 

  
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #158 - Jul 7th, 2014 at 11:37am
 
Please check attached image its giving exception while exporting to PDF and this exception occurs when i have added your code, previously its not coming.
  

Exception.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link between two nodes
Reply #159 - Jul 7th, 2014 at 12:11pm
 
Add (false, true) arguments to both UpdateFromPoints calls:

Code
Select All
li.UpdateFromPoints(false, true);
...
link.UpdateFromPoints(false, true); 

  
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #160 - Jul 7th, 2014 at 1:01pm
 
Please check attached Image here you are applying arrows on both sides which is wrong.
  

BRLD_002.jpg (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link between two nodes
Reply #161 - Jul 7th, 2014 at 1:12pm
 
These are two links placed like that by the code that handles doubles above (... link.ControlPoints.AddRange(l.ControlPoints.Reverse()) ...). If you feel the doubled links were added to the graph incorrectly by your users, you can remove all doubles from the diagram instead of copying points in the foreach in doubles.Keys loop. As I said we'll be implementing built-in support for double links in next few days and will add some code to pull them apart so they don't overlap.
  
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #162 - Jul 8th, 2014 at 5:03am
 
To change the link color which XML tag is used?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link between two nodes
Reply #163 - Jul 8th, 2014 at 5:27am
 
Code
Select All
var point = new PointF(0, 0);
var link = diagram.Factory.CreateDiagramLink(point, point);
link.Pen = new Pen(Color.Red, 0);
diagram.SaveToXml("test.xml"); 



creates the following XML:

Code
Select All
<Link Class="std:DiagramLink" Id="0" Version="2">
  ...
  <Pen>
    <Color>#FFFF0000</Color>
    <DashOffset>0</DashOffset>
    <DashStyle>0</DashStyle>
    <LineJoint>0</LineJoint>
    <MiterLimit>10</MiterLimit>
    <Width>0</Width>
  </Pen> 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
shrinivas
Full Member
***
Offline


I Love MindFusion!

Posts: 169
Joined: May 21st, 2014
Re: Link between two nodes
Reply #164 - Jul 8th, 2014 at 6:31am
 
and what will be the tag for link head color?

also
what will be the inner text if i want to draw (- - - - - -) dash lines?

<DashStyle>0</DashStyle>
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 ... 9 10 [11] 12 13 ... 21
Send TopicPrint