diff --git a/DoubleDeckerBus/DoubleDeckerBus/DrawingDoubleDeckerBus.cs b/DoubleDeckerBus/DoubleDeckerBus/DrawingDoubleDeckerBus.cs index 194b447..960fe8b 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/DrawingDoubleDeckerBus.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/DrawingDoubleDeckerBus.cs @@ -39,25 +39,29 @@ public class DrawingDoubleDeckerBus { return false; } - else + + + _pictureWidth = width; + _pictureHeight = hight; + + if (_startPosX.HasValue && (_startPosX.Value + _DrawingBusWidth > _pictureWidth)) { - _pictureWidth = width; - _pictureHeight = hight; - - if (_startPosX.HasValue && (_startPosX.Value + _DrawingBusWidth > _pictureWidth)) - { - _startPosX = _pictureWidth - _DrawingBusWidth; - } - - if (_startPosY.HasValue && (_startPosY + _DrawingBusHight > _pictureHeight)) - { - _startPosY = _pictureHeight - _DrawingBusHight; - } - - return true; + _startPosX = _pictureWidth - _DrawingBusWidth; } - } + if (_startPosY.HasValue && (_startPosY + _DrawingBusHight > _pictureHeight)) + { + _startPosY = _pictureHeight - _DrawingBusHight; + } + + return true; + + } + /// + /// установить начальную позицию + /// + /// + /// public void SetPosition(int x, int y) { if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) @@ -100,7 +104,7 @@ public class DrawingDoubleDeckerBus return false; } - switch(direction) + switch (direction) { case DirectionType.Left: 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.FillPolygon(mainBrush, bus); - + //вехний отсек 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.FillPolygon(additionalBrush, section); } diff --git a/DoubleDeckerBus/DoubleDeckerBus/EntityDoubleDeckerBus.cs b/DoubleDeckerBus/DoubleDeckerBus/EntityDoubleDeckerBus.cs index 6bab740..16150eb 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/EntityDoubleDeckerBus.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/EntityDoubleDeckerBus.cs @@ -13,23 +13,23 @@ /// public Color AdditionalColor { get; private set; } /// - /// Признак (опция) наличия обвеса + /// Признак (опция) наличия боковых зеркал /// public bool SideMirrors { get; private set; } /// - /// Признак (опция) наличия антикрыла + /// Признак (опция) наличия верхней панели /// public bool TopSection { get; private set; } /// - /// Признак (опция) наличия гоночной полосы + /// Признак (опция) наличия полосок на автобусе /// public bool Stripes { get; private set; } /// - /// + /// Признак (опция) наличия лестницы /// public bool Stairs { get; private set; } /// - /// Шаг перемещения автомобиля + /// Шаг перемещения автобуса /// public double Step => Speed * 100 / Weight; /// diff --git a/DoubleDeckerBus/DoubleDeckerBus/FormDoubleDeckerBus.cs b/DoubleDeckerBus/DoubleDeckerBus/FormDoubleDeckerBus.cs index ef6511a..49c6356 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/FormDoubleDeckerBus.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/FormDoubleDeckerBus.cs @@ -81,7 +81,5 @@ namespace DoubleDeckerBus Draw(); } } - - } }