1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| public abstract class Forme implements Shape {
private Shape shape;
public Forme(Shape shape) {
this.shape=shape;
}
public void rotation(double theta) {
Rectangle2D bounds = getBounds2D();
shape = AffineTransform.getRotateInstance(theta, bounds.getCenterX(), bounds.getCenterY()).createTransformedShape(shape);
}
@Override
public Rectangle getBounds() {
return shape.getBounds();
}
@Override
public Rectangle2D getBounds2D() {
return shape.getBounds2D();
}
@Override
public boolean contains(double x, double y) {
return shape.contains(x, y);
}
@Override
public boolean contains(Point2D p) {
return shape.contains(p);
}
@Override
public boolean intersects(double x, double y, double w, double h) {
return shape.intersects(x, y, w, h);
}
@Override
public boolean intersects(Rectangle2D r) {
return shape.intersects(r);
}
@Override
public boolean contains(double x, double y, double w, double h) {
return shape.contains(x, y, w, h);
}
@Override
public boolean contains(Rectangle2D r) {
return shape.contains(r);
}
@Override
public PathIterator getPathIterator(AffineTransform at) {
return shape.getPathIterator(at);
}
@Override
public PathIterator getPathIterator(AffineTransform at, double flatness) {
return shape.getPathIterator(at, flatness);
}
} |
Partager