Exemplo n.º 1
0
 private void CreateInitialGraph(DGraph dgraph)
 {
     var nodeA0 = dgraph.AddNode("A0");
     dgraph.AddNode("A1");
     dgraph.AddNode("A2");
     var nodeA3 = dgraph.AddNode("A3");
     nodeA0.Node.Attr.Shape = Microsoft.Msagl.Drawing.Shape.Box;
     nodeA0.Node.Attr.XRadius = 5.0;
     nodeA0.Node.Attr.YRadius = 5.0;
     var edgeA0A1 = dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A0"], dgraph.NodeMap["A1"]);
     dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A0"], dgraph.NodeMap["A2"]);
     dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A2"], dgraph.NodeMap["A1"]);
     dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A0"], dgraph.NodeMap["A3"]);
     nodeA0.Label = new DTextLabel(nodeA0, new Microsoft.Msagl.Drawing.Label()) { Text = "Node A0" };
     nodeA3.Label = new DTextLabel(nodeA3, new Microsoft.Msagl.Drawing.Label()) { Text = "Node A3" };
     edgeA0A1.Label = new DTextLabel(edgeA0A1, new Microsoft.Msagl.Drawing.Label()) { Text = "Edge A0->A1" };
 }
Exemplo n.º 2
0
 private void CreateInitialGraph(DGraph dgraph)
 {
     var nodeA0 = dgraph.AddNode("A0");
     nodeA0.Node.Attr.Shape = Microsoft.Msagl.Drawing.Shape.Box;
     nodeA0.Node.Attr.XRadius = 5.0;
     nodeA0.Node.Attr.YRadius = 5.0;
     nodeA0.Node.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Green;
     nodeA0.Label = new DTextLabel(nodeA0, new Microsoft.Msagl.Drawing.Label()) { Text = "Node A0", Margin = new Thickness(5.0, 2.0, 5.0, 2.0) };
     dgraph.AddNode("A1");
     dgraph.AddNode("A2").Node.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Blue;
     var nodeA3 = dgraph.AddNode("A3");
     var edgeA0A1 = dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A0"], dgraph.NodeMap["A1"]);
     dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A0"], dgraph.NodeMap["A2"]);
     dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A2"], dgraph.NodeMap["A1"]);
     dgraph.AddEdgeBetweenNodes(dgraph.NodeMap["A0"], dgraph.NodeMap["A3"]);
     nodeA3.Label = new DTextLabel(nodeA3, new Microsoft.Msagl.Drawing.Label()) { Text = "Node A3" };
     edgeA0A1.Label = new DTextLabel(edgeA0A1, new Microsoft.Msagl.Drawing.Label()) { Text = "Edge A0->A1" };
     dgraph.Graph.Attr.LayerDirection = Microsoft.Msagl.Drawing.LayerDirection.RL;
 }
Exemplo n.º 3
0
        private void CreateNestedGraph()
        {
            var g = GraphControlForNesting.Graph;

            // Create first nested graph.
            var inner1 = new DGraph() { Name = "Inner 1" };
            var node11 = inner1.AddNode("ID1.1");
            var node12 = inner1.AddNode("ID1.2");
            var edge11_12 = inner1.AddEdgeBetweenNodes(node11, node12);

            // Create second nested graph.
            var inner3 = new DGraph() { Name = "Inner 2" };
            var node31 = inner3.AddNode("ID3.1");
            var node32 = inner3.AddNode("ID3.2");
            var edge31_32 = inner3.AddEdgeBetweenNodes(node31, node32);

            // Create outer graph.
            var node1 = g.AddNode("ID1");
            node1.Label = new DNestedGraphLabel(node1, inner1);
            node1.DrawingNode.Attr.Shape = Microsoft.Msagl.Drawing.Shape.Box;
            var node2 = g.AddNode("ID2");
            var node3 = g.AddNode("ID3");
            node3.Label = new DNestedGraphLabel(node3, inner3);
            node3.DrawingNode.Attr.Shape = Microsoft.Msagl.Drawing.Shape.Box;
            var edge1_2 = g.AddEdgeBetweenNodes(node1, node2);
            var edge2_3 = g.AddEdgeBetweenNodes(node2, node3);

            // Set some labels.
            node11.Label = new DTextLabel(node11) { Text = "Node 1.1" };
            node12.Label = new DTextLabel(node12) { Text = "Node 1.2" };
            node31.Label = new DTextLabel(node31) { Text = "Node 3.1" };
            node32.Label = new DTextLabel(node32) { Text = "Node 3.2" };
            node2.Label = new DTextLabel(node2) { Text = "Node 2" };

            DEdge crossEdge1 = g.AddEdgeBetweenNodes(node11, node3);
            crossEdge1.Label = new DTextLabel(crossEdge1, "cross edge");
            DEdge crossEdge2 = g.AddEdgeBetweenNodes(node12, node31);

            g.BeginLayout();
        }
Exemplo n.º 4
0
        private void Nesting_CreateProliferationGraph(DGraph graph)
        {
            DNode inNode = graph.AddNode("Pr_in");
            inNode.DrawingNode.Attr.Shape = MsaglShape.Circle;
            inNode.DrawingNode.Attr.FillColor = MsaglColor.Red;

            DNode mitosisNode = Nesting_Cell_AddNode(graph, "Pr_mitosis", null);
            Grid mitosisContainer = new Grid();
            mitosisContainer.RowDefinitions.Add(new RowDefinition());
            mitosisContainer.RowDefinitions.Add(new RowDefinition());
            mitosisContainer.Children.Add(new TextBlock() { Text = "Mitosis", TextAlignment = TextAlignment.Center, FontWeight = FontWeights.Bold });
            mitosisNode.Label = new DNestedGraphLabel(mitosisNode, mitosisContainer);
            DGraph mitosisGraph = new DGraph(mitosisNode.Label as DNestedGraphLabel) { Name = "Mitosis" };
            Nesting_CreateMitosisGraph(mitosisGraph);
            Grid.SetRow(mitosisGraph, 1);
            mitosisContainer.Children.Add(mitosisGraph);
            (mitosisNode.Label as DNestedGraphLabel).Graphs.Add(mitosisGraph);

            DNode splitterNode = graph.AddNode("Pr_sp");
            splitterNode.DrawingNode.Attr.Shape = MsaglShape.Circle;
            splitterNode.DrawingNode.Attr.FillColor = MsaglColor.Blue;

            DNode meiosisNode = Nesting_Cell_AddNode(graph, "Pr_meiosis", null);
            Grid meiosisContainer = new Grid();
            meiosisContainer.RowDefinitions.Add(new RowDefinition());
            meiosisContainer.RowDefinitions.Add(new RowDefinition());
            meiosisContainer.Children.Add(new TextBlock() { Text = "Meiosis", TextAlignment = TextAlignment.Center, FontWeight = FontWeights.Bold });
            meiosisNode.Label = new DNestedGraphLabel(meiosisNode, meiosisContainer);
            DGraph meiosisGraph = new DGraph(meiosisNode.Label as DNestedGraphLabel) { Name = "Meiosis" };
            Nesting_CreateMeiosisGraph(meiosisGraph);
            Grid.SetRow(meiosisGraph, 1);
            meiosisContainer.Children.Add(meiosisGraph);
            (meiosisNode.Label as DNestedGraphLabel).Graphs.Add(meiosisGraph);

            Nesting_Cell_AddEdge(graph, inNode, mitosisNode, null);
            Nesting_Cell_AddEdge(graph, mitosisNode, splitterNode, "Early Meiosis");

            DEdge splitter_g0_edge = graph.AddEdgeBetweenNodes(splitterNode, mitosisGraph.NodeMap["Mi_g0"]);
            splitter_g0_edge.DrawingEdge.Attr.Color = MsaglColor.Red;
            DEdge splitter_inter_edge = graph.AddEdgeBetweenNodes(splitterNode, meiosisGraph.NodeMap["Me_inter"]);
            splitter_inter_edge.DrawingEdge.Attr.Color = MsaglColor.Red;//*/
        }
Exemplo n.º 5
0
        private void Nesting_CreateMeiosisGraph(DGraph graph)
        {
            DNode interNode = Nesting_Cell_AddNode(graph, "Me_inter", "Inter");
            DNode restNode = Nesting_Cell_AddNode(graph, "Me_rest", "Rest");

            DNode cycleNode = Nesting_Cell_AddNode(graph, "Me_cycle", null);
            DGraph cycleGraph = new DGraph() { Name = "Meiosis Cycle" };
            cycleGraph.ConfigureSugiyamaLayout(Math.PI / 2.0);
            DNode c_Pro_Node = Nesting_Cell_AddNode(cycleGraph, "Me_cycle_Pro", "Pro");
            DNode c_Meta_Node = Nesting_Cell_AddNode(cycleGraph, "Me_cycle_Meta", "Meta");
            DNode c_Ana_Node = Nesting_Cell_AddNode(cycleGraph, "Me_cycle_Ana", "Ana");
            DNode c_Telo_Node = Nesting_Cell_AddNode(cycleGraph, "Me_cycle_Telo", "Telo");
            Nesting_Cell_AddEdge(cycleGraph, c_Pro_Node, c_Meta_Node, null);
            Nesting_Cell_AddEdge(cycleGraph, c_Meta_Node, c_Ana_Node, null);
            Nesting_Cell_AddEdge(cycleGraph, c_Ana_Node, c_Telo_Node, null);
            cycleNode.Label = new DNestedGraphLabel(cycleNode, cycleGraph);

            Nesting_Cell_AddEdge(graph, cycleNode, interNode, "exit cell\ncycle");
            Nesting_Cell_AddEdge(graph, cycleNode, restNode, null);

            DEdge inter_pro_edge = graph.AddEdgeBetweenNodes(interNode, c_Pro_Node);
            inter_pro_edge.DrawingEdge.Attr.Color = MsaglColor.Red;//*/
        }
Exemplo n.º 6
0
        private void Nesting_CreateMitosisGraph(DGraph graph)
        {
            DNode inNode = graph.AddNode("Mi_in");
            inNode.DrawingNode.Attr.Shape = MsaglShape.Circle;
            inNode.DrawingNode.Attr.FillColor = MsaglColor.Red;
            DNode g0Node = Nesting_Cell_AddNode(graph, "Mi_g0", "G0");

            DNode cycleNode = Nesting_Cell_AddNode(graph, "Mi_cycle", null);
            DGraph cycleGraph = new DGraph() { Name = "Mitosis Cycle" };
            cycleGraph.ConfigureIncrementalLayout();
            DNode c_G1_Node = Nesting_Cell_AddNode(cycleGraph, "Mi_cycle_G1", "G1");
            DNode c_S_Node = Nesting_Cell_AddNode(cycleGraph, "Mi_cycle_S", "S");
            DNode c_G2_Node = Nesting_Cell_AddNode(cycleGraph, "Mi_cycle_G2", "G2");
            DNode c_M_Node = Nesting_Cell_AddNode(cycleGraph, "Mi_cycle_M", "M");
            Nesting_Cell_AddEdge(cycleGraph, c_G1_Node, c_S_Node, null);
            Nesting_Cell_AddEdge(cycleGraph, c_S_Node, c_G2_Node, null);
            Nesting_Cell_AddEdge(cycleGraph, c_G2_Node, c_M_Node, null);
            cycleNode.Label = new DNestedGraphLabel(cycleNode, cycleGraph);

            Nesting_Cell_AddEdge(graph, cycleNode, g0Node, "exit cell\ncycle");
            Nesting_Cell_AddEdge(graph, inNode, g0Node, null);

            DEdge g0_g1_edge = graph.AddEdgeBetweenNodes(g0Node, c_G1_Node);
            g0_g1_edge.DrawingEdge.Attr.Color = MsaglColor.Red;//*/
        }
Exemplo n.º 7
0
 private DEdge Nesting_Cell_AddEdge(DGraph graph, DNode source, DNode target, string label)
 {
     DEdge ret = graph.AddEdgeBetweenNodes(source, target);
     if (label != null)
         ret.Label = new DTextLabel(ret, label);
     ret.DrawingEdge.Attr.Color = MsaglColor.Red;
     return ret;
 }