2024-10-03 01:42:04 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using ProjectGasolineTanker.Drawings;
|
|
|
|
|
using ProjectGasolineTanker.MovementStratg;
|
|
|
|
|
|
|
|
|
|
namespace ProjectGasolineTanker.Generic
|
|
|
|
|
{
|
|
|
|
|
internal class TruckGenericStorage
|
|
|
|
|
{
|
|
|
|
|
readonly Dictionary<string, TruckGenericCollection<DrawingTruck, DrawingObjectTruck>> _TruckStorages;
|
|
|
|
|
public List<string> Keys => _TruckStorages.Keys.ToList();
|
|
|
|
|
private readonly int _pictureWidth;
|
|
|
|
|
private readonly int _pictureHeight;
|
|
|
|
|
|
|
|
|
|
public TruckGenericStorage(int pictureWidth, int pictureHeight)
|
|
|
|
|
{
|
|
|
|
|
_TruckStorages = new Dictionary<string, TruckGenericCollection<DrawingTruck, DrawingObjectTruck>>();
|
|
|
|
|
_pictureWidth = pictureWidth;
|
|
|
|
|
_pictureHeight = pictureHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddSet(string name)
|
|
|
|
|
{
|
|
|
|
|
foreach (string nameStorage in Keys)
|
|
|
|
|
{
|
|
|
|
|
if (nameStorage == name)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Набор с заданным именем уже занят", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_TruckStorages.Add(name, new TruckGenericCollection<DrawingTruck, DrawingObjectTruck>(_pictureWidth, _pictureHeight));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DelSet(string name)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (_TruckStorages.ContainsKey(name))
|
|
|
|
|
{
|
|
|
|
|
_TruckStorages.Remove(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TruckGenericCollection<DrawingTruck, DrawingObjectTruck>? this[string ind]
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2024-10-03 01:43:12 +04:00
|
|
|
|
// TODO Продумать логику получения набора
|
2024-10-03 01:42:04 +04:00
|
|
|
|
if (_TruckStorages.ContainsKey(ind))
|
|
|
|
|
{
|
|
|
|
|
return _TruckStorages[ind];
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|