We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drawing OrthogonalConnector programmatically

Thread ID:

Created:

Updated:

Platform:

Replies:

92537 Jan 20,2010 10:52 AM UTC Feb 9,2010 12:04 PM UTC WinForms 4
loading
Tags: Diagram
Santanu Sarma
Asked On January 20, 2010 10:52 AM UTC

Hi,
I am using Syncfusion Essential Studio 7.4 and am trying to create an OrthogonalConnetor link between two ports wherein the points on the connector should be custom defined.
Previously, I was using the TryConnect() method which connects two points with the route of the link assigned automatically.
but I wish to assign the points on the link programmatically for which I tried using SetPoints() method which is not working.
Hoping for a quick response as this is an urgent requirement.
The code snippet I am using is as follows:


OrthogonalConnector connectionLine = new OrthogonalConnector(pointFromPortPoint, pointToPortPoint);// .PinPoint, polygon.PinPoint);
connectionLine.LineBridgingEnabled = true;
connectionLine.BridgeStyle = BridgeStyle.Arc;
connectionLine.LineRoutingEnabled = true;
connectionLine.LineHitTestPadding = 10;
connectionLine.EnableCentralPort = false;
funcBlockFrom.Ports[intFromNodePortNo].TryConnect(connectionLine.TailEndPoint);
funcBlockTo.Ports[intToNodePortNo].TryConnect(connectionLine.HeadEndPoint);
//PointF[] arr = connectionLine.GetPoints();

String[] asConnPoints = strConnectorPoints.Split(';');
PointF[] arrConnPoints = new PointF[(asConnPoints.Count() - 1) / 2];
for (int i = 0, j = 0; i < (asConnPoints.Count() - 1); j++)
{
float x = (float)Convert.ToDouble(asConnPoints.ElementAt(i));
float y = (float)Convert.ToDouble(asConnPoints.ElementAt(i+1));
PointF point = new PointF(x, y);
arrConnPoints.SetValue(point, j);
i += 2;
}
connectionLine.SetPoints(arrConnPoints);
PointF[] a = connectionLine.GetPoints();
FlexControlBAL.sequencerUserControlProductType1.diagramSequencerUserControl.Model.AppendChild(connectionLine);
foreach (Node node in FlexControlBAL.sequencerUserControlProductType1.diagramSequencerUserControl.Model.Nodes)
{
if (node is OrthogonalConnector)
{
//PointF[] b = ((OrthogonalConnector)node).GetPoints();
int ss = ((OrthogonalConnector)node).MaxPoints;
((OrthogonalConnector)node).MaxPoints = arrConnPoints.Count();
for (int i = 0; i < arrConnPoints.Count(); i++)
{
PointF ssss = (PointF)arrConnPoints.GetValue(i);
((OrthogonalConnector)node).SetPoint(i, ssss);
}
//PointF[] c = ((OrthogonalConnector)node).GetPoints();
}
}

Dinesh M [Syncfusion]
Replied On January 21, 2010 06:31 PM UTC

Hi Santanu,

Though the SetPoints method is public, it doesn't allow the users to set path points using it. I will check this issue and update you with further details in one business day.

Regards,
Dinesh

Santanu Sarma
Replied On February 3, 2010 05:30 AM UTC

Hi Dinesh,
the SetPoint() method allows connector points to be custom set only when called without the line conneting two ports. But the moment TryConnect() method is called, the line seems to be automatically rerouted and SetPoints() method doesn't seem to work.

Looking for a quick response.

Regards,
Santanu.

Santanu Sarma
Replied On February 8, 2010 07:59 AM UTC

Hi Dinesh,
I am yet to receive a response regarding the issue mentioned above. Hope to get a response soon.

Regards,
Santanu Sarma.

Dinesh M [Syncfusion]
Replied On February 9, 2010 12:04 PM UTC

Hi Santanu,

Sorry for the inadvertent delay in response. Whenever you set points of the orthogonal connector we need to ensure that the consecutive/adjacent points provided are in line(horizontal or vertical) with each other. To be more precise the points should meet the following criteria.

Geometry.CheckPointOnLine(pts[i], pts[i + 1], 0)

The following set of points will work even for connected OrthogonalConnectors.

OrthogonalConnector con = diagram1.Controller.SelectionList[0] as OrthogonalConnector;
if (con != null)
{
con.SetPoints(new PointF[5] {new PointF(0,0), new PointF(100, 0), new PointF(100, 100), new PointF(100,200), new PointF(200,200) }, true);
}

Let me know if you shall need any further clarifications in this regard.

Regards,
Dinesh

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;