From aef61e0dc3cbc07eb10bab654d7dfdae5b9ceea8 Mon Sep 17 00:00:00 2001 From: Yunusov_Niyaz Date: Thu, 5 Oct 2023 21:26:52 +0400 Subject: [PATCH] Lab1 perfecto --- Trolleybus/Trolleybus/DrawingTrolleybus.cs | 34 +++++++++++++++++----- Trolleybus/Trolleybus/EntityTrolleybus.cs | 28 +++++++++++++----- Trolleybus/Trolleybus/FormTrolleybus.cs | 1 - 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/Trolleybus/Trolleybus/DrawingTrolleybus.cs b/Trolleybus/Trolleybus/DrawingTrolleybus.cs index 0625037..be9fcce 100644 --- a/Trolleybus/Trolleybus/DrawingTrolleybus.cs +++ b/Trolleybus/Trolleybus/DrawingTrolleybus.cs @@ -7,22 +7,40 @@ using System.Threading.Tasks; namespace Trolleybus { + /// + /// Класс, отвечающий за прорисовку и перемещение объекта-сущности + /// public class DrawingTrolleybus { + + /// + /// Класс-сущность + /// public EntityTrolleybus? EntityTrolleybus { get; private set; } - + /// + /// Ширина окна + /// private int _pictureWidth; - + /// + /// Высота окна + /// private int _pictureHeight; - + /// + /// Левая координата прорисовки автомобиля + /// private int _startPosX; - + /// + /// Верхняя кооридната прорисовки автомобиля + /// private int _startPosY; - + /// + /// Ширина прорисовки автомобиля + /// private readonly int _trolleybusWidth = 170; - + /// + /// Высота прорисовки автомобиля + /// private readonly int _trolleybusHeight = 124; - public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool roga, bool battery, int width, int height) { _pictureWidth = width; @@ -108,7 +126,7 @@ namespace Trolleybus g.FillEllipse(brBlue, _startPosX + 95, _startPosY + 40, 20, 40); g.FillEllipse(brBlue, _startPosX + 120, _startPosY + 40, 20, 40); //дверь - Brush brDoor = new SolidBrush(EntityTrolleybus.AdditionalColor); + Brush brDoor = new SolidBrush(EntityTrolleybus.BodyColor); g.FillRectangle(brDoor, _startPosX + 60, _startPosY + 50, 30, 60); //колеса Brush brblack = new SolidBrush(Color.Black); diff --git a/Trolleybus/Trolleybus/EntityTrolleybus.cs b/Trolleybus/Trolleybus/EntityTrolleybus.cs index cf6227c..9016612 100644 --- a/Trolleybus/Trolleybus/EntityTrolleybus.cs +++ b/Trolleybus/Trolleybus/EntityTrolleybus.cs @@ -8,20 +8,34 @@ namespace Trolleybus { public class EntityTrolleybus { + /// + /// Скорость + /// public int Speed { get; private set; } - + /// + /// Вес + /// public double Weight { get; private set; } - + /// + /// Основной цвет + /// public Color BodyColor { get; private set; } - + /// + /// Дополнительный цвет (для опциональных элементов) + /// public Color AdditionalColor { get; private set; } - + /// + /// Признак (опция) наличия рогов + /// public bool Roga { get; private set; } - + /// + /// Признак (опция) наличия батареи + /// public bool Battery { get; private set; } - + /// + /// Шаг перемещения автомобиля + /// public double Step => (double)Speed * 100 / Weight; - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool roga, bool battery) { diff --git a/Trolleybus/Trolleybus/FormTrolleybus.cs b/Trolleybus/Trolleybus/FormTrolleybus.cs index bb5b2c6..b7cdc74 100644 --- a/Trolleybus/Trolleybus/FormTrolleybus.cs +++ b/Trolleybus/Trolleybus/FormTrolleybus.cs @@ -3,7 +3,6 @@ namespace Trolleybus public partial class FormTrolleybus : Form { private DrawingTrolleybus? _drawningTrolleybus; - public FormTrolleybus() { InitializeComponent();