Salve a tutti, ecco il mio problema devo fare un cast fra un oggetto di tipo Shape in Line2D.Double. Il tutto va bene, ma quando faccio delle trasformazioni affini sull'oggetto Shape il cast nn va a buon fine.
import java.awt.geom.*;
import java.awt.*;
public class Test {
public static void main(String[] args) {
Line2D.Double line = new Line2D.Double(100,100,200,200);
System.out.println("Costruito line " + line.toString());
Shape s = (Line2D.Double)line;
System.out.println("Costruito shape " + s.toString());
/*
* trasformazioni affine
*/
AffineTransform af = new AffineTransform();
AffineTransform afScale = new AffineTransform();
afScale= af.getScaleInstance(200, 200);
s = afScale.createTransformedShape(s);
Line2D.Double line2 = (Line2D.Double)s;
System.out.println(line2.getX1() + " " + line2.getY1());
}
}
Help me !!!![]()