Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Programatically Create Links b/w ShapeNodes (Read 1650 times)
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Programatically Create Links b/w ShapeNodes
Feb 16th, 2009 at 6:13am
Print Post  
Hi,

UseCase: Lets assume that we have 3 shapeNode linked sequentially, if i delete middle shapeNode,can we link programatically first Node to Last Node.

thanks in advance

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Programatically Create Links b/w ShapeNodes
Reply #1 - Feb 16th, 2009 at 8:40am
Print Post  
Hi,

Code
Select All
private void RemoveFromSequence(ShapeNode node)
{
	DiagramNode pred = node.IncomingLinks.Count > 0 ?
		node.IncomingLinks[0].Origin : null;
	DiagramNode succ = node.OutgoingLinks.Count > 0 ?
		node.OutgoingLinks[0].Destination : null;

	diagram.Nodes.Remove(node);

	if (pred != null && succ != null)
		diagram.Factory.CreateDiagramLink(pred, succ);
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
SandeepGowda
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 50
Joined: Jan 6th, 2009
Re: Programatically Create Links b/w ShapeNodes
Reply #2 - Feb 20th, 2009 at 3:26pm
Print Post  
Hi,
    1         2
        3
    4         5
   
    lets assume.   

     Task 1 has outgoing to Task 3
     Task 2 has outgoing to Task 3
     Task 3 has outgoing to Task 4
     Task 3 has outgoing to Task 5

if task 3 is deleted,
     1         2
        
    4         5
   
     Task 1 has outgoing to Task 4
     Task 2 has outgoing to Task 5
     Task 1 has outgoing to Task 5
     Task 2 has outgoing to Task 5

How easily programatically links can be created from above usecase.

regards
sandeep

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Programatically Create Links b/w ShapeNodes
Reply #3 - Feb 20th, 2009 at 3:41pm
Print Post  
Should look like this:

Code
Select All
foreach (DiagramLink incl in node.IncomingLinks)
	foreach (DiagramLink outl in node.OutgoingLinks)
		diagram.Factory.CreateDiagramLink(incl.Origin, outl.Destination);

diagram.Nodes.Remove(node);
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint