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; + } + } } }