/* * (non-Javadoc) * * @see controller.Command#execute() */ public void execute() { Point anchor = getAnchorPoint(objects); double shx = Math.tan((angleDegrees / 360) * (2 * Math.PI)); System.out.printf("Applying sheerx of %f%n", shx); for (Object shapeObj : objects) { Shape shape = (Shape) shapeObj; mt.addMememto(shape); AffineTransform t = shape.getAffineTransform(); t.translate(anchor.x, anchor.y); t.shear(shx, 0); t.translate(-anchor.x, -anchor.y); shape.setAffineTransform(t); } }
private void addToShapes(Shape shape) { shape.setColor(color); shape.setPencil(pencil); shapes.add(shape); }