Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) How can I prevent diagonal lines in links? (Read 8189 times)
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
How can I prevent diagonal lines in links?
Feb 11th, 2012 at 9:18am
Print Post  
How can I prevent diagonal lines in a link with Horizontal value in CascadeOrientation property and AutoRout?




Thank in advance,
Homam
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can I prevent diagonal lines in links?
Reply #1 - Feb 11th, 2012 at 10:58am
Print Post  
Have you set the link's Style to Cascading?
  
Back to top
 
IP Logged
 
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: How can I prevent diagonal lines in links?
Reply #2 - Feb 11th, 2012 at 11:02am
Print Post  
Yes, it's Cascading
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can I prevent diagonal lines in links?
Reply #3 - Feb 13th, 2012 at 7:15am
Print Post  
Are you setting any other link properties or routing options? This works fine for me with everything else at default values:

Code
Select All
private void diagram_LinkCreated(object sender, LinkEventArgs e)
{
	DiagramLink link = e.Link;
	link.Style = LinkStyle.Cascading;
	link.CascadeOrientation = Orientation.Horizontal;
	link.AutoRoute = true;
} 



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


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: How can I prevent diagonal lines in links?
Reply #4 - Feb 15th, 2012 at 10:07am
Print Post  
Thanks for the answer.. I posted your code too but it still doesn't work.

Even when I'm dragging the Shape.. the attached shape is rendering..

  

Untitled_002.png ( 8 KB | 193 Downloads )
Untitled_002.png
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can I prevent diagonal lines in links?
Reply #5 - Feb 15th, 2012 at 12:27pm
Print Post  
Could you attach here a sample project that reproduces this, or email it to support@mindfusion.eu?
  
Back to top
 
IP Logged
 
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: How can I prevent diagonal lines in links?
Reply #6 - Feb 16th, 2012 at 8:52am
Print Post  
Thanks.. the sample is in the attached.
  

WorkflowDesigner2.rar (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How can I prevent diagonal lines in links?
Reply #7 - Feb 16th, 2012 at 4:14pm
Print Post  
When I removed the CascadeOrientation assignment in AddProcessLink, the end point of the link could not be moved because it is covered by the middle point. Is this why you are setting the orientation to Horizontal?

It seems the problem happens because the auto-routing function does not update this flag but sets the first segment to vertical anyway when the link begins from the node's bottom center, and the link's subsequent state is not well defined. You could reset the flag to Auto once the link is connected to a node to fix this:

Code
Select All
private void diagram_LinkModified(object sender, LinkEventArgs e)
{
	e.Link.CascadeOrientation = MindFusion.Diagramming.Orientation.Auto;
	if (!e.Link.Destination.IsDummyNode() && !e.Link.AutoRoute)
		e.Link.AutoRoute = true;
} 



Alternatively if this is only for hit-testing the last point, do not change the orientation flag but set SegmentCount to 3 - this should move the next-to-last point to the middle where it won't prevent you from dragging the end points.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: How can I prevent diagonal lines in links?
Reply #8 - Sep 25th, 2012 at 6:53am
Print Post  
I'm trying the alternative way you mentioned by changing the SegmentCount to 3 but it is not changing. Whatever the new value it is, it keeps holding 3. What should I do?

Thanks
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: How can I prevent diagonal lines in links?
Reply #9 - Sep 25th, 2012 at 10:11am
Print Post  
Hi,

It seems SegmentCount value is ignored if AutoRoute is set to true. As a workaround you could set the ControlPoints collection to the desired points and then call UpdateFromPoints(true, true) to adjust the number of segments.

Also, in the latest release hit-test priority is given to the last point in the collection, so if you upgrade you'll be able to move the last point even with a straight cascading link with 2 segments (when there are overlapping points).

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: How can I prevent diagonal lines in links?
Reply #10 - Sep 26th, 2012 at 9:02am
Print Post  
I've just upgraded to the new version - 6 - and the bug in the attached image appeared although it was working well before the upgrade.
Could you please help me..

  

Capture_005.PNG ( 20 KB | 270 Downloads )
Capture_005.PNG
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: How can I prevent diagonal lines in links?
Reply #11 - Sep 26th, 2012 at 10:31am
Print Post  
There are no changes in the setting of link shapes in v 6.0.

Could you check, if by any chance if you're not setting ControlPoints values to these coordinates; or maybe after refactoring some style got lost when renaming link.Style to link.Shape.

If you're using anchor points and you're calling some layout algorithm, have a look at the value of the Layout.Anchoring property. Maybe the default has changed, and that could result in end points repositioning. If that's the case you could either try another Anchoring value, or set the points' locations accordingly.

Also, have a look at any event handlers that could have been disconnected - in the latest release old Event handler delegates have been removed and events are now defined as generic EventHandler types.

If you're not able to fix the problem, please attach a sample project that reproduces this behavior, so that our developer can have a look at it.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
Re: How can I prevent diagonal lines in links?
Reply #12 - Sep 26th, 2012 at 11:10am
Print Post  
Well, this's exactly what I'm trying to do:

I'm trying to prevent two links to be handled from the same anchor point and keep the Dynamic property set to true to choose the best anchor point in the same time.

What I did to accomplish that is the following:


Code (Java)
Select All
void diagram_LinkRouted(object sender, LinkEventArgs e)
{
    var otherLinksFromOriginNode = e.Link.Origin.OutgoingLinks
        .Cast<DiagramLink>()
        .Where(p => p != e.Link);

    var otherLinksFromDestniationNode = e.Link.Destination.IncomingLinks
        .Cast<DiagramLink>()
        .Where(p => p != e.Link);

    bool isThereSharedAnchorPoint =
        otherLinksFromOriginNode.Any(p => p.OriginAnchor == e.Link.OriginAnchor)
        ||
        otherLinksFromDestniationNode.Any(p => p.DestinationAnchor == e.Link.DestinationAnchor);

    if (isThereSharedAnchorPoint)
    {
        e.Link.Origin.ReassignAnchorPoints();
        e.Link.Destination.ReassignAnchorPoints();

        diagram.RouteAllLinks();
    }
}
 



Does my code accomplish my requirements? Is there a better way? Is it causing the reported problem?

In the attachment another nice example
« Last Edit: Sep 26th, 2012 at 12:18pm by Homam »  

Capture4.PNG (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: How can I prevent diagonal lines in links?
Reply #13 - Sep 26th, 2012 at 12:35pm
Print Post  
I cannot see the cause of the links issue in this handler.

Check if you're modifying the ControlPoints collection after routing. That seems the most likely cause. Maybe you're setting the middle control points in a way that expects the end points to be anchored to bottom center and top center of a node.

Also, you should be aware that there is a possibility of an infinite recursion in your snippet - RouteAll will raise the LinkRouted event and the application could hang/crash if the number of links associated with a given node is greater than the number of anchor points.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint