private void DebugVCP() { graph.LogicCore.DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.KK; var dataVertex = new DataVertex("MyVertex 1") { VisualDiameter = 20 }; graph.LogicCore.Graph.AddVertex(dataVertex); dataVertex = new DataVertex("MyVertex 2") { VisualDiameter = 20 }; graph.LogicCore.Graph.AddVertex(dataVertex); var vlist = graph.LogicCore.Graph.Vertices.ToList(); AddEdge((GraphExample)graph.LogicCore.Graph, 0, 1, vlist); graph.LogicCore.Graph.Edges.Last().SourceConnectionPointId = 1; graph.LogicCore.Graph.Edges.Last().TargetConnectionPointId = 1; graph.GenerateGraphAsync(); }
private GraphExample GraphExample_Setup() { var dataGraph = new GraphExample(); var vlist = new List <DataVertex>();; //debug /* dataGraph.AddVertex(new DataVertex("MyVertex " + 1) { ID = 1, VisualDiameter = 10, VisualInnerDiameter = 10 }); * dataGraph.AddVertex(new DataVertex("MyVertex " + 2) { ID = 2, VisualDiameter = 10, VisualInnerDiameter = 10 }); * vlist = dataGraph.Vertices.ToList(); * AddEdge(dataGraph, 0, 1, vlist); * return dataGraph;*/ switch ((LayoutAlgorithmTypeEnum)cboxLayout.SelectedItem) { case LayoutAlgorithmTypeEnum.EfficientSugiyama: case LayoutAlgorithmTypeEnum.Sugiyama: case LayoutAlgorithmTypeEnum.BoundedFR: case LayoutAlgorithmTypeEnum.FR: case LayoutAlgorithmTypeEnum.Tree: for (int i = 1; i < 14; i++) { var dataVertex = new DataVertex("MyVertex " + i) { ID = i, VisualDiameter = _rnd.Next(25, 50), VisualInnerDiameter = _rnd.Next(10, 22) }; dataGraph.AddVertex(dataVertex); } vlist = dataGraph.Vertices.ToList(); AddEdge(dataGraph, 0, 1, vlist); AddEdge(dataGraph, 0, 0, vlist); AddEdge(dataGraph, 0, 2, vlist); AddEdge(dataGraph, 1, 3, vlist); AddEdge(dataGraph, 1, 4, vlist); AddEdge(dataGraph, 2, 5, vlist); AddEdge(dataGraph, 2, 6, vlist); AddEdge(dataGraph, 2, 7, vlist); AddEdge(dataGraph, 8, 9, vlist); AddEdge(dataGraph, 9, 10, vlist); AddEdge(dataGraph, 10, 7, vlist); AddEdge(dataGraph, 10, 11, vlist); AddEdge(dataGraph, 10, 12, vlist); break; default: for (var i = 1; i < 11; i++) { var dataVertex = new DataVertex("MyVertex " + i) { ID = i, VisualDiameter = _rnd.Next(50, 100), VisualInnerDiameter = _rnd.Next(20, 45) }; if (i == 2) { dataVertex.LabelText += "\nMultiline!"; } dataGraph.AddVertex(dataVertex); } vlist = dataGraph.Vertices.ToList(); AddEdge(dataGraph, 0, 1, vlist); AddEdge(dataGraph, 1, 2, vlist); AddEdge(dataGraph, 1, 3, vlist); AddEdge(dataGraph, 1, 4, vlist); AddEdge(dataGraph, 4, 5, vlist); AddEdge(dataGraph, 4, 6, vlist); AddEdge(dataGraph, 2, 7, vlist); AddEdge(dataGraph, 2, 8, vlist); AddEdge(dataGraph, 8, 9, vlist); //add some cross references AddEdge(dataGraph, 4, 2, vlist); AddEdge(dataGraph, 4, 8, vlist); AddEdge(dataGraph, 9, 2, vlist); break; } /* foreach (var item in graph.EdgesList) * { * //item.Value.LabelVerticalOffset = -40; * item.Value.LabelAngle = 45; * }*/ return(dataGraph); /*ManipulationDelta += MainPage_ManipulationDelta; * ManipulationMode = ManipulationModes.Scale; * * for (int i = 1; i < 10; i++) * { * var dataVertex = new DataVertex("MyVertex " + i) { ID = i }; * dataGraph.AddVertex(dataVertex); * } * * var vlist = dataGraph.Vertices.ToList(); * //var dataEdge = new DataEdge(vlist[0], vlist[1]) { Text = string.Format("{0} -> {1}", vlist[0], vlist[1]) }; * //dataGraph.AddEdge(dataEdge); * var dataEdge = new DataEdge(vlist[2], vlist[3]) { Text = "23" }; * dataGraph.AddEdge(dataEdge); * dataEdge = new DataEdge(vlist[3], vlist[2]) { Text = "32" }; * dataGraph.AddEdge(dataEdge); * * return dataGraph;*/ }
private DataVertex DebugCreateVertex(string name) { var x = new DataVertex(name) { VisualDiameter = 20 }; graph.LogicCore.Graph.AddVertex(x); return x; }
private GraphExample GraphExample_Setup() { var dataGraph = new GraphExample(); var vlist = new List<DataVertex>();; //debug /* dataGraph.AddVertex(new DataVertex("MyVertex " + 1) { ID = 1, VisualDiameter = 10, VisualInnerDiameter = 10 }); dataGraph.AddVertex(new DataVertex("MyVertex " + 2) { ID = 2, VisualDiameter = 10, VisualInnerDiameter = 10 }); vlist = dataGraph.Vertices.ToList(); AddEdge(dataGraph, 0, 1, vlist); return dataGraph;*/ switch ((LayoutAlgorithmTypeEnum)cboxLayout.SelectedItem) { case LayoutAlgorithmTypeEnum.EfficientSugiyama: case LayoutAlgorithmTypeEnum.Sugiyama: case LayoutAlgorithmTypeEnum.BoundedFR: case LayoutAlgorithmTypeEnum.FR: case LayoutAlgorithmTypeEnum.Tree: for (int i = 1; i < 14; i++) { var dataVertex = new DataVertex("MyVertex " + i) { ID = i, VisualDiameter = _rnd.Next(25, 50), VisualInnerDiameter = _rnd.Next(10, 22) }; dataGraph.AddVertex(dataVertex); } vlist = dataGraph.Vertices.ToList(); AddEdge(dataGraph, 0, 1, vlist); AddEdge(dataGraph, 0, 0, vlist); AddEdge(dataGraph, 0, 2, vlist); AddEdge(dataGraph, 1, 3, vlist); AddEdge(dataGraph, 1, 4, vlist); AddEdge(dataGraph, 2, 5, vlist); AddEdge(dataGraph, 2, 6, vlist); AddEdge(dataGraph, 2, 7, vlist); AddEdge(dataGraph, 8, 9, vlist); AddEdge(dataGraph, 9, 10, vlist); AddEdge(dataGraph, 10, 7, vlist); AddEdge(dataGraph, 10, 11, vlist); AddEdge(dataGraph, 10, 12, vlist); break; default: for (var i = 1; i < 11; i++) { var dataVertex = new DataVertex("MyVertex " + i) { ID = i, VisualDiameter = _rnd.Next(50, 100), VisualInnerDiameter = _rnd.Next(20, 45) }; if (i == 2) dataVertex.LabelText += "\nMultiline!"; dataGraph.AddVertex(dataVertex); } vlist = dataGraph.Vertices.ToList(); AddEdge(dataGraph, 0, 1, vlist); AddEdge(dataGraph, 1, 2, vlist); AddEdge(dataGraph, 1, 3, vlist); AddEdge(dataGraph, 1, 4, vlist); AddEdge(dataGraph, 4, 5, vlist); AddEdge(dataGraph, 4, 6, vlist); AddEdge(dataGraph, 2, 7, vlist); AddEdge(dataGraph, 2, 8, vlist); AddEdge(dataGraph, 8, 9, vlist); //add some cross references AddEdge(dataGraph, 4, 2, vlist); AddEdge(dataGraph, 4, 8, vlist); AddEdge(dataGraph, 9, 2, vlist); break; } /* foreach (var item in graph.EdgesList) { //item.Value.LabelVerticalOffset = -40; item.Value.LabelAngle = 45; }*/ return dataGraph; /*ManipulationDelta += MainPage_ManipulationDelta; ManipulationMode = ManipulationModes.Scale; for (int i = 1; i < 10; i++) { var dataVertex = new DataVertex("MyVertex " + i) { ID = i }; dataGraph.AddVertex(dataVertex); } var vlist = dataGraph.Vertices.ToList(); //var dataEdge = new DataEdge(vlist[0], vlist[1]) { Text = string.Format("{0} -> {1}", vlist[0], vlist[1]) }; //dataGraph.AddEdge(dataEdge); var dataEdge = new DataEdge(vlist[2], vlist[3]) { Text = "23" }; dataGraph.AddEdge(dataEdge); dataEdge = new DataEdge(vlist[3], vlist[2]) { Text = "32" }; dataGraph.AddEdge(dataEdge); return dataGraph;*/ }