예제 #1
0
        /// <summary>
        /// Performs the actual layout algorithm.
        /// </summary>
        /// <param name="graph">The object containing the graph data</param>
        /// <param name="selectedNode">selected node</param>
        protected override void PerformLayout(GraphMapData graph, INode selectedNode)
        {
            BidirectionalGraph<string, WeightedEdge<string>> bGraph = GraphSharpUtility.GetBidirectionalGraph(graph);
            IDictionary<string, Vector> nodePositions = GraphSharpUtility.GetNodePositions(graph);
            IDictionary<string, Size> nodeSizes = GraphSharpUtility.GetNodeSizes(graph);
            DoubleTreeLayoutParameters doubleTreeLayoutParameters = new DoubleTreeLayoutParameters();

            DoubleTreeLayoutAlgorithm<string, WeightedEdge<string>, BidirectionalGraph<string, WeightedEdge<string>>> doubleTreeLayoutAlgorithm = new DoubleTreeLayoutAlgorithm<string, WeightedEdge<string>, BidirectionalGraph<string, WeightedEdge<string>>>(bGraph, nodePositions, nodeSizes, doubleTreeLayoutParameters, selectedNode.ID);
            doubleTreeLayoutAlgorithm.Compute();

            GraphSharpUtility.SetNodePositions(graph, doubleTreeLayoutAlgorithm.VertexPositions);
        }
예제 #2
0
        /// <summary>
        /// Performs the actual layout algorithm.
        /// </summary>
        /// <param name="graph">The object containing the graph data</param>
        /// <param name="selectedNode">selected node</param>
        protected override void PerformLayout(GraphMapData graph, INode selectedNode)
        {
            BidirectionalGraph <string, WeightedEdge <string> > bGraph = GraphSharpUtility.GetBidirectionalGraph(graph);
            IDictionary <string, Vector> nodePositions = GraphSharpUtility.GetNodePositions(graph);
            IDictionary <string, Size>   nodeSizes     = GraphSharpUtility.GetNodeSizes(graph);
            DoubleTreeLayoutParameters   doubleTreeLayoutParameters = new DoubleTreeLayoutParameters();

            DoubleTreeLayoutAlgorithm <string, WeightedEdge <string>, BidirectionalGraph <string, WeightedEdge <string> > > doubleTreeLayoutAlgorithm = new DoubleTreeLayoutAlgorithm <string, WeightedEdge <string>, BidirectionalGraph <string, WeightedEdge <string> > >(bGraph, nodePositions, nodeSizes, doubleTreeLayoutParameters, selectedNode.ID);

            doubleTreeLayoutAlgorithm.Compute();

            GraphSharpUtility.SetNodePositions(graph, doubleTreeLayoutAlgorithm.VertexPositions);
        }
예제 #3
0
        /// <summary>
        /// Nodes frequently overlap edges. Pretty useless.
        /// </summary>
        /// <returns></returns>
        private IDictionary <string, Point> Create5()
        {
            DoubleTreeLayoutParameters params5;
            DoubleTreeLayoutAlgorithm <string, Edge <string>, BidirectionalGraph <string, Edge <string> > > algo5;

            params5                     = new DoubleTreeLayoutParameters();
            params5.Direction           = LayoutDirection.LeftToRight;
            params5.LayerGap            = MinimumStateDistance;
            params5.PrioritizedTreeSide = DoubleTreeSides.Side2;
            params5.VertexGap           = MinimumStateDistance;
            algo5 = new DoubleTreeLayoutAlgorithm <string, Edge <string>, BidirectionalGraph <string, Edge <string> > >(
                graph, Create4(), vertexSizes, params5, vertexLabels[0]);
            algo5.Compute();

            return(algo5.VertexPositions);
        }