From 2bec551f18ae59012cae4d6535600a34a1f7eb57 Mon Sep 17 00:00:00 2001
From: alhimek17 <armnkr5@gmail.com>
Date: Sun, 24 Mar 2024 19:22:18 +0400
Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=BA=D1=82=D0=B8=D1=87?=
 =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=B8=20=D0=B4=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0?=
 =?UTF-8?q?=D0=BD=D0=BD=D0=B0=D1=8F=20=D0=9B=D0=B0=D0=B1=20=D1=80=D0=B0?=
 =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=2003?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../AbstractCompany.cs                        |  4 +-
 .../PlaneSharigService.cs                     | 41 ++++++++++++++++++-
 .../FormPlaneCollection.Designer.cs           |  2 +-
 3 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs
index 3a34be8..a705d97 100644
--- a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs
+++ b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/AbstractCompany.cs
@@ -7,11 +7,11 @@ public abstract class AbstractCompany
     /// <summary>
     /// Размер места (ширина)
     /// </summary>
-    protected readonly int _placeSizeWidth = 210;
+    protected readonly int _placeSizeWidth = 195;
     /// <summary>
     /// Размер места (высота)
     /// </summary>
-    protected readonly int _placeSizeHeight = 80;
+    protected readonly int _placeSizeHeight = 70;
     /// <summary>
     /// Ширина окна
     /// </summary>
diff --git a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs
index b0e0b8b..0fccf19 100644
--- a/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs
+++ b/ProjectAirPlane/ProjectAirPlane/CollectionGenericObjects/PlaneSharigService.cs
@@ -11,11 +11,48 @@ public class PlaneSharigService : AbstractCompany
 
     protected override void DrawBackgound(Graphics g)
     {
-        throw new NotImplementedException();
+       
+        Pen pen = new(Color.Black, 3);
+        for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
+        {
+            for (int j = 0; j < _pictureHeight / _placeSizeHeight +
+            1; ++j)
+            {
+                g.DrawLine(pen, i * _placeSizeWidth, j *
+                _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
+                _placeSizeHeight);
+            }
+            g.DrawLine(pen, i * _placeSizeWidth, 0, i *
+            _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
+        }
     }
 
     protected override void SetObjectsPosition()
     {
-        throw new NotImplementedException();
+        int width = _pictureWidth / _placeSizeWidth;
+        int height = _pictureHeight / _placeSizeHeight;
+
+        int curWidth = width - 1;
+        int curHeight = 0;
+
+        for (int i = 0; i < (_collection?.Count ?? 0); i++)
+        {
+            if (_collection.Get(i) != null)
+            {
+                _collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
+                _collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 20, curHeight * _placeSizeHeight + 4);
+            }
+            if (curWidth > 0)
+                curWidth--;
+            else
+            {
+                curWidth = width - 1;
+                curHeight++;
+            }
+            if (curHeight > height)
+            {
+                return;
+            }
+        }
     }
 }
diff --git a/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs b/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs
index 947f70f..ae38492 100644
--- a/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs
+++ b/ProjectAirPlane/ProjectAirPlane/FormPlaneCollection.Designer.cs
@@ -118,7 +118,7 @@
             buttonAddPlane.Name = "buttonAddPlane";
             buttonAddPlane.Size = new Size(186, 50);
             buttonAddPlane.TabIndex = 1;
-            buttonAddPlane.Text = "Добавление самолёта";
+            buttonAddPlane.Text = "Добавление судна";
             buttonAddPlane.UseVisualStyleBackColor = true;
             buttonAddPlane.Click += ButtonAddPlane_Click;
             //