public abstract class AbstractMovableRotatableView extends AbstractMovableView
AbstractMovableView o verejne metody suvisiace s rotaciou.
//chceme aby sa dala zistovat a menit pozicia aj rotacia
//preto dedime od AbstractMovableRotatableView a vyuzijeme zdedene metody
public class House extends AbstractMovableRotatableView{
private PolygonView roof;
private RectangleView wall;
public House(GroupView parent, double positionX, double positionY) {
super(parent, positionX, positionY, 0);
add( roof = new PolygonView(0, -20, Color.RED, true, 20,0, 0,-20, -20,0));
add( wall = new RectangleView(0, -10, 30, 20, 0, Color.LIGHT_GRAY, true));
}
}
public static void main(String[] args) {
MainWindow window = new MainWindow("vytvorenie triedy dediacej od AbstractMovableRotatableView");
window.setVisible(true);
GroupView group = window.getRootGroup();
House house = new House(group, 100, 100);
Position position = house.getPosition();
double rotation = house.getRotation();
}

AbstractView,
AbstractMovableView| Constructor and Description |
|---|
AbstractMovableRotatableView(GroupView parent,
double positionX,
double positionY,
double rotation) |
AbstractMovableRotatableView(GroupView parent,
Position position,
double rotation) |
| Modifier and Type | Method and Description |
|---|---|
double |
getRotation() |
void |
moveForwards(double length) |
void |
rotate(double diffRotationAngle) |
void |
setRotation(double rotationAngle) |
getPosition, getPositionX, getPositionY, move, moveInDirection, moveTowards, setPosition, setPosition, setPositionX, setPositionYadd, add, addDrawableChangeListener, draw, getBaseGroup, remove, remove, removeDrawableChangeListener, toStringexternalToInternalCoordinates, fireChanged, getParent, globalToInternalCoordinates, internalToExternalCoordinates, internalToGlobalCoordinates, setParent, throwIfNegativepublic AbstractMovableRotatableView(GroupView parent, double positionX, double positionY, double rotation)