Example #1
0
 ///<summary>
 ///</summary>
 ///<param name="subgraph"></param>
 public void AddSubgraph(Subgraph subgraph)
 {
     if (subgraph.ParentSubgraph != null)
     {
         subgraph.ParentSubgraph.RemoveSubgraph(subgraph);
     }
     subgraph.ParentSubgraph = this;
     subgraphs.Insert(subgraph);
     IsUpdated = true;
 }
Example #2
0
        Cluster ProcessSubGraphs(Subgraph subgraph)
        {
            var geomCluster = new Cluster(subgraph.Nodes.Select(n => nodeMapping[n]),
                                          subgraph.Subgraphs.Select(ProcessSubGraphs));

            foreach (Cluster sub in geomCluster.Clusters)
            {
                sub.GeometryParent = geomCluster;
            }
            subgraph.GeometryNode = geomCluster;
            geomCluster.UserData  = subgraph;
            nodeMapping[subgraph] = geomCluster;
            return(geomCluster);
        }
Example #3
0
        void WriteSubgraph(Subgraph subgraph)
        {
            WriteStartElement(Tokens.Subgraph);
            var subgraphsString = String.Join(" ", subgraph.Subgraphs.Select(s => s.Id));

            WriteAttribute(Tokens.listOfSubgraphs, subgraphsString);
            var nodesString = String.Join(" ", subgraph.Nodes.Select(s => s.Id));

            WriteAttribute(Tokens.listOfNodes, nodesString);
            if (subgraph.UserData != null)
            {
                WriteUserData(subgraph.UserData);
            }
            WriteNodeAttr(subgraph.Attr);
            WriteLabel(subgraph.Label);
            WriteEndElement();
        }
Example #4
0
        Subgraph ReadSubgraphContent()
        {
            object userData = null;

            if (TokenIs(Tokens.UserData))
            {
                userData = ReadUserData();
            }
            var nodeAttr = new NodeAttr();

            ReadNodeAttr(nodeAttr);
            var subgraph = new Subgraph(nodeAttr.Id)
            {
                Label = null, Attr = nodeAttr, UserData = userData
            };

            ReadLabel(subgraph);
            ReadEndElement();
            return(subgraph);
        }
Example #5
0
 ///<summary>
 ///</summary>
 ///<param name="subgraph"></param>
 public void RemoveSubgraph(Subgraph subgraph)
 {
     subgraphs.Remove(subgraph);
     subgraph.ParentSubgraph = null;
     IsUpdated = true;
 }