55 lines
1.3 KiB
Java
55 lines
1.3 KiB
Java
import javax.print.DocFlavor;
|
|
import java.awt.*;
|
|
|
|
public class DrawningObjectExcavator implements IDrawningObject{
|
|
private DrawningTracktor _tracktor;
|
|
|
|
public DrawningObjectExcavator(DrawningTracktor tracktor) {
|
|
this._tracktor = tracktor;
|
|
}
|
|
|
|
public DrawningTracktor getTracktor() {
|
|
return _tracktor;
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
public String getInfo() {
|
|
if (_tracktor == null) {
|
|
return null;
|
|
}
|
|
|
|
return TracktorSerde.serialize(_tracktor);
|
|
}
|
|
|
|
public static IDrawningObject create(String data) {
|
|
return new DrawningObjectExcavator(TracktorSerde.deserialize(data));
|
|
}
|
|
}
|