From 5eeed434a40e59824ca4c945e2403fca80f244de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?10=D0=93=20=D0=95=D0=B3=D0=BE=D1=80=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sun, 25 Dec 2022 12:50:07 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=88=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=BB=D0=B8=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormHoistingCraneConfig.resx | 120 ++++++++++++++++++ HoistingCrane/HoistingCrane/MapsCollection.cs | 80 ++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 HoistingCrane/HoistingCrane/FormHoistingCraneConfig.resx create mode 100644 HoistingCrane/HoistingCrane/MapsCollection.cs 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; + } + } + } +}