PIbd-12_Karamushko_M.K._Air.../DrawingObjectAircraft.java

56 lines
1.4 KiB
Java
Raw Normal View History

2022-11-10 16:44:45 +04:00
import java.awt.*;
public class DrawingObjectAircraft implements IDrawingObject
{
private DrawingAircraft _aircraft = null;
public DrawingObjectAircraft(DrawingAircraft aircraft){
_aircraft = aircraft;
}
2022-11-25 13:49:46 +04:00
public DrawingAircraft getAircraft() {
return _aircraft;
}
2022-11-10 16:44:45 +04:00
public void MoveObject(Direction direction) {
if(_aircraft == null) return;
_aircraft.MoveTransport(direction);
}
@Override
public float getStep() {
if(_aircraft == null) return 0;
return _aircraft.AirFighter.Step;
}
public void SetObject(int x, int y, int width, int height)
{
_aircraft.SetPosition(x, y, width, height);
}
public void DrawningObject(Graphics2D g)
{
// TODO
_aircraft.DrawTransport(g);
}
@Override
public Point GetLeftTop() {
if(_aircraft == null) return new Point(0,0);
return _aircraft.getLeftTop();
}
@Override
public Point GetRightBottom() {
if(_aircraft == null) return new Point(0,0);
return _aircraft.getRightBottom();
}
2022-12-02 11:17:40 +04:00
@Override
public String GetInfo() {
return AircraftFactory.getDataForSave(_aircraft);
}
public static DrawingObjectAircraft Create(String data) {
return new DrawingObjectAircraft(AircraftFactory.createAircraftFromData(data));
}
2022-11-10 16:44:45 +04:00
}