2024-04-11 11:18:53 +04:00
|
|
|
|
using ProjectBus.Entities;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
|
|
|
|
namespace ProjectBus.Drawnings;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DrawningBus : DrawningSimpleBus
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Конструктор
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed">Скорость</param>
|
|
|
|
|
/// <param name="weight">Вес</param>
|
|
|
|
|
/// <param name="bodyColor">Основной цвет</param>
|
|
|
|
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
|
|
|
/// <param name="additionalCompartment">Признак наличия дополнительного отсека</param>
|
|
|
|
|
/// <param name="accordion"">Признак наличия гармошки</param>
|
|
|
|
|
public DrawningBus(int speed, double weight, Color bodyColor, Color additionalColor, bool additionalCompartment, bool accordion) : base(310,52)
|
|
|
|
|
{
|
|
|
|
|
EntitySimpleBus = new EntityBus(speed, weight, bodyColor, additionalColor, additionalCompartment, accordion);
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-23 08:50:46 +04:00
|
|
|
|
public DrawningBus(EntitySimpleBus simpleBus) : base(310, 52)
|
|
|
|
|
{
|
|
|
|
|
if (simpleBus != null && simpleBus is EntityBus bus)
|
|
|
|
|
{
|
|
|
|
|
EntitySimpleBus = new EntityBus(bus.Speed, bus.Weight, bus.BodyColor, bus.AdditionalColor, bus.AdditionalCompartment, bus.Accordion);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-11 11:18:53 +04:00
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
if (EntitySimpleBus == null || EntitySimpleBus is not EntityBus bus || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Pen pen = new(Color.Black);
|
|
|
|
|
Brush additionalBrush= new SolidBrush(bus.AdditionalColor);
|
|
|
|
|
|
|
|
|
|
//доп отсек
|
|
|
|
|
if (bus.AdditionalCompartment)
|
|
|
|
|
{
|
|
|
|
|
//корпус
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 204, _startPosY.Value - 1, 105, 50);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 205, _startPosY.Value, 105, 50);
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 205, _startPosY.Value, 105, 50);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//окна
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 247, _startPosY.Value + 6, 16, 25);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 275, _startPosY.Value + 6, 16, 25);
|
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 247, _startPosY.Value + 6, 16, 25);
|
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 275, _startPosY.Value + 6, 16, 25);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//дверь
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 215, _startPosY.Value + 10, 20, 40);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 215, _startPosY.Value + 10, 20, 40);
|
|
|
|
|
|
|
|
|
|
//колеса
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 250, _startPosY.Value + 40, 20, 20);
|
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 250, _startPosY.Value + 40, 20, 20);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.DrawTransport(g);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//гармошка
|
|
|
|
|
if (bus.Accordion)
|
|
|
|
|
{
|
|
|
|
|
Brush brGray = new SolidBrush(Color.LightGray);
|
|
|
|
|
|
|
|
|
|
g.FillRectangle(brGray, _startPosX.Value + 175, _startPosY.Value + 4, 30, 42);
|
|
|
|
|
g.FillRectangle(brGray, _startPosX.Value + 180, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
g.FillRectangle(brGray, _startPosX.Value + 185, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
g.FillRectangle(brGray, _startPosX.Value + 190, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
g.FillRectangle(brGray, _startPosX.Value + 195, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 175, _startPosY.Value + 4, 30, 42);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 180, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 185, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 190, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 195, _startPosY.Value + 4, 5, 42);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-22 22:22:59 +04:00
|
|
|
|
|
|
|
|
|
internal void SetAdditionalColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2024-04-11 11:18:53 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|