Exemple #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);
        }
 public DoubleTreeLayoutAlgorithm(TGraph visitedGraph, IDictionary <TVertex, Point> vertexPositions, IDictionary <TVertex, Size> vertexSizes, DoubleTreeLayoutParameters oldParameters, TVertex selectedVertex)
     : base(visitedGraph, vertexPositions, oldParameters)
 {
     root             = selectedVertex;
     this.vertexSizes = (vertexSizes ?? new Dictionary <TVertex, Size>());
 }
        public DoubleTreeLayoutAlgorithm(TGraph visitedGraph, IDictionary <TVertex, Point> vertexPositions, IDictionary <TVertex, Size> vertexSizes, DoubleTreeLayoutParameters oldParameters, TVertex selectedVertex)
            : base(visitedGraph, vertexPositions, oldParameters)
        {
            Contract.Requires(selectedVertex != null);
            Contract.Requires(visitedGraph.ContainsVertex(selectedVertex));

            root             = selectedVertex;
            this.vertexSizes = (vertexSizes ?? new Dictionary <TVertex, Size>());
        }