Ejemplo n.º 1
0
 public void UpdateMap(IOutputService output, int selectedCurrentPathIndex = -1)
 {
     if (output != null)
     {
         CurrentState = output;
         if (output.CurrentIteration == 1 && CurrentPaths.Count == 2)
         {
             GenerateTemporaryPathsNamesToComboBox(output.CurrentPaths.Count);
         }
         _mapControl.LoadMapView(Map);
         if (ShowPheromones)
         {
             _mapControl.UpdatePheromones(output.Pheromones);
         }
         if (ShowBestPath)
         {
             _mapControl.UpdateBestPath(output.BestPath);
         }
         CurrentIteration = output.CurrentIteration;
         if (selectedCurrentPathIndex == -1)
         {
             selectedCurrentPathIndex = CurrentPaths.IndexOf(SelectedCurrentPath);
         }
         _mapControl.UpdateCurrentPaths(output.CurrentPaths, selectedCurrentPathIndex);
     }
 }
Ejemplo n.º 2
0
 private void SelectedCurrentPathPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "SelectedCurrentPath")
     {
         //Console.WriteLine("A property has changed: " + CurrentPaths.IndexOf(SelectedCurrentPath));
         UpdateMap(CurrentState, CurrentPaths.IndexOf(SelectedCurrentPath));
     }
 }
Ejemplo n.º 3
0
 private void GenerateTemporaryPathsNamesToComboBox(int numberOfPaths)
 {
     for (int i = 0; i < numberOfPaths; i++)
     {
         CurrentPaths.Add(new ComboBoxItem {
             Content = 1 + i + ". Mrówka "
         });
     }
 }
Ejemplo n.º 4
0
 internal void Reset()
 {
     SelectedCurrentPath = CurrentPaths.ElementAt(0);
     for (int i = 2; i < CurrentPaths.Count;)
     {
         CurrentPaths.RemoveAt(i);
     }
     LoadMap();
     NumOfSteps       = 1;
     CurrentIteration = 0;
 }