Пример #1
0
        void ProcessEdges(GeometryGraph msaglGraph)
        {
            foreach (Edge drawingEdge in drawingGraph.Edges)
            {
                Core.Layout.Node sourceNode = nodeMapping[drawingEdge.SourceNode];
                Core.Layout.Node targetNode = nodeMapping[drawingEdge.TargetNode];

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

                var msaglEdge = CreateGeometryEdgeAndAddItToGeometryGraph(drawingEdge, msaglGraph);
            }
        }
Пример #2
0
        /// <summary>
        ///     a helper function creating a geometry node
        /// </summary>
        /// <param name="drawingGraph"> </param>
        /// <param name="geometryGraph"></param>
        /// <param name="node"></param>
        /// <param name="connection">controls if the node is connected to the graph</param>
        /// <returns></returns>
        public static Core.Layout.Node CreateGeometryNode(Graph drawingGraph, GeometryGraph geometryGraph, Node node,
                                                          ConnectionToGraph connection)
        {
            var geomNode = new Core.Layout.Node();

            if (connection == ConnectionToGraph.Connected)
            {
                geometryGraph.Nodes.Add(geomNode);
            }

            node.GeometryNode = geomNode;

            geomNode.UserData = node;
            geomNode.Padding  = node.Attr.Padding;
            return(geomNode);
        }
Пример #3
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;
            }
        }
        /// <summary>
        ///     a helper function creating a geometry node
        /// </summary>
        /// <param name="drawingGraph"> </param>
        /// <param name="geometryGraph"></param>
        /// <param name="node"></param>
        /// <param name="connection">controls if the node is connected to the graph</param>
        /// <returns></returns>
        public static Core.Layout.Node CreateGeometryNode(Graph drawingGraph, GeometryGraph geometryGraph, Node node,
                                                          ConnectionToGraph connection) {
            var geomNode = new Core.Layout.Node();

            if (connection == ConnectionToGraph.Connected)
                geometryGraph.Nodes.Add(geomNode);

            node.GeometryNode = geomNode;

            geomNode.UserData = node;
            geomNode.Padding = node.Attr.Padding;
            return geomNode;
        }