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. Image for the cookie policy date

Convert Diagram to a Database

Hi,

I am currently using the evaluation version to see if this a good product for what I need with diagrams. Basically I need for a user to create a generic state diagram with nodes and links. Then I want to enter the values for the nodes into a database and also store the link relations to other nodes. Is there a simple way to create an XML representation of the diagram, or to simply loop through it and determine node associations? I can already create diagrams, I'm just wondering how to input the relational data into a database. Any info would be greatly appreciated. Thank you.

4 Replies

JA Jake Ayers June 1, 2007 04:12 PM UTC

Just to clarify, I do not want to save the entire diagram into the database. I want to enter individual nodes and links into tables and retain their connection information.


MF Meera Fathima Syncfusion Team June 4, 2007 12:39 PM UTC


Hello Jake,

Thank you for evaluating the Essential Diagram.

I have created a sample that shows how to save a selected node into the DB and attached the same with this post. You can get the sample from the following link -
http://websamples.syncfusion.com/samples/Diagram.Windows/F61793/main.htm

Sample Details :

1. Clicking the SaveData toolbar button will save the first node in the selection list into the DB.

2. Clicking the LoadData toolbar button will load the node saved in step1 and add it to the diagram model.

FYI - If your intension is to save the entire diagram , you can achieve this by using the diagram.SaveSoap/SaveBinary and diagram.LoadSoap/LoadBinary method instead of diagram.Model.AppendChild() method.

Please look into the sample and let me know if you have any questions regarding this.

Thanks,
Meera.



DD Dan Dorey July 12, 2007 05:18 PM UTC

Hi there,

I'm trying to implement similar functionality to Jake.

It looks as though the example you give is simply serializing all the object information to the DB. However, I need to contruct this callflow in memory in another program. In order to this I'd like to only store the type of node I've added to the diagram as well as all the links connecting nodes. I don't need information about where the nodes are located on the diagram.

I can loop through all the nodes and links like in the exmaple:

foreach (Node curNode in dg.Controller.SelectionList)
{
...
}

However I'm unsure as to how when I get to a link I'm supposed to determine which nodes it connects to.

Any guidance would be appreciated. (using version 5.1)

Dan


>
Hello Jake,

Thank you for evaluating the Essential Diagram.

I have created a sample that shows how to save a selected node into the DB and attached the same with this post. You can get the sample from the following link -
http://websamples.syncfusion.com/samples/Diagram.Windows/F61793/main.htm

Sample Details :

1. Clicking the SaveData toolbar button will save the first node in the selection list into the DB.

2. Clicking the LoadData toolbar button will load the node saved in step1 and add it to the diagram model.

FYI - If your intension is to save the entire diagram , you can achieve this by using the diagram.SaveSoap/SaveBinary and diagram.LoadSoap/LoadBinary method instead of diagram.Model.AppendChild() method.

Please look into the sample and let me know if you have any questions regarding this.

Thanks,
Meera.



MF Meera Fathima Syncfusion Team July 17, 2007 06:10 AM UTC


Hello Dan,

I apologize for this delay in responding. If your intention is to get the links(for.e.g. if it is line connector) connected between the nodes, you can do this by checking whether the node is the LineConnector. And if you want to find the nodes that are connected with the link, you can get this by using the LineConnector.FromNode and LineConnector.ToNode properties.

Below is the sample code snippet for your reference.

foreach (Node curNode in dg.Controller.SelectionList)
{
// code here
if (curNode is LineConnector)
{
LineConnector line = new LineConnector(PointF.Empty, new PointF(10, 10));

if (line.FromNode != null)
{
// code here
}
if (line.ToNode != null)
{
// code here
}
}
}

If I have misunderstood your requirement, could you please explain me in detail, so that I can work in
depth and try to send a better solution?

Also please do let me know if you have any other technical questions or I can be of any other assistance. I will be glad to assist you.

Thank you for your support to Syncfusion products.

Best Regards,
Meera.

Syncfusion, Inc.
http://www.syncfusion.com/


Loader.
Live Chat Icon For mobile
Up arrow icon