I want to remove one of the points in the OrthogonalLine link type. By default, their are 4 points. Start, end, and two in the middle which give the line 2 right angles. I only want 1. Is there an easy way to do this? I tried using the link.LocalPoints.RemovePoint method but it doesn''t seem to do anything. Any help would be greatly appreciated.
ADAdministrator Syncfusion Team March 11, 2005 06:05 PM
I just answered your DirectTrac support incident on the same issue.
This is for the benefit of others that might be interested in the topic.
This can be done, but the implementation is not exactly trivial, and is something that you will have to try on your own. The following description of the process involved in generating an orthogonal link should help you get started.
The LinkTool when attempting to draw an Orthogonal Link uses the Syncfusion.Windows.Forms.Diagram.OrthogonalLine class''s algorithm for calculating the mid-points that will make up the line segments of the link. There is no way to change the current behavior of the LinkTool such that when creating an OrthogonalLine link, it generates a Shape composed of 2 line segments in place of the 3 segments that the default orthogonal line generation algorithm uses. Instead, you will have to create a subtype of the Syncfusion.Windows.Forms.Diagram.Link class, that uses a custom version of the Link.CreateLinkShape() method that will use a custom version of the OrthogonalLine type, defined within your application, for the link''s shape object. Referring to the Link.CreateLinkShape(Link.Shapes shapeType, PointF pts) method in the ''Diagram.Base\Src\Symbols\LinkShape.cs'' file, and the LinkFactory definitions in the DiagramBuilder sample will give you an idea how to go about creating a new Link class that uses a custom shape object. There is an Essential Diagram Knowledgebase article on this topic - http://www.syncfusion.com/support/kb/diagram/Default.aspx.
Once this part is complete, you will have to implement a custom version of the OrthogonalLine class that generates the orthogonal line segments in a way that only one mid-point is present in the OrthogonalLine. Please refer to the Syncfusion.Windows.Forms.Diagram.OrthogonalLine class in the ''Diagram.Base\Src\Shapes\OrthogonalLine.cs'' file, and specifically the OrthogonalLine.MakeOrthogonal(Points) method to get an idea about how Essential Diagram creates an orthogonal line. You will notice that given the two end points and heading directions, the OrthogonalLine class uses the ''Geometry.CalcOrthogonalPoints(...)'' method to determine the mid-points of an orthogonal line. The heading end points determine the number of segments that will be present in the orthogonal line. Varying the heading end points will let you control the number of line segments(and hence right-angles) that will be present in the orthogonal line generated by the link. In your custom version of the OrthogonalLine type, depending on the X & Y positions of the line endpoint, use end point pairs that are always along the same axis ie, North - South or East - West. Providing such a combination of heading endpoints to the Geometry.CalcOrthogonalPoints() method should ensure that the generated line will be composed of two line segments that are connnected by one right-angle joint.