Добавление интерфейса

This commit is contained in:
Володя 2022-09-26 20:30:30 +03:00
parent 3c588583d4
commit 82c8174312
3 changed files with 63 additions and 0 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

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