-лишний else +описания свойств сущности

This commit is contained in:
tyxz0 2024-02-20 08:10:37 +04:00
parent 8d4d56e692
commit 005c3818e2
3 changed files with 29 additions and 27 deletions

View File

@ -39,8 +39,8 @@ public class DrawingDoubleDeckerBus
{ {
return false; return false;
} }
else
{
_pictureWidth = width; _pictureWidth = width;
_pictureHeight = hight; _pictureHeight = hight;
@ -55,9 +55,13 @@ public class DrawingDoubleDeckerBus
} }
return true; return true;
}
}
}
/// <summary>
/// установить начальную позицию
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void SetPosition(int x, int y) public void SetPosition(int x, int y)
{ {
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
@ -100,7 +104,7 @@ public class DrawingDoubleDeckerBus
return false; return false;
} }
switch(direction) switch (direction)
{ {
case DirectionType.Left: case DirectionType.Left:
if (_startPosX.Value - EntityDoubleDeckerBus.Step > 0) if (_startPosX.Value - EntityDoubleDeckerBus.Step > 0)
@ -155,14 +159,14 @@ public class DrawingDoubleDeckerBus
} }
//кузов //кузов
PointF[] bus = {new PointF((float)_startPosX + 5, (float)_startPosY + 5), new PointF((float)_startPosX + 5, (float)_startPosY + 45), new PointF((float)_startPosX+ 105, (float)_startPosY + 45), new PointF((float)_startPosX + 105, (float)_startPosY + 25), new PointF((float)_startPosX + 95, (float)_startPosY + 5)}; PointF[] bus = { new PointF((float)_startPosX + 5, (float)_startPosY + 5), new PointF((float)_startPosX + 5, (float)_startPosY + 45), new PointF((float)_startPosX + 105, (float)_startPosY + 45), new PointF((float)_startPosX + 105, (float)_startPosY + 25), new PointF((float)_startPosX + 95, (float)_startPosY + 5) };
g.DrawPolygon(pen, bus); g.DrawPolygon(pen, bus);
g.FillPolygon(mainBrush, bus); g.FillPolygon(mainBrush, bus);
//вехний отсек //вехний отсек
if (EntityDoubleDeckerBus.TopSection) if (EntityDoubleDeckerBus.TopSection)
{ {
PointF[] section = { new PointF((float)_startPosX + 27, (float)_startPosY + 5), new PointF((float)_startPosX + 37, (float)_startPosY + 1), new PointF((float)_startPosX + 65, (float)_startPosY + 1), new PointF((float)_startPosX + 75, (float)_startPosY + 5)}; PointF[] section = { new PointF((float)_startPosX + 27, (float)_startPosY + 5), new PointF((float)_startPosX + 37, (float)_startPosY + 1), new PointF((float)_startPosX + 65, (float)_startPosY + 1), new PointF((float)_startPosX + 75, (float)_startPosY + 5) };
g.DrawPolygon(pen, section); g.DrawPolygon(pen, section);
g.FillPolygon(additionalBrush, section); g.FillPolygon(additionalBrush, section);
} }

View File

@ -13,23 +13,23 @@
/// </summary> /// </summary>
public Color AdditionalColor { get; private set; } public Color AdditionalColor { get; private set; }
/// <summary> /// <summary>
/// Признак (опция) наличия обвеса /// Признак (опция) наличия боковых зеркал
/// </summary> /// </summary>
public bool SideMirrors { get; private set; } public bool SideMirrors { get; private set; }
/// <summary> /// <summary>
/// Признак (опция) наличия антикрыла /// Признак (опция) наличия верхней панели
/// </summary> /// </summary>
public bool TopSection { get; private set; } public bool TopSection { get; private set; }
/// <summary> /// <summary>
/// Признак (опция) наличия гоночной полосы /// Признак (опция) наличия полосок на автобусе
/// </summary> /// </summary>
public bool Stripes { get; private set; } public bool Stripes { get; private set; }
/// <summary> /// <summary>
/// /// Признак (опция) наличия лестницы
/// </summary> /// </summary>
public bool Stairs { get; private set; } public bool Stairs { get; private set; }
/// <summary> /// <summary>
/// Шаг перемещения автомобиля /// Шаг перемещения автобуса
/// </summary> /// </summary>
public double Step => Speed * 100 / Weight; public double Step => Speed * 100 / Weight;
/// <summary> /// <summary>

View File

@ -81,7 +81,5 @@ namespace DoubleDeckerBus
Draw(); Draw();
} }
} }
} }
} }