RadDiagramConnection Bezier curve serialization?

5 posts, 0 answers
  1. Robbie
    Robbie avatar
    5 posts
    Member since:
    Mar 2012

    Posted 27 Jul 2012 Link to this post

    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.
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 29 Jul 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Robbie
    Robbie avatar
    5 posts
    Member since:
    Mar 2012

    Posted 31 Jul 2012 Link to this post

    Worked a treat!  Thankyou so much for such a quick reply.
    Very much appreciated.
  5. Robbie
    Robbie avatar
    5 posts
    Member since:
    Mar 2012

    Posted 07 Oct 2012 Link to this post

    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?

  6. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 10 Oct 2012 Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready