Exemplo n.º 1
0
        private static void ProcessPhyloEdges(Graph graph, Microsoft.Msagl.GeometryGraph msaglGraph)
        {
            foreach (Edge e in graph.Edges)
            {
                Microsoft.Msagl.Node sourceNode = msaglGraph.FindNode(e.Source);
                Microsoft.Msagl.Node targetNode = msaglGraph.FindNode(e.Target);

                if (sourceNode == null)
                {
                    sourceNode = CreateGeometryNode(msaglGraph, graph.FindNode(e.Source) as Node, Connection.Connected);
                }
                if (targetNode == null)
                {
                    targetNode = CreateGeometryNode(msaglGraph, graph.FindNode(e.Target) as Node, Connection.Connected);
                }

                Microsoft.Msagl.Edge msaglEdge = new Microsoft.Msagl.PhyloEdge(sourceNode, targetNode);
                msaglEdge.Weight            = e.Attr.Weight;
                msaglEdge.Separation        = e.Attr.Separation;
                msaglEdge.ArrowheadAtSource = e.Attr.ArrowAtSource;
                msaglEdge.ArrowheadAtTarget = e.Attr.ArrowAtTarget;
                msaglGraph.AddEdge(msaglEdge);
                msaglEdge.UserData        = e;
                msaglEdge.ArrowheadLength = e.Attr.ArrowheadLength;
                msaglEdge.LineWidth       = e.Attr.LineWidth;
            }
        }
Exemplo n.º 2
0
        private static void ProcessEdges(Graph graph, Microsoft.Msagl.GeometryGraph msaglGraph)
        {
            foreach (Edge drawingEdge in graph.Edges)
            {
                Microsoft.Msagl.Node sourceNode = msaglGraph.FindNode(drawingEdge.Source);
                Microsoft.Msagl.Node targetNode = msaglGraph.FindNode(drawingEdge.Target);

                if (sourceNode == null)
                {
                    sourceNode = CreateGeometryNode(msaglGraph, graph.FindNode(drawingEdge.Source) as Node, Connection.Connected);
                }
                if (targetNode == null)
                {
                    targetNode = CreateGeometryNode(msaglGraph, graph.FindNode(drawingEdge.Target) as Node, Connection.Connected);
                }

                Microsoft.Msagl.Edge msaglEdge = new Microsoft.Msagl.Edge(sourceNode, targetNode);
                if (drawingEdge.Label != null && graph.LayoutAlgorithmSettings is SugiyamaLayoutSettings)
                {
                    msaglEdge.Label        = drawingEdge.Label.GeometryLabel;
                    msaglEdge.Label.Parent = msaglEdge;
                }
                msaglEdge.Weight            = drawingEdge.Attr.Weight;
                msaglEdge.Length            = drawingEdge.Attr.Length;
                msaglEdge.Separation        = drawingEdge.Attr.Separation;
                msaglEdge.ArrowheadAtSource = drawingEdge.Attr.ArrowAtSource;
                msaglEdge.ArrowheadAtTarget = drawingEdge.Attr.ArrowAtTarget;
                msaglGraph.AddEdge(msaglEdge);
                msaglEdge.UserData        = drawingEdge;
                msaglEdge.ArrowheadLength = drawingEdge.Attr.ArrowheadLength;
                msaglEdge.LineWidth       = drawingEdge.Attr.LineWidth;
            }
        }