Ejemplo n.º 1
0
        void ProcessPhyloEdges(Graph graph, GeometryGraph msaglGraph)
        {
            foreach (Edge e in graph.Edges)
            {
                Core.Layout.Node sourceNode = nodeMapping[e.SourceNode];
                Core.Layout.Node targetNode = nodeMapping[e.TargetNode];

                if (sourceNode == null)
                {
                    sourceNode = CreateGeometryNode(graph, msaglGraph, graph.FindNode(e.Source),
                                                    ConnectionToGraph.Connected);
                    nodeMapping[e.SourceNode] = sourceNode;
                }
                if (targetNode == null)
                {
                    targetNode = CreateGeometryNode(graph, msaglGraph, graph.FindNode(e.Target),
                                                    ConnectionToGraph.Connected);
                    nodeMapping[e.TargetNode] = targetNode;
                }

                Core.Layout.Edge msaglEdge = new Prototype.Phylo.PhyloEdge(sourceNode, targetNode);
                msaglEdge.Weight     = e.Attr.Weight;
                msaglEdge.Separation = e.Attr.Separation;
                if (e.Attr.ArrowAtSource)
                {
                    msaglEdge.EdgeGeometry.SourceArrowhead = new Arrowhead {
                        Length = e.Attr.ArrowheadLength
                    };
                }
                if (e.Attr.ArrowAtTarget)
                {
                    msaglEdge.EdgeGeometry.TargetArrowhead = new Arrowhead {
                        Length = e.Attr.ArrowheadLength
                    };
                }
                msaglGraph.Edges.Add(msaglEdge);
                msaglEdge.UserData  = e;
                msaglEdge.LineWidth = e.Attr.LineWidth;
            }
        }
        void ProcessPhyloEdges(Graph graph, GeometryGraph msaglGraph) {
            foreach (Edge e in graph.Edges) {
                Core.Layout.Node sourceNode = nodeMapping[e.SourceNode];
                Core.Layout.Node targetNode = nodeMapping[e.TargetNode];

                if (sourceNode == null) {
                    sourceNode = CreateGeometryNode(graph, msaglGraph, graph.FindNode(e.Source),
                                                    ConnectionToGraph.Connected);
                    nodeMapping[e.SourceNode] = sourceNode;
                }
                if (targetNode == null) {
                    targetNode = CreateGeometryNode(graph, msaglGraph, graph.FindNode(e.Target),
                                                    ConnectionToGraph.Connected);
                    nodeMapping[e.TargetNode] = targetNode;
                }

                Core.Layout.Edge msaglEdge = new Prototype.Phylo.PhyloEdge(sourceNode, targetNode);
                msaglEdge.Weight = e.Attr.Weight;
                msaglEdge.Separation = e.Attr.Separation;
                if (e.Attr.ArrowAtSource) {
                    msaglEdge.EdgeGeometry.SourceArrowhead = new Arrowhead {Length = e.Attr.ArrowheadLength};
                }
                if (e.Attr.ArrowAtTarget) {
                    msaglEdge.EdgeGeometry.TargetArrowhead = new Arrowhead {Length = e.Attr.ArrowheadLength};
                }
                msaglGraph.Edges.Add(msaglEdge);
                msaglEdge.UserData = e;
                msaglEdge.LineWidth = e.Attr.LineWidth;
            }
        }