Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Get the data from all ShapeNode's and Links (Read 2890 times)
Rasmus
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jun 12th, 2009
Get the data from all ShapeNode's and Links
Jun 12th, 2009 at 6:00pm
Print Post  
Hallo.

I need the data from all ShapeNodes and Links which are on a diagramView.

I need it to save the data in a sql-database.

Thank for help.

regards 
Rasmus
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get the data from all ShapeNode's and Links
Reply #1 - Jun 12th, 2009 at 6:22pm
Print Post  
Hi,

You can do that by iterating the diagram's Nodes and Links collections.

Code
Select All
foreach (ShapeNode node in diagramView.Diagram.Nodes)
{
  string s = node.Text;
  int id = (int)node.Tag;
  // populate dataset record
}
 



You can find some code that reads from a database here:
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=122477128...

I suppose writing should look similar. Let me know if you need an example.

Stoyan
  
Back to top
 
IP Logged
 
Rasmus
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jun 12th, 2009
Re: Get the data from all ShapeNode's and Links
Reply #2 - Jun 12th, 2009 at 8:00pm
Print Post  
Hallo.

Thank you.

Now I get the informations from the nodes and links.
But how I get the informations which nodes are connected with a link? So, from which node to witch note goes a link?

Read out and write in a SQL-database is not the problem.

Rasmus
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get the data from all ShapeNode's and Links
Reply #3 - Jun 14th, 2009 at 9:36am
Print Post  
Hi,

Given a link, you can get the nodes it connects by checking the link's Origin and Destination properties. Given a node, you can find the links incident to it through the node's OutgoingLinks and IncomingLinks collections.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Rasmus
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jun 12th, 2009
Re: Get the data from all ShapeNode's and Links
Reply #4 - Jun 17th, 2009 at 12:01pm
Print Post  
Hallo.
Sorry, but I don't finde the right object. Embarrassed

I read the positions and texts from the nodes.

Code
Select All
listBox1.Items.Clear();
int number= 0;
foreach (ShapeNode node in diagramView.Diagram.Nodes)
{
  listBox1.Items.Add("");
  listBox1.Items.Add(number.ToString());
  string s = node.Text;
  listBox1.Items.Add(s);

  s = "x = " + node.Bounds.X.ToString() +
        "y = " + node.Bounds.Y.ToString();
        listBox1.Items.Add(s);

  number++;
}
 



Than I read the links:

Code
Select All
foreach (DiagramLink Link in diagramView.Diagram.Links)
{
  string s = Link.Text;
  listBox1.Items.Add(s);
}
 



But I don't finde the commands to get the information from which node to witch node the link goes. Neither about the Origin and Destination properties nor about the OutgoingLinks or IncomingLinks.

Have anybody a little code for me? ???

Regards
Rasmus

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Get the data from all ShapeNode's and Links
Reply #5 - Jun 17th, 2009 at 12:38pm
Print Post  
Hi,

Origin and Destination are properties of DiagramLink:

Code
Select All
foreach (DiagramLink Link in diagramView.Diagram.Links)
{
	string s = Link.Text;
	listBox1.Items.Add(s);

	string o = Link.Origin.ZIndex.ToString();
	listBox1.Items.Add(o);
	string d = Link.Destination.ZIndex.ToString();
	listBox1.Items.Add(d);
}
 



OutgoingLinks and IncomingLinks are properties of DiagramNode.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Rasmus
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Jun 12th, 2009
Re: Get the data from all ShapeNode's and Links
Reply #6 - Jun 17th, 2009 at 2:37pm
Print Post  
Thanks a lot!  Cheesy

It's so easy and I have not see it! Sorry.

Regards
Rasmus
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint