This is a migrated thread and some comments may be shown as answers.

RadDiagramConnection Bezier curve serialization?

4 Answers 111 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Robbie
Top achievements
Rank 1
Robbie asked on 28 Jul 2012, 02:21 AM
I have a number of RadDiagramConnections (as Beziers) in a RadDiagram and need to serialize the individual connection's geometry (the beizer curve).
Basically when the user modifies the look of the bezier I need to store that so next time my model is loaded it will look exactly the same.
I don’t want to use the Diagram’s serialize as the diagram is only a representation of an MVC model.
I also build my own connections from the model but I need to somehow store/restore the bezier curve for each connection.
Help greatly appreciated.


Just a quick update: The user can control the look of the curve by two blue circular elements.  They drag either in any direction and the curve changes. All I really need is a way to get/set these "blue ui elements" and the curve will follow.

4 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 29 Jul 2012, 10:53 AM
Hello,

 You woud not need to save the connection's geometry, as from it, you cannot easily derive the connection's properties and bezier coefficients. The bezier connection is described by four points - StartPoint and EndPoint properties describe the beginning and ending point of the connection. The other two points (the control points of the bezier curve) you can find in the ConnectionPoints collection. They are respectively the start point control point and the end point control point. If the connection is not modified, then they are automatically calculated. Otherwise, they are taken into consideration when creating the geometry. This is controlled by the RadDiagramConnection.IsModified property. So, ultimately, you should set the IsModified property to True and add the two control points into the ConnectionPoints collection ( as well as set the StartPoint and EndPoint properties) to recreate a connection's geometry.

All the best,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Robbie
Top achievements
Rank 1
answered on 01 Aug 2012, 04:52 AM
Worked a treat!  Thankyou so much for such a quick reply.
Very much appreciated.
0
Robbie
Top achievements
Rank 1
answered on 07 Oct 2012, 10:34 PM
I now have an issue that when I set RadDiagramConnection.IsModified to true and performing a multiple selected drag the bezier curves points do not move.  Of course this is caused by IsModified is true.  I am expected to take control. But how do I do this for a drag?

All I really wanted to do is when loading my diagram is load the bezier points (so it looks the same as when they moved it) and when they do move it save it for next time.

I just get the feeling what you have implemented is not a very good fit? Is there any chance of explaining a work around for me please?

0
Miro Miroslavov
Telerik team
answered on 10 Oct 2012, 07:50 AM
Hello Robbie,

 In most cases the connections should be automatic, because they represent the link between two items and when you move any of the items, then the connection must be updated. But when you modify the control points of the connection (or explicitly say its modified) then the update process can't happen automatically, so you should take care of it. What you can do is to handle the Drag event and manually alter the control points of the bezier curve. 
On a side note, I agree that we miss some extensibility here and we will improve that. I create work item for it, so that there should be easier way to achieve your goals. 
Please let us know if we can be of further help.

Greetings,
Miro Miroslavov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Robbie
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Robbie
Top achievements
Rank 1
Miro Miroslavov
Telerik team
Share this question
or