this.buffer = buffer;
}
// --------------------------------------------------------------------------
public GridLayer createLayer() {
GridLayer layer = new GridLayer();
layer.setEnvelop(layerEnvelop);
layer.setName(rootPath);
File[] directoryList = getGridDirList();
int num = directoryList.length;
Grid[] grids = new Grid[num];
// create GridDataSource
FileImageData gridData = new FileImageData();
gridData.setFormatName(formatName);
gridData.setRootPath(rootPath);
int i = 0;
for (File dir : directoryList) {
String path = dir.getPath();
String dirName = dir.getName();
double scale = getScale(dirName);
Grid grid = new Grid();
grid.setParameters(parameters);
grid.setScale(scale);
grid.setSubEnvelop(getEnvelop(0, 0, scale));
setTile4Grid(grid, path);
grid.setGridData(gridData);
grids[i] = grid;
i++;
}
layer.setGrids(grids);
return layer;
}