Files
CISTbv-41-PetrovME_Base/ProectMilitaryAircraft/ProectMilitaryAircraft/Draw/DrawningMilitaryAircraft.cs

96 lines
3.7 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 System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Windows.Forms;
using ProectMilitaryAircraft.Entities;
namespace ProectMilitaryAircraft.Draw;
/// <summary>
/// Класс, отвечающий за отрисовку и перемещение объекта - сущности
/// </summary>
public class DrawningMilitaryAircraft : DrawningAircraft
{
/// <summary>
/// Констуктор
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес самолета</param>
/// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Доп. цвет</param>
/// <param name="pin"> Признак наличия "Штыря на носу самолета"</param>
/// <param name="rokets">Признак наличия "Символики"</param>
/// <param name="symbolism">Признак наличия "Символики"</param>
public DrawningMilitaryAircraft(int speed, double weight, Color bodyColor, Color additionalColor, bool pin, bool rokets, bool symbolism, int width, int height) :base (speed, weight, bodyColor, width, height,120, 110)
{
if (EntityAircraft != null)
{
EntityAircraft = new EntityMilitaryAircraft(speed, weight, bodyColor, additionalColor, pin, rokets, symbolism);
}
}
public override void DrawTransport(Graphics g)
{
if (EntityAircraft is not EntityMilitaryAircraft airCraft || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
Pen pen = new(Color.Black);
Brush abr = new SolidBrush(airCraft.AdditionalColor);
base.DrawTransport(g);
//Ракеты
if (airCraft.Rokets)
{
//Ракеты 1-3
g.FillEllipse(abr, _startPosX.Value + 44, _startPosY.Value + 20, 5, 5);
g.DrawEllipse(pen, _startPosX.Value + 44, _startPosY.Value + 20, 5, 5);
g.FillEllipse(abr, _startPosX.Value + 44, _startPosY.Value + 13, 5, 5);
g.DrawEllipse(pen, _startPosX.Value + 44, _startPosY.Value + 13, 5, 5);
g.FillEllipse(abr, _startPosX.Value + 44, _startPosY.Value + 6, 5, 5);
g.DrawEllipse(pen, _startPosX.Value + 44, _startPosY.Value + 6, 5, 5);
//Ракеты 4-6
g.FillEllipse(abr, _startPosX.Value + 44, _startPosY.Value + 55, 5, 5);
g.DrawEllipse(pen, _startPosX.Value + 44, _startPosY.Value + 55, 5, 5);
g.FillEllipse(abr, _startPosX.Value + 44, _startPosY.Value + 62, 5, 5);
g.DrawEllipse(pen, _startPosX.Value + 44, _startPosY.Value + 62, 5, 5);
g.FillEllipse(abr, _startPosX.Value + 44, _startPosY.Value + 69, 5, 5);
g.DrawEllipse(pen, _startPosX.Value + 44, _startPosY.Value + 69, 5, 5);
}
if (airCraft.Symbolism)
{
//Символ
g.FillEllipse(abr, _startPosX.Value + 15, _startPosY.Value + 35, 10, 10);
g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 35, 10, 10);
g.FillRectangle(abr, _startPosX.Value + 30, _startPosY.Value + 35, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 30, _startPosY.Value + 35, 10, 10);
g.FillEllipse(abr, _startPosX.Value + 45, _startPosY.Value + 35, 10, 10);
g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 35, 10, 10);
}
if (airCraft.Pin)
{
//Носовая часть
g.FillEllipse(abr, _startPosX.Value + 78, _startPosY.Value + 37, 10, 5);
}
}
}