diff --git a/HoistingCrane/HoistingCrane/FormHoistingCraneConfig.resx b/HoistingCrane/HoistingCrane/FormHoistingCraneConfig.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/HoistingCrane/HoistingCrane/FormHoistingCraneConfig.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/HoistingCrane/HoistingCrane/MapsCollection.cs b/HoistingCrane/HoistingCrane/MapsCollection.cs new file mode 100644 index 0000000..c95f1f2 --- /dev/null +++ b/HoistingCrane/HoistingCrane/MapsCollection.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HoistingCrane +{ + internal class MapsCollection + { + /// + /// Словарь (хранилище) с картами + + readonly Dictionary> _mapStorages; + /// + /// Возвращение списка названий карт + /// + public List Keys => _mapStorages.Keys.ToList(); + /// + /// Ширина окна отрисовки + /// + private readonly int _pictureWidth; + /// + /// Высота окна отрисовки + /// + private readonly int _pictureHeight; + /// + /// Конструктор + /// + /// + /// + public MapsCollection(int pictureWidth, int pictureHeight) + { + _mapStorages = new Dictionary>(); + _pictureWidth = pictureWidth; + _pictureHeight = pictureHeight; + } + /// + /// Добавление карты + /// + /// Название карты + /// Карта + public void AddMap(string name, AbstractMap map) + { + if (Keys.Contains(name)) return; + _mapStorages.Add(name, new(_pictureWidth, _pictureHeight, map)); + } + /// + /// Удаление карты + /// + /// Название карты + public void DelMap(string name) + { + if (_mapStorages.ContainsKey(name)) + { + _mapStorages.Remove(name); + } + } + /// + /// Доступ к парковке + /// + /// + /// + public MapWithSetHoistingCraneGeneric this[string ind] + { + get + { + if (ind != String.Empty) + { + MapWithSetHoistingCraneGeneric value; + if (_mapStorages.TryGetValue(ind, out value)) + { + return value; + } + } + return null; + } + } + } +}