List <Point> ExpandRouteRecursive(List <Point> route) { route = new List <Point>(route); List <Point> result = new List <Point>(); result.Add(route[0]); for (int i = 0; i < route.Count - 1; i++) { var routeForSegment = RoutingAlgorithm.GrahamScan( route[i], route[i + 1], Polygon); if (routeForSegment.Count == 2) { result.Add(route[i + 1]); } else if (routeForSegment.Count > 2) { for (int j = 1; j < routeForSegment.Count; j++) { result.Add(routeForSegment[j]); } } else { result.Add(route[i + 1]); } } return(result); }
public static List <Point> Apply(RoutingAlgorithm algorithm) { var result = algorithm.ShortestRoute(); result = RemoveRedundantSegments(result); return(result); }
public override void GetPoints(List <Point> list) { var start = Point(0); var end = Point(1); Polygon polygon = (Polygon)Dependencies.ElementAt(2); var points = polygon.Dependencies.ToPoints(); var polyline = RoutingAlgorithm.Dijkstra(start, end, new List <Point>(points)); list.AddRange(polyline); }
private void UpdateConfigurationFromText() { var lines = text.Text.Split('\n', '\r') .Where(s => !string.IsNullOrEmpty(s)).ToArray(); if (lines == null || lines.Length < 3) { return; } RoutingAlgorithm algorithm = new RoutingAlgorithm(); algorithm.ParseInput(lines[0], lines[1], lines[2]); CreateConfiguration(algorithm.Start, algorithm.End, algorithm.Polygon); CurrentDrawing.Recalculate(); }
public static List<Point> Apply(RoutingAlgorithm algorithm) { var result = algorithm.ShortestRoute(); result = RemoveRedundantSegments(result); return result; }
private void UpdateConfigurationFromText(string text) { var lines = text.Split('\n', '\r') .Where(s => !string.IsNullOrEmpty(s)).ToArray(); if (lines == null || lines.Length < 3) { return; } RoutingAlgorithm algorithm = new RoutingAlgorithm(); algorithm.ParseInput(lines[0], lines[1], lines[2]); CreateConfiguration(algorithm.Start, algorithm.End, algorithm.Polygon); }