src/model/map/MapImage.java
public static World loadWorldFromImage(File file) {
        World w = null;
        try {
            BufferedImage img = ImageIO.read(file);
            w = new World(img.getWidth() / SCALE, img.getHeight() / SCALE);
            log.info("Image size is: " + img.getWidth() / SCALE + " " + img.getHeight() / SCALE);

            int i = 0;
            int j = 0;
            for (int x = 0; x <= img.getWidth() - SCALE; x += SCALE) {
                j = 0;
                for (int y = 0; y <= img.getHeight() - SCALE; y += SCALE) {
                    if (isBlockRoad(img, x, y)) {
                        w.grid[i][j] = new Cell(CellType.PATH, i, j);
                    } else {
                        w.grid[i][j] = new Cell(CellType.HOUSE, i, j);
                    }
                    j++;
                }
                i++;
            }
        } catch (Exception e) {
            log.severe(e.getMessage());
            e.printStackTrace();
        }

        return w;
    }
/**
     * Returns the world loaded from the specified image file if valid, 
     * null otherwise.
     */
Returns the world loaded from the specified image file if valid,
null otherwise.
Returns the world loaded from the specified image file if valid null otherwise .
public static World loadWorldFromImage(File file) {
        World w = null;
        try {
            BufferedImage img = ImageIO.read(file);
            w = new World(img.getWidth() / SCALE, img.getHeight() / SCALE);
            log.info("Image size is: " + img.getWidth() / SCALE + " " + img.getHeight() / SCALE);
            int i = 0;
            int j = 0;
            for (int x = 0; x <= img.getWidth() - SCALE; x += SCALE) {
                j = 0;
                for (int y = 0; y <= img.getHeight() - SCALE; y += SCALE) {
                    if (isBlockRoad(img, x, y)) {
                        w.grid[i][j] = new Cell(CellType.PATH, i, j);
                    } else {
                        w.grid[i][j] = new Cell(CellType.HOUSE, i, j);
                    }
                    j++;
                }
                i++;
            }
        } catch (Exception e) {
            log.severe(e.getMessage());
            e.printStackTrace();
        }
        return w;
    }
public static World loadWorldFromImage ( File file ) { World w = null ; try { BufferedImage img = ImageIO . read ( file ) ; w = new World ( img . getWidth ( ) / SCALE , img . getHeight ( ) / SCALE ) ; log . info ( "Image size is: " + img . getWidth ( ) / SCALE + " " + img . getHeight ( ) / SCALE ) ; int i = 0 ; int j = 0 ; for ( int x = 0 ; x <= img . getWidth ( ) - SCALE ; x += SCALE ) { j = 0 ; for ( int y = 0 ; y <= img . getHeight ( ) - SCALE ; y += SCALE ) { if ( isBlockRoad ( img , x , y ) ) { w . grid [ i ] [ j ] = new Cell ( CellType . PATH , i , j ) ; } else { w . grid [ i ] [ j ] = new Cell ( CellType . HOUSE , i , j ) ; } j ++ ; } i ++ ; } } catch ( Exception e ) { log . severe ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } return w ; }
Returns the world loaded from the specified image file if valid,
 null otherwise.
Returns the world loaded from the specified image file if valid null otherwise .