PIBD-11_Lovtsov.A.A_LabaWork01_Simple #3

Open
a.lovtsov wants to merge 7 commits from Laba1 into main
3 changed files with 107 additions and 75 deletions
Showing only changes of commit 520f30955f - Show all commits

View File

@ -20,11 +20,11 @@ public class DiselLoko
/// </summary>
public Color ColorWheel { get; private set; }
/// <summary>
/// Признак езды
/// Признак наличия трубы
/// </summary>
public bool IsTube { get; private set; }
/// <summary>
/// Признак заполненности
/// Признак наличия отсека
/// </summary>
public bool IsComportament { get; private set; }
/// <summary>

View File

@ -154,91 +154,119 @@ public class DrawningDiselLoko
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(DiselLoko.ColorBody);
Brush blueBrush = Brushes.Blue;
Pen blackPen = new Pen(Color.Black, 2);
Brush blackBrush = Brushes.Black;
//корпус
Point[] trainBody = {
new Point(_startPosX.Value, _startPosY.Value),
new Point(_startPosX.Value + _drawingCarWidth+30, _startPosY.Value),
new Point(_startPosX.Value + _drawingCarWidth+30, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value-10, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value-10, _startPosY.Value + _drawingCarHeight/2)
};
g.DrawPolygon(blackPen, trainBody);
//разделительная линия
g.DrawLine(blackPen, _startPosX.Value-10, _startPosY.Value + _drawingCarHeight / 2, _startPosX.Value + 55, _startPosY.Value + _drawingCarHeight / 2);
g.DrawLine(blackPen, _startPosX.Value + 140, _startPosY.Value + _drawingCarHeight / 2, _startPosX.Value + _drawingCarHeight+15, _startPosY.Value + _drawingCarHeight / 2);
// Окна (полигоны)
Point[] window1 = {
new Point(_startPosX.Value + 10, _startPosY.Value + 10),
new Point(_startPosX.Value + 25, _startPosY.Value + 10),
new Point(_startPosX.Value + 25, _startPosY.Value + 25),
new Point(_startPosX.Value + 10, _startPosY.Value + 25)
};
Point[] window2 = {
new Point(_startPosX.Value + 120, _startPosY.Value + 10),
new Point(_startPosX.Value + 135, _startPosY.Value + 10),
new Point(_startPosX.Value + 135, _startPosY.Value + 25),
new Point(_startPosX.Value + 120, _startPosY.Value + 25)
};
Point[] window3 = {
new Point(_startPosX.Value + 35, _startPosY.Value + 10),
new Point(_startPosX.Value + 50, _startPosY.Value + 10),
new Point(_startPosX.Value + 50, _startPosY.Value + 25),
new Point(_startPosX.Value + 35, _startPosY.Value + 25)
};
g.FillPolygon(blueBrush, window1);
g.FillPolygon(blueBrush, window2);
g.FillPolygon(blueBrush, window3);
g.DrawPolygon(blackPen, window1);
g.DrawPolygon(blackPen, window2);
g.DrawPolygon(blackPen, window3);
// Дверь (полигон)
Point[] door = {
new Point(_startPosX.Value + 55, _startPosY.Value + 10),
new Point(_startPosX.Value + 75, _startPosY.Value + 10),
new Point(_startPosX.Value + 75, _startPosY.Value + 50),
new Point(_startPosX.Value + 55, _startPosY.Value + 50)
};
g.DrawPolygon(blackPen, door);
//колёса
for (int i = 0; i < 4; i++)
{
Brush brBlack = new SolidBrush(Color.Black);
g.FillEllipse(brBlack, _startPosX.Value + (i * 40), _startPosY.Value + 60, 20, 20);
}
// Черные вставки внизу корпуса (полигон)
Point[] bottomBlack = {
new Point(_startPosX.Value+10, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value + _drawingCarWidth-55, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value + _drawingCarWidth-55, _startPosY.Value + _drawingCarHeight + 10),
new Point(_startPosX.Value+10, _startPosY.Value + _drawingCarHeight + 10)
};
Point[] bottomBlack2 = {
new Point(_startPosX.Value+_drawingCarWidth+25, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value + _drawingCarWidth-25, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value + _drawingCarWidth-25, _startPosY.Value + _drawingCarHeight + 10),
new Point(_startPosX.Value+_drawingCarWidth+25, _startPosY.Value + _drawingCarHeight + 10)
};
Point[] bottomBlack3 = {
new Point(_startPosX.Value, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value+7, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value, _startPosY.Value + _drawingCarHeight+12),
new Point(_startPosX.Value - 15, _startPosY.Value + _drawingCarHeight + 12),
};
Point[] bottomBlack4 = {
new Point(_startPosX.Value+_drawingCarWidth+30, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value + _drawingCarWidth+15, _startPosY.Value + _drawingCarHeight),
new Point(_startPosX.Value + _drawingCarWidth, _startPosY.Value + _drawingCarHeight + 10),
new Point(_startPosX.Value+_drawingCarWidth+45, _startPosY.Value + _drawingCarHeight + 10)
};
g.FillPolygon(blackBrush, bottomBlack);
g.FillPolygon(blackBrush, bottomBlack2);
g.FillPolygon(blackBrush, bottomBlack3);
g.FillPolygon(blackBrush, bottomBlack4);
// Черные вставки сбоку корпуса (полигон)
g.FillRectangle(blackBrush, _startPosX.Value + _drawingCarWidth+30, _startPosY.Value + 10, 10, _drawingCarHeight - 20);
// труба
if (DiselLoko.IsTube)
{
g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 40, 20, 20);
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 10, 20, 40);
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value, 15, 15);
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 45, 15, 15);
g.FillEllipse(additionalBrush, _startPosX.Value + 90, _startPosY.Value, 20, 20);
g.FillEllipse(additionalBrush, _startPosX.Value + 90, _startPosY.Value + 40, 20, 20);
g.FillRectangle(additionalBrush, _startPosX.Value + 90, _startPosY.Value + 10, 20, 40);
g.FillRectangle(additionalBrush, _startPosX.Value + 90, _startPosY.Value + 1, 15, 15);
g.FillRectangle(additionalBrush, _startPosX.Value + 90, _startPosY.Value + 45, 15, 15);
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value, 20, 20);
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 40, 20, 20);
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 10, 20, 40);
g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value, 14, 15);
g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 45, 14, 15);
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value, 20, 20);
g.FillEllipse(additionalBrush, _startPosX.Value, _startPosY.Value + 40, 20, 20);
g.FillRectangle(additionalBrush, _startPosX.Value + 1, _startPosY.Value + 10, 25, 40);
g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + 1, 15, 15);
g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + 45, 15, 15);
g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value, 39, 15);
g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 45, 39, 15);
g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 1, 40, 15);
g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 45, 40, 15);
}
//границы автомобиля
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20);
g.DrawRectangle(pen, _startPosX.Value + 9, _startPosY.Value + 15, 10, 30);
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 4, 70, 52);
//задние фары
Brush brRed = new SolidBrush(Color.Red);
g.FillEllipse(brRed, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20);
g.FillEllipse(brRed, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20);
//передние фары
Brush brYellow = new SolidBrush(Color.Yellow);
g.FillEllipse(brYellow, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20);
g.FillEllipse(brYellow, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20);
//кузов
Brush br = new SolidBrush(DiselLoko.ColorBody);
g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value + 15, 10, 30);
g.FillRectangle(br, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
g.FillRectangle(br, _startPosX.Value + 20, _startPosY.Value + 5, 70, 50);
//стекла
Brush brBlue = new SolidBrush(Color.LightBlue);
g.FillRectangle(brBlue, _startPosX.Value + 70, _startPosY.Value + 10, 5, 40);
g.FillRectangle(brBlue, _startPosX.Value + 30, _startPosY.Value + 10, 5, 40);
g.FillRectangle(brBlue, _startPosX.Value + 35, _startPosY.Value + 8, 35, 2);
g.FillRectangle(brBlue, _startPosX.Value + 35, _startPosY.Value + 51, 35, 2);
//выделяем рамкой крышу
g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 10, 35, 40);
g.DrawRectangle(pen, _startPosX.Value + 75, _startPosY.Value + 15, 25, 30);
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 15, 15, 30);
// отсек
if (DiselLoko.IsComportament)
{
g.FillRectangle(additionalBrush, _startPosX.Value + 75, _startPosY.Value + 23, 25, 15);
/*g.FillRectangle(additionalBrush, _startPosX.Value + 75, _startPosY.Value + 23, 25, 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 + 10, _startPosY.Value + 23, 20, 15);*/
}
//// крыло
//if (DiselLoko.Wing)
//{
// g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + 5, 10, 50);
// g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 5, 10, 50);
//}
}
}

View File

@ -23,4 +23,8 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="д\" />
</ItemGroup>
</Project>