diff --git a/Airbus/Airbus/MapWithSetPlanesGeneric.cs b/Airbus/Airbus/MapWithSetPlanesGeneric.cs index 85ac38b..4681c30 100644 --- a/Airbus/Airbus/MapWithSetPlanesGeneric.cs +++ b/Airbus/Airbus/MapWithSetPlanesGeneric.cs @@ -127,12 +127,14 @@ namespace Airbus Brush asphaltBrush = new SolidBrush(Color.DarkGray); Brush marcupBrush = new SolidBrush(Color.White); - g.FillRectangle(concreteBrush, 0, 0, _pictureWidth, _pictureHeight); //заливаем область в цвет бетона + //заливаем область в цвет бетона + g.FillRectangle(concreteBrush, 0, 0, _pictureWidth, _pictureHeight); for(int i = 0; i < _pictureWidth / _placeSizeWidth - 1; i++) { - for(int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j) - {//линия разметки места + //линия разметки места + for (int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j) + { g.DrawLine(pen, i * _placeSizeWidth - 20, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight); } @@ -180,8 +182,6 @@ namespace Airbus //метод прорисовки объеков public void DrawPlanes(Graphics g) { - int position = 0; - int index = 0; int currentWidth = 2; int currentHeight = 7; @@ -189,17 +189,14 @@ namespace Airbus { plane.SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight); plane.DrawningObject(g); - index++; - if(position % 2 == 0) + if(currentWidth != 0) { - position++; currentWidth--; } else { - position = 0; - currentWidth = 1; + currentWidth = 2; currentHeight--; } } diff --git a/Airbus/Airbus/MapsCollection.cs b/Airbus/Airbus/MapsCollection.cs index 5ec8352..b432cea 100644 --- a/Airbus/Airbus/MapsCollection.cs +++ b/Airbus/Airbus/MapsCollection.cs @@ -32,31 +32,15 @@ namespace Airbus //добавление карты public void AddMap(string name, AbstractMap map) { - if (Keys.Contains(name)) - { - MessageBox.Show("Такая карта уже есть"); - return; - } - else - { - var NewElem = new MapWithSetPlanesGeneric( - _pictureWidth, _pictureHeight, map); - _mapStorage.Add(name, NewElem); - } + var NewElem = new MapWithSetPlanesGeneric( + _pictureWidth, _pictureHeight, map); + _mapStorage.Add(name, NewElem); } //удаление карты public void DelMap(string name) { - if (Keys.Contains(name)) - { - _mapStorage.Remove(name); - } - else - { - MessageBox.Show("Такой карты нет"); - return; - } + _mapStorage.Remove(name); } //Доступ к аэродрому @@ -64,13 +48,7 @@ namespace Airbus { get { - if (Keys.Contains(ind)) - { - return _mapStorage[ind]; - } - - MessageBox.Show("Такой карты нет"); - return null; + return _mapStorage[ind]; } } } diff --git a/Airbus/Airbus/SetPlanesGeneric.cs b/Airbus/Airbus/SetPlanesGeneric.cs index 6a5e700..aa457ec 100644 --- a/Airbus/Airbus/SetPlanesGeneric.cs +++ b/Airbus/Airbus/SetPlanesGeneric.cs @@ -83,6 +83,7 @@ namespace Airbus return _places[position]; } + set { if (position < _maxCount && position >= 0)