コード例 #1
0
        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);
        }
コード例 #2
0
        public static List <Point> Apply(RoutingAlgorithm algorithm)
        {
            var result = algorithm.ShortestRoute();

            result = RemoveRedundantSegments(result);
            return(result);
        }
コード例 #3
0
ファイル: Route.cs プロジェクト: molihub/LiveGeometry
        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);
        }
コード例 #4
0
ファイル: Page.xaml.cs プロジェクト: 15831944/Code_OpenSource
        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();
        }
コード例 #5
0
 public static List<Point> Apply(RoutingAlgorithm algorithm)
 {
     var result = algorithm.ShortestRoute();
     result = RemoveRedundantSegments(result);
     return result;
 }
コード例 #6
0
ファイル: Page.xaml.cs プロジェクト: wcatykid/GeoShader
 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);
 }