From 384dd9b1ff7661af0debc5b438ca6cf2b5e59078 Mon Sep 17 00:00:00 2001 From: Anastasia Date: Tue, 15 Nov 2022 12:47:43 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MapWithSetAirplanesGeneric.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/AirplaneWithRadar/AirplaneWithRadar/MapWithSetAirplanesGeneric.cs b/AirplaneWithRadar/AirplaneWithRadar/MapWithSetAirplanesGeneric.cs index 82e92ae..9d064b9 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/MapWithSetAirplanesGeneric.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/MapWithSetAirplanesGeneric.cs @@ -144,17 +144,6 @@ namespace AirplaneWithRadar /// Метод отрисовки фона /// /// - private void DrawHangar(Graphics g, int x, int y, int width, int height) - { - Pen pen = new(Color.Black, 3); - g.DrawLine(pen, x, y, x + width, y); - g.DrawLine(pen, x, y, x, y + height + 20); - g.DrawLine(pen, x, y + height + 20, x + width, y + height + 20); - } - /// - /// Метод отрисовки фона - /// - /// private void DrawBackground(Graphics g) { Pen pen = new(Color.White, 5); @@ -177,11 +166,12 @@ namespace AirplaneWithRadar // TODO установка позиции int numObjectsInRow = _pictureWidth / _placeSizeWidth; int maxLeft = (numObjectsInRow - 1) * _placeSizeWidth; - for (int i = 0; i < _setAirplanes.Count; i++) + int curr = 0; + foreach (var airplane in _setAirplanes.GetAirplanes()) { - var airplane = _setAirplanes[i]; - airplane?.SetObject(maxLeft - i % numObjectsInRow * _placeSizeWidth + 5, i / numObjectsInRow * _placeSizeHeight + 15, _pictureWidth, _pictureHeight); + airplane?.SetObject(maxLeft - curr % numObjectsInRow * _placeSizeWidth + 5, curr / numObjectsInRow * _placeSizeHeight + 15, _pictureWidth, _pictureHeight); airplane?.DrawingObject(g); + curr++; } } }