PIbd-12_Bugrov_D.A._Simple LabWork03 #2

Closed
BoiledMilk wants to merge 8 commits from LabWork02 into LabWork01
4 changed files with 14 additions and 22 deletions
Showing only changes of commit 8bf8eab70b - Show all commits

View File

@ -15,7 +15,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive
/// <param name="weight"></param>
/// <param name="bodyColor"></param>
/// <param name="additionalColor"></param>
/// <param name="bodyKit"></param>
/// <param name="electricHorns"></param>
/// <param name="batteryPlacement"></param>
public DrawningElectricLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement) : base(83,45)
@ -32,7 +31,7 @@ public class DrawningElectricLocomotive : DrawningLocomotive
//Создание перьев и кистей для прорисовки электровоза
Brush blackBrush = new SolidBrush(Color.Black);
Pen penSolid = new(Color.Black, 2);
Pen penSolid = new(electricLocomotive.AdditionalColor, 2);
Pen penSolidYellow = new(Color.Yellow, 0.5f);
Brush additionalBrush = new SolidBrush(electricLocomotive.AdditionalColor);
@ -40,7 +39,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive
if (electricLocomotive.ElectricHorns)
{
//Инициализация опорных точек для прорисовки "рогов"
Point pointHorns1 = new Point(_startPosX.Value + 13, _startPosY.Value + 5);
Point pointHorns2 = new Point(_startPosX.Value + 16, _startPosY.Value + 2);
@ -60,7 +58,7 @@ public class DrawningElectricLocomotive : DrawningLocomotive
Point pointLightning4 = new Point(_startPosX.Value + 37, _startPosY.Value + 41);
//Прорисовка "хранилища батарей" электровоза
g.FillRectangle(blackBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f);
g.FillRectangle(additionalBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f);
g.DrawLine(penSolidYellow, pointLightning1, pointLightning2);
g.DrawLine(penSolidYellow, pointLightning2, pointLightning3);
g.DrawLine(penSolidYellow, pointLightning3, pointLightning4);
@ -71,14 +69,6 @@ public class DrawningElectricLocomotive : DrawningLocomotive
base.DrawTransport(g);
_startPosY -= 5;
//Опциональная прорисовка цвета передних колёс
g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 37, 8, 8);
g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8);
//Опциональная прорисовка цвета задних колёс
g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 37, 8, 8);
g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 37, 8, 8);
}
}

View File

@ -65,8 +65,6 @@ public class DrawningLocomotive
/// </summary>
public int GetHeight => _drawningLocomotiveHeight;
/// <summary>
/// Пустой конструктор
/// </summary>
@ -137,12 +135,9 @@ public class DrawningLocomotive
return;
}
_startPosX = x;
_startPosY = y;
if (_drawningLocomotiveHeight + y > _pictureHeight)
{
_startPosY = _pictureHeight - _drawningLocomotiveHeight;
@ -229,6 +224,7 @@ public class DrawningLocomotive
Pen windowPen = new(Color.DeepSkyBlue);
Brush blackBrush = new SolidBrush(Color.Black);
Brush whiteBrush = new SolidBrush(Color.White);
Brush additionalBrush = new SolidBrush(EntityLocomotive.BodyColor);
//Инициализация опорных точек для прорисовки корпуса
Point pointStart = new Point(_startPosX.Value + 75, _startPosY.Value + 15);
@ -285,7 +281,6 @@ public class DrawningLocomotive
g.FillRectangle(brWhite, _startPosX.Value + 36, _startPosY.Value + 11, 7, 10);
//Прорисовка передней и задней "юбки"
g.FillRectangle(blackBrush, _startPosX.Value + 7, _startPosY.Value + 32, 25, 5.3f);
g.FillRectangle(blackBrush, _startPosX.Value + 47, _startPosY.Value + 32, 22, 5.3f);
@ -309,11 +304,11 @@ public class DrawningLocomotive
g.DrawRectangle(windowPen, _startPosX.Value + 63, _startPosY.Value + 4, 8, 8);
//Опциональная прорисовка цвета передних колёс
g.FillEllipse(whiteBrush, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8);
g.FillEllipse(whiteBrush, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8);
g.FillEllipse(additionalBrush, _startPosX.Value + 9, _startPosY.Value + 32, 8, 8);
g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 32, 8, 8);
//Опциональная прорисовка цвета задних колёс
g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8);
g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8);
g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 26, _startPosY.Value + 32, 8, 8);
g.FillEllipse(additionalBrush, _startPosX.Value + 25 + 37, _startPosY.Value + 32, 8, 8);
}
}

View File

@ -24,4 +24,10 @@ public interface IMoveableObject
/// <param name="direction">Направление</param>
/// <returns>True - объект перемещен, false - перемещение невозможно</returns>
bool TryMoveObject(MovementDirection direction);
/// <summary>
/// Метод интерфейса для доп.задания
/// </summary>
/// <returns></returns>
}

View File

@ -64,4 +64,5 @@ public class MoveableLocomotive : IMoveableObject
_ => DirectionType.Unknow,
};
}
}