/** Search for Figure at clicked position */
public Figure searchFigureInArea(Point pos){
int i , j;
System.out.println("############## Searching Figure #################");
// for(Figure figure : figures){
for (int fig = figures.size() - 1; fig >= 0; --fig){
for(i = figure.getXPosition(); i <= (figure.getXPosition() + figure.getWidth()); i++){
for(j = figure.getYPosition(); j <=( figure.getYPosition() + figure.getHeight()); j++){
if(i == pos.x && j == pos.y){
System.out.println("Found figure at: "+i+"/"+j);
System.out.println("Resulution of found figure: "+figure.getWidth()+" x "+figure.getHeight()+ "px");
System.out.println("Position of found figure: "+figure.getXPosition()+"/"+figure.getYPosition());
return figure;
}
}
}
}
//}
System.out.println("nothing found !");
return null;
}
Figure f = figures.get(i);
for (int fig = figures.size() - 1; fig >= 0; --fig){
// Hier
Figure figure = figures.get(fig);
for(i = figure.getXPosition(); i <= (figure.getXPosition() + figure.getWidth()); i++){
for(j = figure.getYPosition(); j <=( figure.getYPosition() + figure.getHeight()); j++){
if(i == pos.x && j == pos.y){
System.out.println("Found figure at: "+i+"/"+j);
System.out.println("Resulution of found figure: "+figure.getWidth()+" x "+figure.getHeight()+ "px");
System.out.println("Position of found figure: "+figure.getXPosition()+"/"+figure.getYPosition());
return figure;
}
}
}
}