Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Basic node operations (Read 1319 times)
Rale
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jan 8th, 2009
Basic node operations
Jan 8th, 2009 at 4:53am
Print Post  
Hey,

I have few questions Cheesy.

Im creating nodes via function:

private void Create_Click(object sender, EventArgs e)
{
ShapeNode NewNode = Diagram.Factory.CreateShapeNode(22, 5, 6, 6);
NewNode.Shape = Shapes.Rectangle;
NewNode.Text = NameInput.Text;
}

1. now what i need to do is after all needed nodes are created and linked by user, select one of created nodes in function and count incoming and outgoing links in that node. node selection should be random or if one node doesnt meet the condition how to transfer to another one. Becuz from my point of view all nodes are named the same created this way and cant be distinct one form another or im wrong Cheesy

2. when i find the node that meets my conditions (number of links) i would like to delete it from diagram and save that node and its neighbours on stack of some kind (is that posible?) for later reconstruction of graph...

3. is it possible to check the color of node neighbours. this is wher the distinction beatwean nodes would come in handy

In Graph managment Basic operation section i found this but when tried to used it i was asked for a type of data waht should i enter here if i want to put nodes in queue
Queue remaining = new Queue();

I searched forum, onlne help and checked the exampels in FlowChart.NET but havent seen any example of things that im asking. If i overlooked somthing im reall sorry.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Basic node operations
Reply #1 - Jan 8th, 2009 at 6:34am
Print Post  
Hi,

1. Counting the links can be done like node.IncomingLinks.Count + node.OutgoingLinks.Count. If you wish to distinguish nodes by name, you could set their Tag property and then access them using the Diagram.FindNode(tag) function. Otherwise, you could just search for a node by looping over Diagram.Nodes and checking the number of links for each node.

2. Yes, you can call Diagram.Nodes.Remove to remove a node, and Diagram.Nodes.Add to add it again later.

3. Accessing the neighbors of a node can be done by iterating over its OutgoingLinks collection and checking the links’ Destination, and next iterating over IncomingLinks and checking the links’ Origin. Checking the color can be done through the nodes’ Brush property. Use reflection to find out if the brush is a SolidBrush, and then typecast it to access the SolidBrush.Color property.

The Queue class in System.Collections does not require a generic parameter type. If you want to use the generic Queue type, you could use DiagramNode as the queue item type.

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


I love YaBB 1G - SP1!

Posts: 2
Joined: Jan 8th, 2009
Re: Basic node operations
Reply #2 - Jan 9th, 2009 at 1:43am
Print Post  
Thank you big time it helped alot.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint