NLogicalLinePort GlueToContour Issue


Author
Message
Ivo Milanov
Ivo Milanov
Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)
Group: Forum Members
Posts: 35, Visits: 32

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


Igor Yakubov
Igor Yakubov
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)
Group: Forum Members
Posts: 7, Visits: 1

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


Ivo Milanov
Ivo Milanov
Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)
Group: Forum Members
Posts: 35, Visits: 32
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
Igor Yakubov
Igor Yakubov
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)
Group: Forum Members
Posts: 7, Visits: 1

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.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search