for (Shape shape : shapes) {
for(int i=0; i<shape.getChildren().size(); i++) {
DrawingAPI object = (DrawingAPI) shape.getGraphicObjectByIndex(i);
System.out.println(shape.getGraphicObjectByIndex(i).toString());
if(shape.getGraphicObjectByIndex(i).toString().contains("Dreieck")) {
shape.switchObjectTo(new DreieckRot(object.getX(), object.getY(), object.getWidth(), object.getHeight()), i);
}
else if(shape.getGraphicObjectByIndex(i).toString().contains("Rechteck")) {
shape.switchObjectTo(new RechteckRot(object.getX(), object.getY(), object.getWidth(), object.getHeight()), i);
}
else if(shape.getGraphicObjectByIndex(i).toString().contains("Kreis")) {
shape.switchObjectTo(new KreisRot(object.getX(), object.getY(), object.getWidth(), object.getHeight()), i);
}
}
}
break;
case DEFAULT:
for (Shape shape : shapes) {
for(int i=0; i<shape.getChildren().size(); i++) {
DrawingAPI object = (DrawingAPI) shape.getGraphicObjectByIndex(i);
System.out.println(shape.getGraphicObjectByIndex(i).toString());
if(shape.getGraphicObjectByIndex(i).toString().contains("Dreieck")) {
shape.switchObjectTo(new Dreieck(object.getX(), object.getY(), object.getWidth(), object.getHeight()), i);
}
else if(shape.getGraphicObjectByIndex(i).toString().contains("Rechteck")) {
shape.switchObjectTo(new Rechteck(object.getX(), object.getY(), object.getWidth(), object.getHeight()), i);
}
else if(shape.getGraphicObjectByIndex(i).toString().contains("Kreis")) {
shape.switchObjectTo(new Kreis(object.getX(), object.getY(), object.getWidth(), object.getHeight()), i);
}
}
}
break;