/**************************************************************************
     * Drawing the image of the world and assign on the ImageViewer in the GUI
     * not very fast, can be improved...
     **************************************************************************/
public synchronized void draw_World(){
       //for each cells 
       ant1nbCells=0;
       ant2nbCells=0;
       ant3nbCells=0;
       ant4nbCells=0;
        for (int x=0;x<WIDTH;x++){
            for (int y=0;y<HEIGHT;y++){
                //test is colorized
                if (world.getLocation().get((WIDTH*y)+x).isColorized()){
                    //System.out.print("(x,y)=("+x+","+y+")&");
                    //yes draw a point with this color
                    wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS());
                    if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;}
                    if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;}
                    if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;}
                    if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;}
                }
                else 
                {
                    //no draw a black point
                     wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK);
                }
            }
        }
        imgWorld.setImage(wimgWorld); //show me the result on scsreen
        //refresh counters
        lbTotalCellsNb.setText(nbTotalCells+" cells");
        lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)");
        lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)");
        lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)");
        lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)");
    }
public synchronized void draw_World(){
//for each cells
ant1nbCells=0;
ant2nbCells=0;
ant3nbCells=0;
ant4nbCells=0;
for (int x=0;x<WIDTH;x++){
for (int y=0;y<HEIGHT;y++){
//test is colorized
if (world.getLocation().get((WIDTH*y)+x).isColorized()){
//System.out.print("(x,y)=("+x+","+y+")&");
//yes draw a point with this color
wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS());
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;}
}
else
{
//no draw a black point
wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK);
}
}
}
imgWorld.setImage(wimgWorld); //show me the result on scsreen
//refresh counters
lbTotalCellsNb.setText(nbTotalCells+" cells");
lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)");
lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)");
lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)");
lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)");
}
public synchronized void draw_World(){
//for each cells
ant1nbCells=0;
ant2nbCells=0;
ant3nbCells=0;
ant4nbCells=0;
for (int x=0;x<WIDTH;x++){
for (int y=0;y<HEIGHT;y++){
//test is colorized
if (world.getLocation().get((WIDTH*y)+x).isColorized()){
//System.out.print("(x,y)=("+x+","+y+")&");
//yes draw a point with this color
wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS());
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;}
}
else
{
//no draw a black point
wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK);
}
}
}
imgWorld.setImage(wimgWorld); //show me the result on scsreen
//refresh counters
lbTotalCellsNb.setText(nbTotalCells+" cells");
lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)");
lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)");
lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)");
lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)");
}
public synchronized void draw_World(){
//for each cells
ant1nbCells=0;
ant2nbCells=0;
ant3nbCells=0;
ant4nbCells=0;
for (int x=0;x<WIDTH;x++){
for (int y=0;y<HEIGHT;y++){
//test is colorized
if (world.getLocation().get((WIDTH*y)+x).isColorized()){
//System.out.print("(x,y)=("+x+","+y+")&");
//yes draw a point with this color
wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS());
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;}
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;}
}
else
{
//no draw a black point
wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK);
}
}
}
imgWorld.setImage(wimgWorld); //show me the result on scsreen
//refresh counters
lbTotalCellsNb.setText(nbTotalCells+" cells");
lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)");
lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)");
lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)");
lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)");
}