static void Main(string[] args) { //var path = AppDomain.CurrentDomain.BaseDirectory + @"testfiles\test3.txt"; var path = (AppDomain.CurrentDomain.BaseDirectory + @"Examples\add.gsa").Replace(@"FlowChartBuilder\bin\Debug\netcoreapp3.0\", ""); var list = TextFileParser.ParseText(path);//.Replace(@"FlowChartBuilder\bin\Debug\netcoreapp3.0\", "")); var grid = new BlockDistributor(list); grid.PrintGrid(); grid.RemoveEmptyLines(); grid.PrintGrid(); grid.SetNodesPositions(); grid.PrintGrid(); var graph = new GraphMaker(grid.GetNodes(), grid.GetGrid());; Stopwatch sw = new Stopwatch(); sw.Start(); graph.LineCreator(); sw.Stop(); Console.WriteLine("ElapsedTotal={0}", sw.Elapsed); graph.RemoveMiddlePointsFromLines(); Console.ReadKey(); }
public MainWindow() { InitializeComponent(); this.Vectors = new List <VectorModel>(); BrushesArray = new Brush[80]; for (int i = 0; i < 80; i++) { BrushesArray[i] = PickBrush(); } //var path = AppDomain.CurrentDomain.BaseDirectory + @"testfiles\test3.txt"; var path = (AppDomain.CurrentDomain.BaseDirectory + @"Examples\and.gsa").Replace(@"UI\bin\Debug\netcoreapp3.1\", ""); var list = TextFileParser.ParseText(path);//.Replace(@"UI\bin\Debug\netcoreapp3.1\", "")); var grid = new BlockDistributor(list); grid.RemoveEmptyLines(); grid.PrintGrid(); grid.SetNodesPositions(); var graph = new GraphMaker(grid.GetNodes(), grid.GetGrid()); Stopwatch sw = new Stopwatch(); sw.Start(); graph.LineCreator(); sw.Stop(); Console.WriteLine("ElapsedTotal={0}", sw.Elapsed); graph.RemoveMiddlePointsFromLines(); this.Lines = graph.GetLines(); this.Nodes = graph.GetNodes(); int id = 1; foreach (var line in Lines) { var points = line.GetPointsOfLine(); for (int i = 0; i < points.Count - 1; i++) { Vectors.Add(new VectorModel(new Coordinates(points[i].x * _multiplier, points[i].y * _multiplier), new Coordinates(points[i + 1].x * _multiplier, points[i + 1].y * _multiplier), id)); } id++; } this.Vectors = this.Vectors.Where(x => x.Id <= 100).ToList(); this.Recheck = new Queue <VectorModel>(); foreach (var vector in Vectors) { AddLine(vector); } while (this.Recheck.Count != 0) { var recheck = this.Recheck.Dequeue(); if (recheck.GetChangeNumber() < 5) { recheck.AddChange(); AddLine(recheck); } } foreach (var vector in Vectors) { DrawVector(vector); } foreach (var node in Nodes) { AddBlock(node.GetPosition().y, node.GetPosition().x, node.GetId(), node.GetType()); } }