private void GetGraph(IGraphGeneration wrapper) { var set = TxtVars.Text.Split(','); TxtNumOfSubsets.Text = Math.Pow(2, set.Length).ToString(CultureInfo.InvariantCulture); var sb = new StringBuilder(); sb.Append("digraph{"); sb.AppendLine("graph [ranksep=\"" + TxtDistance.Text + "\", nodesep=\"" + TxtDistance.Text + "\"];"); for (var i = 0; i < Math.Pow(2, set.Length); i++) { var newList = new List <string>(); for (var j = 0; j < set.Length; j++) { var isList = i & (1 << j); if (isList > 0) { newList.Add(set[j]); } } if (newList.Count != set.Length) { PrintLinks(newList, set, sb); } } sb.Append("}"); var output = wrapper.GenerateGraph(sb.ToString(), Enums.GraphReturnType.Png); var img = LoadImage(output); Width = img.Width + 20; Height = img.Height + 20; ImgGraph.Source = LoadImage(output); }
public GraphVizWrapperTests() { _getStartProcessQuery = new GetStartProcessQuery(); var getProcessStartInfoQuery = new GetProcessStartInfoQuery(); var registerLayoutPluginCommand = new RegisterLayoutPluginCommand(getProcessStartInfoQuery, _getStartProcessQuery); _wrapper = new GraphGeneration( _getStartProcessQuery, getProcessStartInfoQuery, registerLayoutPluginCommand); }
/// <summary> /// Initializes a new instance of the <see cref="HomeController"/> class. /// </summary> /// <param name="graphVizWrapper"> /// The graph viz wrapper. /// </param> public HomeController(IGraphGeneration graphVizWrapper) { this.graphVizWrapper = graphVizWrapper; }