From 4d35cc62f51e155f6cde85d1a3036e1ca04d3d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Wed, 7 Dec 2022 16:40:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MapWithSetLocomotivesGeneric.cs | 4 ++++ .../LocomotivesAdvanced/MapsCollection.cs | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/LocomotivesAdvanced/LocomotivesAdvanced/MapWithSetLocomotivesGeneric.cs b/LocomotivesAdvanced/LocomotivesAdvanced/MapWithSetLocomotivesGeneric.cs index a59a5b9..e8530a6 100644 --- a/LocomotivesAdvanced/LocomotivesAdvanced/MapWithSetLocomotivesGeneric.cs +++ b/LocomotivesAdvanced/LocomotivesAdvanced/MapWithSetLocomotivesGeneric.cs @@ -24,6 +24,10 @@ /// Набор объектов /// private readonly SetLocomotivesGeneric _setLocomotives; + public T GetObject(int index) + { + return _setLocomotives[index]; + } /// /// Карта /// diff --git a/LocomotivesAdvanced/LocomotivesAdvanced/MapsCollection.cs b/LocomotivesAdvanced/LocomotivesAdvanced/MapsCollection.cs index 488cbac..d61ad2d 100644 --- a/LocomotivesAdvanced/LocomotivesAdvanced/MapsCollection.cs +++ b/LocomotivesAdvanced/LocomotivesAdvanced/MapsCollection.cs @@ -68,6 +68,19 @@ return null; } } + public IDrawningObject this[string dictIndex, int objIndex] + { + get + { + if (_mapStorages.ContainsKey(dictIndex)) + { + var selectedDictElement = _mapStorages[dictIndex]; + var selectedObject = selectedDictElement.GetObject(objIndex); + return selectedObject; + } + return null; + } + } } }