2022-11-07 00:26:51 +04:00
|
|
|
import javax.print.DocFlavor;
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class DrawningObjectExcavator implements IDrawningObject{
|
2022-11-22 00:21:46 +04:00
|
|
|
private DrawningTracktor _tracktor;
|
2022-11-07 00:26:51 +04:00
|
|
|
|
|
|
|
public DrawningObjectExcavator(DrawningTracktor tracktor) {
|
|
|
|
this._tracktor = tracktor;
|
|
|
|
}
|
|
|
|
|
2022-11-22 00:21:46 +04:00
|
|
|
public DrawningTracktor getTracktor() {
|
|
|
|
return _tracktor;
|
|
|
|
}
|
|
|
|
|
2022-11-07 00:26:51 +04:00
|
|
|
public float getStep() {
|
|
|
|
if (_tracktor != null && _tracktor.Tracktor != null) {
|
|
|
|
return _tracktor.Tracktor.getStep();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float[] getCurrentPosition() {
|
|
|
|
if (_tracktor != null) {
|
|
|
|
return _tracktor.getCurrentPosition();
|
|
|
|
}
|
|
|
|
return new float[] { 0, 0, 0, 0 };
|
|
|
|
}
|
|
|
|
|
|
|
|
public void moveObject(Direction direction) {
|
|
|
|
if (_tracktor != null) {
|
|
|
|
_tracktor.MoveTransport(direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setObject(int x, int y, int width, int height) {
|
|
|
|
_tracktor.SetPosition(x, y, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void drawningObject(Graphics2D g) {
|
|
|
|
_tracktor.DrawTransport(g);
|
|
|
|
}
|
2022-12-06 15:01:05 +04:00
|
|
|
|
|
|
|
public String getInfo() {
|
|
|
|
if (_tracktor == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TracktorSerde.serialize(_tracktor);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static IDrawningObject create(String data) {
|
|
|
|
return new DrawningObjectExcavator(TracktorSerde.deserialize(data));
|
|
|
|
}
|
2022-11-07 00:26:51 +04:00
|
|
|
}
|