Nevron Forum

NLogicalLinePort GlueToContour Issue

https://www.nevron.com/Forum/Topic2636.aspx

By Igor Yakubov - Thursday, September 17, 2009

Hi,

I need to be able to set GlueToContour to port of type NLogicalLinePort.

Is it possible to add GlueMode property to NLogicalLinePort like in case of NDynamicPort?

If so how can i achieve this?

 

Thanks.

By Ivo Milanov - Friday, September 18, 2009

Hi Igor,

It is not a built in behavior, but I have sent a personal email to you with the code of the related ports.
You should be having problems merging them to create a custom one.

Best regards,
Ivo
By Igor Yakubov - Monday, September 21, 2009

Thanks a lot!

I have another one question about ports.

When i want to connect one shape to another that have more then one port, how can i find out the nearest port to the shape that i want to connect?

Best Regards

Igor Yakubov

By Ivo Milanov - Tuesday, September 22, 2009

Hi Igor,

 

The nearest point in general can be found using the NPointFList.GetNearestPoint method. It takes a list of points and returns the point that is nearest to a specified point. You can create a list of the port locations like this:

 

List<NPointF> points = new List<NPointF>(); for (int i = shape.Ports.ChildrenCount - 1; i >= 0; i--)

{

    NPort port = (NPort)shape.GetChildAt(i);

    points.Add(port.Location);

}

 

If you are connecting a plug then you can use this technique to get the the nearest port to the plug location.

 

Best regards,

Ivo