77 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using ProjectHoistingCrane.Entities;
namespace ProjectHoistingCrane.Drawnings;
public class DrawningHoistingCrane : DrawningCrane
{
/// <summary>
/// Конструктор
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="counterweight">Признак наличия противовеса</param>
/// <param name="crane">Признак наличия крана</param>
public DrawningHoistingCrane(int speed, double weight, Color bodyColor, Color additionalColor, bool counterweight, bool crane) : base(110, 56)
{
EntityCrane = new EntityHoistingCrane(speed, weight, bodyColor, additionalColor,
counterweight, crane);
}
public override void DrawTransport(Graphics g)
{
if (EntityCrane == null || EntityCrane is not EntityHoistingCrane hoistingCrane || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(hoistingCrane.AdditionalColor);
_startPosX += 7;
_startPosY += 8;
base.DrawTransport(g);
_startPosX -= 7;
_startPosY -= 8;
//кран
if (hoistingCrane.Crane)
{
//балка
g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, 110, 9);
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, 109, 8);
//крюк
g.FillRectangle(additionalBrush, _startPosX.Value + 107, _startPosY.Value + 8, 3, 13);
g.FillRectangle(additionalBrush, _startPosX.Value + 102, _startPosY.Value + 18, 8, 3);
g.FillRectangle(additionalBrush, _startPosX.Value + 102, _startPosY.Value + 16, 3, 5);
}
//противовес
if (hoistingCrane.Сounterweight)
{
g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value, 10, 9);
g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value, 9, 8);
g.DrawLine(pen, _startPosX.Value + 35, _startPosY.Value + 2, _startPosX.Value + 44, _startPosY.Value + 2);
g.DrawLine(pen, _startPosX.Value + 35, _startPosY.Value + 4, _startPosX.Value + 44, _startPosY.Value + 4);
g.DrawLine(pen, _startPosX.Value + 35, _startPosY.Value + 6, _startPosX.Value + 44, _startPosY.Value + 6);
}
}
}