Morozov V.S. LabWork2 #2
40
AirPlaneWithRadar/AirPlaneWithRadar/DrawingObject.cs
Normal file
40
AirPlaneWithRadar/AirPlaneWithRadar/DrawingObject.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
AirPlaneWithRadar/AirPlaneWithRadar/IDrawingObject.cs
Normal file
19
AirPlaneWithRadar/AirPlaneWithRadar/IDrawingObject.cs
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user
Код по заданию отсутствует