示例#1
0
        public static GeometryGraph CreateSimple()
        {
            GeometryGraph graph  = new GeometryGraph();
            var           nodeA0 = new Node();

            graph.Nodes.Add(nodeA0);
            var nodeA1 = new Node();

            graph.Nodes.Add(nodeA1);

            graph.RootCluster.AddChild(nodeA0);
            var cluster = new Cluster();

            graph.RootCluster.AddChild(cluster);
            cluster.AddChild(nodeA1);

            // This is where I add the edge connecting to a cluster.
            var edgeA0cluster = new Edge(nodeA0, cluster);

            edgeA0cluster.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA0.AddOutEdge(edgeA0cluster);
            cluster.AddInEdge(edgeA0cluster);
            graph.Edges.Add(edgeA0cluster);

            return(graph);
        }
示例#2
0
        public static GeometryGraph Create()
        {
            GeometryGraph graph  = new GeometryGraph();
            var           nodeA0 = new Node();

            graph.Nodes.Add(nodeA0);
            var nodeA1 = new Node();

            graph.Nodes.Add(nodeA1);
            var nodeA2 = new Node();

            graph.Nodes.Add(nodeA2);
            var nodeA3 = new Node();

            graph.Nodes.Add(nodeA3);
            var edgeA0A1 = new Edge(nodeA0, nodeA1);

            edgeA0A1.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA0.AddOutEdge(edgeA0A1);
            nodeA1.AddInEdge(edgeA0A1);
            graph.Edges.Add(edgeA0A1);
            var edgeA0A2 = new Edge(nodeA0, nodeA2);

            edgeA0A2.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA0.AddOutEdge(edgeA0A2);
            nodeA2.AddInEdge(edgeA0A2);
            graph.Edges.Add(edgeA0A2);
            var edgeA2A1 = new Edge(nodeA2, nodeA1);

            edgeA2A1.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA2.AddOutEdge(edgeA2A1);
            nodeA1.AddInEdge(edgeA2A1);
            graph.Edges.Add(edgeA2A1);
            var edgeA0A3 = new Edge(nodeA0, nodeA3);

            edgeA0A3.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA0.AddOutEdge(edgeA0A3);
            nodeA3.AddInEdge(edgeA0A3);
            graph.Edges.Add(edgeA0A3);

            graph.RootCluster.AddChild(nodeA0);
            graph.RootCluster.AddChild(nodeA3);
            var cluster = new Cluster();

            graph.RootCluster.AddChild(cluster);
            cluster.AddChild(nodeA1);
            cluster.AddChild(nodeA2);

            // This is where I add the edge connecting to a cluster.
            var edgeA0cluster = new Edge(nodeA0, cluster);

            edgeA0cluster.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA0.AddOutEdge(edgeA0cluster);
            cluster.AddInEdge(edgeA0cluster);
            graph.Edges.Add(edgeA0cluster);

            var nodeA01 = new Node();

            graph.Nodes.Add(nodeA01);
            graph.RootCluster.AddChild(nodeA01);
            var nodeA02 = new Node();

            graph.Nodes.Add(nodeA02);
            graph.RootCluster.AddChild(nodeA02);
            var nodeA03 = new Node();

            graph.Nodes.Add(nodeA03);
            graph.RootCluster.AddChild(nodeA03);
            var edgeA0A01 = new Edge(nodeA0, nodeA01);

            edgeA0A01.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA0.AddOutEdge(edgeA0A01);
            nodeA01.AddInEdge(edgeA0A01);
            graph.Edges.Add(edgeA0A01);
            var edgeA01A02 = new Edge(nodeA01, nodeA02);

            edgeA01A02.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA01.AddOutEdge(edgeA01A02);
            nodeA02.AddInEdge(edgeA01A02);
            graph.Edges.Add(edgeA01A02);
            var edgeA02A03 = new Edge(nodeA02, nodeA03);

            edgeA02A03.EdgeGeometry = new EdgeGeometry()
            {
                TargetArrowhead = new Arrowhead()
            };
            nodeA02.AddOutEdge(edgeA02A03);
            nodeA03.AddInEdge(edgeA02A03);
            graph.Edges.Add(edgeA02A03);

            return(graph);
        }