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(); + } +}