コード例 #1
0
ファイル: Page.xaml.cs プロジェクト: molihub/LiveGeometry
        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);
        }
コード例 #2
0
        private RoutingAlgorithm GetAlgorithm()
        {
            RoutingAlgorithm algorithm = null;

            switch (cbmAlgorithm.Text)
            {
            case "A*":
                algorithm = new AStarRoutingAlgorithm();
                break;

            case "Dijkstra":
                algorithm = new DijkstraRoutingAlgorithm();
                break;

            case "Bidirectional":
                algorithm = new BidirectionalRoutingAlgorithm();
                break;

            default:
                break;
            }

            return(algorithm);
        }