diff --git a/Airbus/Airbus/DrawningObjectPlane.cs b/Airbus/Airbus/DrawningObjectPlane.cs new file mode 100644 index 0000000..1a3bcff --- /dev/null +++ b/Airbus/Airbus/DrawningObjectPlane.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Airbus +{ + internal class DrawningObjectPlane : IDrawningObject + { + private DrawningPlane _plane = null; + public DrawningObjectPlane(DrawningPlane plane) + { + _plane = plane; + } + public float Step => _plane?.Plane?.Step ?? 0; + public (float Left, float Top, float Right, float Bottom) + GetCurrentPosition() + { + return _plane?.GetCurrentPosition() ?? default; + } + public void MoveObject(Direction direction) + { + _plane?.MoveTransport(direction); + } + public void SetObject(int x, int y, int width, int height) + { + _plane.SetPosition(x, y, width, height); + } + public void DrawningObject(Graphics g) + { + _plane.DrawTransport(g); + } + } +} diff --git a/Airbus/Airbus/DrawningPlane.cs b/Airbus/Airbus/DrawningPlane.cs index 98175ae..f1d3c95 100644 --- a/Airbus/Airbus/DrawningPlane.cs +++ b/Airbus/Airbus/DrawningPlane.cs @@ -180,5 +180,10 @@ namespace Airbus _startPosY = _pictureHeight.Value - _PlaneHeight; } } + + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return (_startPosX, _startPosY, _startPosX + _PlaneWidth, _startPosY + _PlaneHeight); + } } } diff --git a/Airbus/Airbus/IDrawningObject.cs b/Airbus/Airbus/IDrawningObject.cs new file mode 100644 index 0000000..aff5f1e --- /dev/null +++ b/Airbus/Airbus/IDrawningObject.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Airbus +{ + internal interface IDrawningObject + { + /// + /// Шаг перемещения объекта + /// + public float Step { get; } + /// + /// Установка позиции объекта + /// + /// Координата X + /// Координата Y + /// Ширина полотна + /// Высота полотна + void SetObject(int x, int y, int width, int height); + /// + /// Изменение направления пермещения объекта + /// + /// Направление + void MoveObject(Direction direction); + /// + /// Отрисовка объекта + /// + /// + void DrawningObject(Graphics g); + /// + /// Получение текущей позиции объекта + /// + /// + (float Left, float Top, float Right, float Bottom) + GetCurrentPosition(); + } +}