Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Link Orientation for visioNodes in .net (Read 392 times)
ALO
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Aug 14th, 2024
Link Orientation for visioNodes in .net
Aug 14th, 2024 at 9:09am
Print Post  
Hi, i’m reaching out to understand how to configure link orientations for VisionNodes anchor points.

I came across a forum discussion from the past that mentioned changing link orientations for each anchor point. It seems that the ability to set vertical or horizontal orientations might have been supported in earlier versions but could have been removed or changed in recent updates.

Is there a solution to achieve the same functionality or different route in the current version? thank you
  
Back to top
 
IP Logged
 
ALO
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Aug 14th, 2024
Re: Link Orientation for visioNodes in .net
Reply #1 - Aug 14th, 2024 at 9:11am
Print Post  
heres the link to the older discussion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3228
Joined: Oct 19th, 2005
Re: Link Orientation for visioNodes in .net
Reply #2 - Aug 14th, 2024 at 9:53am
Print Post  
Hi,

Code from that link is for WPF version of the diagram control. The AnchorPoint class there has a LinkOrientation property, considered by GridRouter, but that was never implemented in WinForms diagram.

The new PatternRouter class used by default in recent versions should select correct orientations, orthogonal to the node border where a link connects. If you are seeing incorrect routes created by it, please attach a diagram file for our developer to investigate.

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


I Love MindFusion!

Posts: 4
Joined: Aug 14th, 2024
Re: Link Orientation for visioNodes in .net
Reply #3 - Aug 29th, 2024 at 11:11am
Print Post  
hi,

thank you for your reply.
I am setting my diagram with these properties:
Code
Select All
With diagram
			.Theme = theme
			.LinkCrossings = LinkCrossings.Arcs
			.LinkShape = LinkShape.Cascading
			.LinkSegments = 3
			.LinkEndsMovable = True
			.DynamicLinks = False
			.LinkHeadShape = Nothing
			.AllowSplitLinks = True
			.AutoSnapLinks = True
			.AllowUnanchoredLinks = False
			.LinkCascadeOrientation = Orientation.Auto
			.SnapToAnchor = SnapToAnchor.OnCreateOrModify
			.AllowSelfLoops = False
			.AllowLinksRepeat = False
			.RouteLinks = False
			.ShapeHandlesStyle = HandlesStyle.HatchFrame
			.ShadowsStyle = ShadowsStyle.None
			.RestrictItemsToBounds = RestrictToBounds.InsideOnly
			.Selection.AllowMultipleSelection = True
			.ActiveItemHandlesStyle.HandlePen = New MindFusion.Drawing.Pen(color.Red)
			.ShapeHandlesStyle = HandlesStyle.HatchFrame
			.Selection.Style = SelectionStyle.SelectionHandles
			.GridSizeX = 1
			.GridSizeY = 1
		End With 


The attached image shows two shapes linked together, with their anchor points at the bottom center. The link line is currently being drawn along the shape's border, whereas I would like the start and to be vertical in this situation.

I am aware that I can set the link start and end orientation in diagram properties to vertical, but there are other cases where I need it to be horizontal. Additionally, I understand that setting RouteLinks to True can help with this issue, but it still doesn't work perfectly when the two shapes are close to each other.

Could you provide any advice on how to better handle this?
Or maybe I'm setting something that should be automated?

Thank you
  

Screenshot_2024-07-31_091129.png ( 19 KB | 11 Downloads )
Screenshot_2024-07-31_091129.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3228
Joined: Oct 19th, 2005
Re: Link Orientation for visioNodes in .net
Reply #4 - Aug 30th, 2024 at 6:16am
Print Post  
Hi,

If you do not enable auto routing, links connect their anchor points without considering node positions, just by applying shortest possible geometry. You can still modify link.ControlPoints to pull segments away from nodes, but then would just be implementing automatic routing yourself.

Quote:
it still doesn't work perfectly when the two shapes are close to each other


That should not be happening with new default PatternRouter, please attach saved diagram xml file demonstrating it if it does. If you are on current version, make sure the application isn't explicitly setting diagram.LinkRouter to a GridRouter instance. If using older version, try setting smaller RoutingOptions.GridSize to allow for empty lanes in the grid when shapes are placed at short distances.

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


I Love MindFusion!

Posts: 4
Joined: Aug 14th, 2024
Re: Link Orientation for visioNodes in .net
Reply #5 - Sep 5th, 2024 at 6:50am
Print Post  
Hi,

here is the diagram xml file with shapes close to each other and ignoring auto routing when set to True.

I would also like to ask if auto routing can have some exceptions for visioNodes? lets say to auto route when connecting 2 nodes together, but not when dragging a third node and dropping it on of the link line?

thank you
  

Diagram.xml ( 959 KB | 8 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3228
Joined: Oct 19th, 2005
Re: Link Orientation for visioNodes in .net
Reply #6 - Sep 6th, 2024 at 7:03am
Print Post  
Hi,

Please set Obstacle = false for your attached / label nodes (displaying "filter" in this specific diagram). It routes links as expected then:

Code
Select All
diagram.LoadFromXml("diagram.xml");
foreach (var node in diagram.Nodes)
    if (node.MasterItem != null)
        node.Obstacle = false;
diagram.RouteAllLinks(); 



Alternatively, consider using NodeLabel objects instead of whole nodes to only display the labels.

Regards,
Slavcho
Mindfusion
« Last Edit: Sep 6th, 2024 at 8:14am by Slavcho »  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3228
Joined: Oct 19th, 2005
Re: Link Orientation for visioNodes in .net
Reply #7 - Sep 6th, 2024 at 8:10am
Print Post  
and if you actually want bends to appear between graphics nodes and their label nodes, instead of links going through labels, note that there isn't any empty space between them. You'd have to offset the label nodes to leave space for the links, and possibly reduce allowed bend distances:

Code
Select All
foreach (var node in diagram.Nodes)
    if (node.MasterItem != null)
        node.Move(node.Bounds.X, node.Bounds.Y + 10);

var compositeRouter = diagram.LinkRouter as CompositeRouter;
if (compositeRouter != null)
{
    var patternRouter = compositeRouter.Routers[0] as PatternRouter;
    if (patternRouter != null)
    {
        patternRouter.MinimumDistance = 1;
        patternRouter.PreferredDistance = 4;
    }
}

diagram.RouteAllLinks(); 



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