Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Self loops (Read 2647 times)
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Self loops
Jan 31st, 2016 at 9:36pm
Print Post  
Hi Stoyo,
I am using WPF diagramming v. 3.0.0.
When I try to connect two anchor points of the same node, the resulting link is a closed curve connecting a new anchor point above the node (see attachment).
I would like, instead, to see a standard cascading link connecting the real anchor points.
Can I obtain it?
Thanks in advance,
Danilo
  

Image.png ( 4 KB | 150 Downloads )
Image.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Self loops
Reply #1 - Feb 1st, 2016 at 10:17am
Print Post  
Hello there,

See if you have SetSelfLoopShape event in version 3.0 and handle it by assigning link's OriginAnchor and DestinatinoAnchor and calling Route(). If SetSelfLoopShape is missing you'll just have to handle more events, like LinkCreated and LinkModified, and also check if the link has become a self-loop from their handlers.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Re: Self loops
Reply #2 - Feb 1st, 2016 at 5:37pm
Print Post  
Thanks Slavcho.
SetSelfLoopShape event seems not available.
could you please provide me a small code snippet for this issue?
Checking the Linkcreated event, seems that Origin and Destination Anchors are set correctly.
The Link shape has been forced to bezier and I'm not able to convert it back successfully as cascading.

Regards,
Danilo
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Self loops
Reply #3 - Feb 2nd, 2016 at 2:18pm
Print Post  
Hello Danilo,

Shape setter could reject Cascading value if the link has only one segment. Set larger SegmentCount too before assigning to Shape -

Code
Select All
private void OnLinkCreated(object sender, LinkEventArgs e)
{
	var link = e.Link;
	if (link.Origin == link.Destination)
	{
		link.SegmentCount = 3;
		link.Shape = LinkShape.Cascading;
		link.StartPoint = link.OriginConnection.
			GetAnchorPos(link.OriginAnchor);
		link.EndPoint = link.DestinationConnection.
			GetAnchorPos(link.DestinationAnchor);
		link.Route();
	}
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Re: Self loops
Reply #4 - Feb 2nd, 2016 at 2:40pm
Print Post  
Wonderful, thanks a lot.
As usual, your support is extremely prompt and effective.
Bye,

Danilo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint