ISEbd11 Mosevnin A M LabWork01 Simple #1
@ -33,11 +33,11 @@ public class DrawningAiroplane
|
||||
/// <summary>
|
||||
/// Ширина прорисовки
|
||||
/// </summary>
|
||||
private readonly int _drawningAiroplaneWidth = 180;
|
||||
private readonly int _drawningAiroplaneWidth = 160;
|
||||
/// <summary>
|
||||
/// Высота прорисовки
|
||||
/// </summary>
|
||||
private readonly int _drawningaAiroplaneHeight = 110;
|
||||
private readonly int _drawningaAiroplaneHeight = 80;
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
@ -48,12 +48,12 @@ public class DrawningAiroplane
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="toplivbak">Признак наличия бака</param>
|
||||
/// <param name="radar">Признак наличия радара</param>
|
||||
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool toplivbak, bool radar, bool sportLine)
|
||||
additionalColor, bool toplivbak, bool radar)
|
||||
{
|
||||
EntityAiroplane = new EntityAiroplane();
|
||||
EntityAiroplane.Init(speed, weight, bodyColor, additionalColor, toplivbak, radar, sportLine);
|
||||
EntityAiroplane.Init(speed, weight, bodyColor, additionalColor, toplivbak, radar);
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
@ -78,21 +78,20 @@ public bool SetPictureSize(int width, int height)
|
||||
|
||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||
{
|
||||
if (_startPosX + _drawningAiroplaneWidth <= _pictureWidth)
|
||||
if (_startPosX + _drawningAiroplaneWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = 0;
|
||||
_startPosX = _pictureWidth - _drawningAiroplaneWidth;
|
||||
}
|
||||
|
||||
if (_startPosY + _drawningaAiroplaneHeight <= _pictureWidth)
|
||||
if (_startPosY + _drawningaAiroplaneHeight > _pictureWidth)
|
||||
{
|
||||
_startPosY = 0;
|
||||
_startPosY = _pictureHeight - _drawningaAiroplaneHeight;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
@ -194,65 +193,57 @@ public bool MoveTransport(DirectionType direction)
|
||||
SolidBrush(EntityAiroplane.AdditionalColor);
|
||||
|
||||
|
||||
|
||||
//////
|
||||
//крыло верхнее самолета
|
||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 30, _startPosX.Value + 30, _startPosY.Value + 60);
|
||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 30, _startPosX.Value + 70, _startPosY.Value + 60);
|
||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 60, _startPosX.Value + 70, _startPosY.Value + 60);
|
||||
g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 5, _startPosX.Value + 15, _startPosY.Value + 5);
|
||||
g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 5, _startPosX.Value + 55, _startPosY.Value + 35);
|
||||
g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 35, _startPosX.Value + 15, _startPosY.Value + 5);
|
||||
|
||||
//задняя часть самолета полукруг
|
||||
g.DrawArc(pen, _startPosX.Value + 20, _startPosY.Value + 60, 30,30,90,180);
|
||||
g.DrawArc(pen, _startPosX.Value + 5, _startPosY.Value + 35, 30,30,90,180);
|
||||
|
||||
//сзади
|
||||
g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 55, 40,10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 30, 40,10);
|
||||
Brush brbr = new SolidBrush(Color.Brown);
|
||||
g.FillEllipse(brbr, _startPosX.Value + 25, _startPosY.Value + 55, 40,10);
|
||||
g.FillEllipse(brbr, _startPosX.Value + 10, _startPosY.Value + 30, 40,10);
|
||||
//низ самолета
|
||||
g.DrawLine(pen, _startPosX.Value + 31, _startPosY.Value + 90, _startPosX.Value + 150, _startPosY.Value + 90);
|
||||
|
||||
g.DrawLine(pen, _startPosX.Value + 16, _startPosY.Value + 65, _startPosX.Value + 135, _startPosY.Value + 65);
|
||||
|
||||
// треуголник спереди
|
||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 93, _startPosX.Value + 150, _startPosY.Value + 57);
|
||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 57, _startPosX.Value + 175, _startPosY.Value + 75);
|
||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 93, _startPosX.Value + 175, _startPosY.Value + 75);
|
||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 75, _startPosX.Value + 175, _startPosY.Value + 75);
|
||||
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 68, _startPosX.Value + 135, _startPosY.Value + 32);
|
||||
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 32, _startPosX.Value + 160, _startPosY.Value + 50);
|
||||
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 68, _startPosX.Value + 160, _startPosY.Value + 50);
|
||||
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 50, _startPosX.Value + 160, _startPosY.Value + 50);
|
||||
|
||||
//вверх от тругольника до треугольника
|
||||
g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 60, _startPosX.Value + 150, _startPosY.Value + 60);
|
||||
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 35, _startPosX.Value + 135, _startPosY.Value + 35);
|
||||
|
||||
//крыло
|
||||
g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 70, 70, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 45, 70, 10);
|
||||
Brush brbl = new SolidBrush(Color.Black);
|
||||
g.FillEllipse(brbl, _startPosX.Value + 65, _startPosY.Value + 70, 70, 10);
|
||||
g.FillEllipse(brbl, _startPosX.Value + 50, _startPosY.Value + 45, 70, 10);
|
||||
|
||||
//шасси
|
||||
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 90, _startPosX.Value + 50, _startPosY.Value + 100);
|
||||
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 90, _startPosX.Value + 135, _startPosY.Value + 100);
|
||||
g.DrawLine(pen, _startPosX.Value + 40, _startPosY.Value + 100, _startPosX.Value + 60, _startPosY.Value + 100);
|
||||
|
||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 95, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 60, _startPosY.Value + 95, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 130, _startPosY.Value + 95, 10, 10);
|
||||
g.DrawLine(pen, _startPosX.Value + 35, _startPosY.Value + 65, _startPosX.Value + 35, _startPosY.Value + 75);
|
||||
g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 65, _startPosX.Value + 120, _startPosY.Value + 75);
|
||||
g.DrawLine(pen, _startPosX.Value + 25, _startPosY.Value + 75, _startPosX.Value + 45, _startPosY.Value + 75);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 70, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 70, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 115, _startPosY.Value + 70, 10, 10);
|
||||
|
||||
//топливный бак
|
||||
if (EntityAiroplane.Toplivbak)
|
||||
{
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 80,_startPosY.Value + 45, 30, 15);
|
||||
//g.FillRectangle(additionalBrush, _startPosX.Value + 35,_startPosY.Value + 23, 35, 15);
|
||||
//g.FillRectangle(additionalBrush, _startPosX.Value + 10,_startPosY.Value + 23, 20, 15);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 65,_startPosY.Value + 20, 30, 15);
|
||||
}
|
||||
|
||||
|
||||
//Радар
|
||||
if (EntityAiroplane.Radar)
|
||||
{
|
||||
Brush brGreen = new SolidBrush(Color.LightGreen);
|
||||
g.FillEllipse(brGreen, _startPosX.Value + 150, _startPosY.Value + 75, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 150, _startPosY.Value + 75, 10, 10);
|
||||
}
|
||||
|
||||
//спортивная линия
|
||||
if (EntityAiroplane.SportLine) {
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 138, _startPosY.Value + 60, 10, 30);
|
||||
g.FillEllipse(brGreen, _startPosX.Value + 135, _startPosY.Value + 50, 10, 10);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 135, _startPosY.Value + 50, 10, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
namespace ProjectAiroplane;
|
||||
|
||||
public class EntityAiroplane
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
public int Speed { get; private set; }
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
@ -27,11 +26,7 @@ public class EntityAiroplane
|
||||
// </summary>
|
||||
public bool Radar { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия гоночной полосы
|
||||
/// </summary>
|
||||
public bool SportLine { get; private set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// Шаг перемещения самолета
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
/// <summary>
|
||||
@ -43,8 +38,8 @@ public class EntityAiroplane
|
||||
/// <param name="additionalColor"></Дополнительный цвет>
|
||||
/// <param name="toplivbak"></ Признак наличия бака>
|
||||
/// <param name="radar"></Признак (опция) наличия радара>
|
||||
/// <param name="sportLine"></Признак (опция) наличия гоночной полосы>
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar, bool sportLine)
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
@ -52,7 +47,6 @@ public class EntityAiroplane
|
||||
AdditionalColor = additionalColor;
|
||||
Toplivbak = toplivbak;
|
||||
Radar = radar;
|
||||
SportLine = sportLine;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,7 @@ public partial class FormAiroplane : Form
|
||||
_drawningAiroplane.Init(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)));
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
_drawningAiroplane.SetPictureSize(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height);
|
||||
_drawningAiroplane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user