From 82c8174312363371973bc18f3854abd639c5199e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BE=D0=BB=D0=BE=D0=B4=D1=8F?= Date: Mon, 26 Sep 2022 20:30:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirPlaneWithRadar/DrawingObject.cs | 40 +++++++++++++++++++ .../AirPlaneWithRadar/DrawingPlain.cs | 4 ++ .../AirPlaneWithRadar/IDrawingObject.cs | 19 +++++++++ 3 files changed, 63 insertions(+) create mode 100644 AirPlaneWithRadar/AirPlaneWithRadar/DrawingObject.cs create mode 100644 AirPlaneWithRadar/AirPlaneWithRadar/IDrawingObject.cs diff --git a/AirPlaneWithRadar/AirPlaneWithRadar/DrawingObject.cs b/AirPlaneWithRadar/AirPlaneWithRadar/DrawingObject.cs new file mode 100644 index 0000000..8fa9368 --- /dev/null +++ b/AirPlaneWithRadar/AirPlaneWithRadar/DrawingObject.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirPlaneWithRadar +{ + internal class DrawingObject : IDrawingObject + { + private DrawingPlain _plain; + + public DrawingObject(DrawingPlain plain) + { + _plain = plain; + } + public float Step => _plain?.Plain?.Step ?? 0; + + + public void DrawningObject(Graphics g) + { + //TODO + } + + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return _plain?.GetCurrentPosition() ?? default; + } + + public void MoveObject(Direction direction) + { + _plain?.MoveTransport(direction); + } + + public void SetObject(int x, int y, int width, int height) + { + _plain.setPosition(x, y, width, height); + } + } +} diff --git a/AirPlaneWithRadar/AirPlaneWithRadar/DrawingPlain.cs b/AirPlaneWithRadar/AirPlaneWithRadar/DrawingPlain.cs index 5ca6b12..2211625 100644 --- a/AirPlaneWithRadar/AirPlaneWithRadar/DrawingPlain.cs +++ b/AirPlaneWithRadar/AirPlaneWithRadar/DrawingPlain.cs @@ -121,5 +121,9 @@ namespace AirPlaneWithRadar if(startPosY + plainHeight > pictureHeight) startPosY = pictureHeight.Value - plainHeight; } + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return (startPosX, startPosY, startPosX + plainWidth, startPosY + plainHeight); + } } } diff --git a/AirPlaneWithRadar/AirPlaneWithRadar/IDrawingObject.cs b/AirPlaneWithRadar/AirPlaneWithRadar/IDrawingObject.cs new file mode 100644 index 0000000..6fec5b5 --- /dev/null +++ b/AirPlaneWithRadar/AirPlaneWithRadar/IDrawingObject.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirPlaneWithRadar +{ + internal interface IDrawingObject + { + public float Step { get; } + void SetObject(int x, int y, int width, int height); + void MoveObject(Direction direction); + + void DrawningObject(Graphics g); + + (float Left, float Right, float Top, float Bottom) GetCurrentPosition(); + } +}