Angle link



Hi Walter,

How can I force the angle that a link exits from a spot so that it always points toward the right. It seems that the default is that if a spot is left of the middle of a node the link points towards the left and if the spot is on the right side of the middle from the node it points to the right. I need the route to be Routing=“Orthogonal” Curve=“None” .

Thanks.
Frank

Use go:Node.FromSpot=“MiddleRight” on the FrameworkElement that is your port.

Or maybe “TopRight” or “BottomRight”, if you want the first segment to go at a 45-degree angle.

Hi Walter,

I already have a port at that location, I need another one at TopLeft, that is the one that has the angle going the other way.

Frank

Did you try setting that port’s go:Node.FromSpot=“TopRight” and go:Node.ToSpot=“TopRight”?

Hi Walter,

Yes, the Topright port works fine I am having problems with TopLeft, I am actually using x, y points as follows:

<Rectangle go:SpotPanel.Spot=“0 0.5 10 0” Width=“5” Height=“5”
go:Node.PortId=“MiddleLeft” go:Node.LinkableTo=“True”
go:Node.LinkableMaximum=“1”
go:Node.ToSpot=“MiddleLeft” Cursor=“Hand” />

<Ellipse go:SpotPanel.Spot=“1 0.50 -10 0” Width=“10” Height=“10” Fill="{Binding Path=Data.ExtSpotMiddleRightFill, Mode=TwoWay}"
go:Node.PortId=“MiddleRight” go:Node.LinkableFrom=“True”
go:Node.LinkableMaximum=“1”
go:Node.ToSpot=“MiddleRight” Cursor=“Hand” />

<Rectangle go:SpotPanel.Spot=“0.70 0 0 30” Width=“5” Height=“5”
go:Node.PortId=“TopRight” go:Node.LinkableFrom=“True”
go:Node.LinkableMaximum=“1”
go:Node.FromSpot=“TopRight” Cursor=“Hand” />

<Rectangle go:SpotPanel.Spot=“0.50 1 0 -30” Width=“10” Height=“10” Fill="{Binding Path=Data.ExtSpotBottomRightFill, Mode=TwoWay}"
go:Node.PortId=“BottomRight” go:Node.LinkableFrom=“True”
go:Node.LinkableMaximum=“1”
go:Node.FromSpot=“BottomRight” Cursor=“Hand” />

<Ellipse go:SpotPanel.Spot="{Binding Path=Data.ExtSpotTopLeft, Mode=TwoWay}" Width=“10” Height=“10” Fill="{Binding Path=Data.ExtSpotTopLeftFill, Mode=TwoWay}"
go:Node.PortId=“TopLeft” go:Node.LinkableFrom=“True”
go:Node.LinkableMaximum=“1”
go:Node.FromSpot=“TopLeft” Cursor=“Hand” />

<Ellipse go:SpotPanel.Spot=“0.40 1 0 -30” Width=“10” Height=“10” Fill="{Binding Path=Data.ExtSpotBottomLeftFill, Mode=TwoWay}"
go:Node.PortId=“Bottomleft” go:Node.LinkableFrom=“True”
go:Node.LinkableMaximum=“1”
go:Node.FromSpot=“BottomLeft” Cursor=“Hand” />

What Spot value are you setting the “TopLeft” Ellipse’s go:SpotPanel.Spot to? That is, what is the value of Data.ExtSpotTopLeft for the node?

A probably unrelated issue: why are you using TwoWay Bindings? Does your code actually set the Ellipse’s or Rectangle’s attached Spot property programmatically, not via the Data?

Hi Walter,

The value is “0.40 0 0 20” You are correct, the two way binding makes no sense but I was using this to get the spot on the correct location via code so that it aligned correctly with the figure that the spot is on.

Why not use Spot.TopRight for that element’s FromSpot?

Because sometimes the spot has to move inside the triangle depending on the type of amplifier ( the triangle represents an amplifier ) this amp can be configured by the user in a property panel. Also if I use TopRight I can not align the spot on the outside edge of the amp or on the inside edge of the Amp.

Sorry I thought I read TopLeft, I need two lines coming out from the top of the amp and from the bottom of the amp so I Need two spots spaced apart.

Remember that for each FrameworkElement that is declared to be a port in a SpotPanel, you can set its SpotPanel.Spot attached property to position the port, and its Node.FromSpot and Node.ToSpot attached properties for how you want links to connect with the port.

All of those attached properties are independent of each other.

Hi Walter,

Got it working after your advice by creating independent ellipses and declaring spots on those ellipses instead of using the spots as visual elements.

Thanks
Frank