Пример #1
0
        private void ShowAlgorithm(bool randomize)
        {
            if (!_isInitialized || _manager == null)
            {
                return;
            }
            object item = AlgorithmCombo.SelectedItem;

            string message = null, general =
                "Source is blue diamond, node costs are green numbers, black is impassable.";

            if (item == AStarAlgorithm)
            {
                message = _manager.ShowAStar() ?
                          "Red squares indicate best path from source to marked target node." :
                          "Could find no connecting path due to impassable random terrain.";
            }
            else if (item == CoverageAlgorithm)
            {
                message = _manager.ShowCoverage(randomize) ?
                          "Red squares indicate reachable nodes with a maximum path cost of 10." :
                          "Could find no reachable locations due to impassable random terrain.";
            }
            else if (item == FloodFillAlgorithm)
            {
                message = _manager.ShowFloodFill(randomize) ?
                          "Red squares indicate connected nodes with up to 1/2 maximum node cost." :
                          "Cound find no matching locations due to impassable random terrain.";
            }
            else if (item == VisibilityAlgorithm)
            {
                message = _manager.ShowVisibility(randomize) ?
                          "Red squares indicate visible nodes. Impassable nodes block the view." :
                          "Cound find no visible locations due to obscuring random terrain.";
            }

            Description.Text             = String.Format("{0}\n{1}", general, message);
            RandomSourceButton.IsEnabled = (item != AStarAlgorithm);
            ThresholdUpDown.Enabled      = (item == VisibilityAlgorithm);
        }