Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Unable to generate connectors in mindfusion after parsing xpdl document. (Read 2274 times)
Sivaraj p
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Unable to generate connectors in mindfusion after parsing xpdl document.
Apr 4th, 2013 at 5:47pm
Print Post  
Hi stoyo,
  Below is a code snippet on which I am facing difficulty.
From an xpdl diagram, I have parsed it and I have obtained the shapenodes to mindfusion diagram. But I am unable to generate/draw links between the shapenodes after I did the parsing. Could you please verify the below code and guide me in this?

private void GenerateConnectors(object de)
        {
            string[] strShapesList = new string[6];
            DiagramLink dl = new DiagramLink();
            ShapeNode parent = new ShapeNode();
            ShapeNode child = new ShapeNode();

            strShapesList = (string[])de;

            if (strShapesList[3] == null && strShapesList[4] == null)
            {
                //shpEnd = shpNode;

            }
            else
            {
                if ((diagram1.Nodes.Count > 0))
                {
                    parent.Id = strShapesList[3].ToString().Trim();
                    child.Id = strShapesList[4].ToString().Trim();
                    //if (diagram1.Nodes.Contains(child))
                    //{
                        dl = diagram1.Factory.CreateDiagramLink(parent, child);
                        dl.Text = strShapesList[5].ToString();
                    //}

                }
                diagram1.RouteAllLinks();
            }
        }
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Unable to generate connectors in mindfusion after parsing xpdl document.
Reply #1 - Apr 4th, 2013 at 6:03pm
Print Post  
Hi,

Your parent and child variables refer to entirely new nodes that you haven't added to the diagram, and in such case CreateDiagramLink method will fail. If you have generated some nodes in previous step (e.g. GenerateNodes method) and expect their Id values to correspond to what you have in the strShapesList array, then you can use the FindNodeById method to get references to the correct nodes:

Code
Select All
ShapeNode parent = diagram.FindNodeById(strShapesList[3].ToString().Trim());
ShapeNode child = diagram.FindNodeById(strShapesList[4].ToString().Trim()); 



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


I Love MindFusion!

Posts: 21
Joined: Mar 14th, 2013
Re: Unable to generate connectors in mindfusion after parsing xpdl document.
Reply #2 - Apr 5th, 2013 at 2:39pm
Print Post  
Thanks a lot stoyo..
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint